Commit 639cfbc251ac93b1b464c1220a884f2362906ec0
1 parent
b3f7df1d
Exists in
master
and in
27 other branches
Replaced all occurences of RAILS_ROOT to Rails.root
Showing
83 changed files
with
185 additions
and
185 deletions
Show diff stats
app/controllers/public/chat_controller.rb
... | ... | @@ -19,7 +19,7 @@ class ChatController < PublicController |
19 | 19 | def avatar |
20 | 20 | profile = environment.profiles.find_by_identifier(params[:id]) |
21 | 21 | filename, mimetype = profile_icon(profile, :minor, true) |
22 | - data = File.read(File.join(RAILS_ROOT, 'public', filename)) | |
22 | + data = File.read(File.join(Rails.root, 'public', filename)) | |
23 | 23 | render :text => data, :layout => false, :content_type => mimetype |
24 | 24 | expires_in 24.hours |
25 | 25 | end | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -301,7 +301,7 @@ module ApplicationHelper |
301 | 301 | |
302 | 302 | name = klass.name.underscore |
303 | 303 | VIEW_EXTENSIONS.each do |ext| |
304 | - return "blocks/profile_info_actions/"+name+ext if File.exists?(File.join(RAILS_ROOT, 'app', 'views', 'blocks', 'profile_info_actions', name+ext)) | |
304 | + return "blocks/profile_info_actions/"+name+ext if File.exists?(File.join(Rails.root, 'app', 'views', 'blocks', 'profile_info_actions', name+ext)) | |
305 | 305 | end |
306 | 306 | |
307 | 307 | view_for_profile_actions(klass.superclass) |
... | ... | @@ -320,7 +320,7 @@ module ApplicationHelper |
320 | 320 | "\n" + |
321 | 321 | sources.flatten.map do |source| |
322 | 322 | filename = filename_for_stylesheet(source.to_s, themed_source) |
323 | - if File.exists?(File.join(RAILS_ROOT, 'public', filename)) | |
323 | + if File.exists?(File.join(Rails.root, 'public', filename)) | |
324 | 324 | "@import url(#{filename});\n" |
325 | 325 | else |
326 | 326 | "/* Not included: url(#{filename}) */\n" |
... | ... | @@ -392,7 +392,7 @@ module ApplicationHelper |
392 | 392 | |
393 | 393 | def theme_include(template) |
394 | 394 | ['.rhtml', '.html.erb'].each do |ext| |
395 | - file = (RAILS_ROOT + '/public' + theme_path + '/' + template + ext) | |
395 | + file = (Rails.root + '/public' + theme_path + '/' + template + ext) | |
396 | 396 | if File.exists?(file) |
397 | 397 | return render :file => file, :use_full_path => false |
398 | 398 | end |
... | ... | @@ -402,7 +402,7 @@ module ApplicationHelper |
402 | 402 | |
403 | 403 | def theme_favicon |
404 | 404 | return '/designs/themes/' + current_theme + '/favicon.ico' if profile.nil? || profile.theme.nil? |
405 | - if File.exists?(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')) | |
405 | + if File.exists?(File.join(Rails.root, 'public', theme_path, 'favicon.ico')) | |
406 | 406 | '/designs/themes/' + profile.theme + '/favicon.ico' |
407 | 407 | else |
408 | 408 | favicon = profile.articles.find_by_path('favicon.ico') |
... | ... | @@ -498,7 +498,7 @@ module ApplicationHelper |
498 | 498 | compact.uniq.map{ |c| |
499 | 499 | cat_name = c.gsub( /[-_\s,.;'"]+/, '_' ) |
500 | 500 | cat_icon = "/images/icons-cat/#{cat_name}.png" |
501 | - if ! File.exists? RAILS_ROOT.to_s() + '/public/' + cat_icon | |
501 | + if ! File.exists? Rails.root.to_s() + '/public/' + cat_icon | |
502 | 502 | cat_icon = '/images/icons-cat/undefined.png' |
503 | 503 | end |
504 | 504 | content_tag 'span', |
... | ... | @@ -654,7 +654,7 @@ module ApplicationHelper |
654 | 654 | end |
655 | 655 | |
656 | 656 | def theme_option(opt = nil) |
657 | - conf = RAILS_ROOT.to_s() + | |
657 | + conf = Rails.root.to_s() + | |
658 | 658 | '/public' + theme_path + |
659 | 659 | '/theme.yml' |
660 | 660 | if File.exists?(conf) |
... | ... | @@ -693,7 +693,7 @@ module ApplicationHelper |
693 | 693 | option.each do |file| |
694 | 694 | file = theme_path + |
695 | 695 | '/javascript/'+ file +'.js' |
696 | - if File.exists? RAILS_ROOT.to_s() +'/public'+ file | |
696 | + if File.exists? Rails.root.to_s() +'/public'+ file | |
697 | 697 | html << javascript_src_tag( file, {} ) |
698 | 698 | else |
699 | 699 | html << '<!-- Not included: '+ file +' -->' |
... | ... | @@ -924,7 +924,7 @@ module ApplicationHelper |
924 | 924 | theme_icon_themes = theme_option(:icon_theme) || [] |
925 | 925 | for icon_theme in theme_icon_themes do |
926 | 926 | theme_path = "/designs/icons/#{icon_theme}/style.css" |
927 | - if File.exists?(File.join(RAILS_ROOT, 'public', theme_path)) | |
927 | + if File.exists?(File.join(Rails.root, 'public', theme_path)) | |
928 | 928 | icon_themes << theme_path |
929 | 929 | end |
930 | 930 | end | ... | ... |
app/models/doc_item.rb
... | ... | @@ -31,7 +31,7 @@ class DocItem |
31 | 31 | search_path.unshift("/designs/themes/#{theme}#{translation}") # higher priority |
32 | 32 | search_path.push("/designs/themes/#{theme}#{image}") # lower priority |
33 | 33 | end |
34 | - search_path.find {|file| File.exist?("#{RAILS_ROOT}/public#{file}") } | |
34 | + search_path.find {|file| File.exist?("#{Rails.root}/public#{file}") } | |
35 | 35 | end |
36 | 36 | |
37 | 37 | end | ... | ... |
app/models/doc_section.rb
app/models/layout_template.rb
... | ... | @@ -7,7 +7,7 @@ class LayoutTemplate |
7 | 7 | end |
8 | 8 | |
9 | 9 | def self.all |
10 | - Dir.glob(File.join(RAILS_ROOT, 'public', 'designs', 'templates', '*')).map {|item| find(File.basename(item)) } | |
10 | + Dir.glob(File.join(Rails.root, 'public', 'designs', 'templates', '*')).map {|item| find(File.basename(item)) } | |
11 | 11 | end |
12 | 12 | |
13 | 13 | attr_reader :id |
... | ... | @@ -30,7 +30,7 @@ class LayoutTemplate |
30 | 30 | protected |
31 | 31 | |
32 | 32 | def read_config |
33 | - @config = YAML.load_file(File.join(RAILS_ROOT, 'public', 'designs', 'templates', id, 'config.yml')) | |
33 | + @config = YAML.load_file(File.join(Rails.root, 'public', 'designs', 'templates', id, 'config.yml')) | |
34 | 34 | end |
35 | 35 | |
36 | 36 | end | ... | ... |
app/models/theme.rb
... | ... | @@ -10,11 +10,11 @@ class Theme |
10 | 10 | end |
11 | 11 | |
12 | 12 | def user_themes_dir |
13 | - File.join(RAILS_ROOT, 'public', 'user_themes') | |
13 | + File.join(Rails.root, 'public', 'user_themes') | |
14 | 14 | end |
15 | 15 | |
16 | 16 | def system_themes_dir |
17 | - File.join(RAILS_ROOT, 'public', 'designs', 'themes') | |
17 | + File.join(Rails.root, 'public', 'designs', 'themes') | |
18 | 18 | end |
19 | 19 | |
20 | 20 | def create(id, attributes = {}) | ... | ... |
app/models/uploaded_file.rb
... | ... | @@ -29,7 +29,7 @@ class UploadedFile < Article |
29 | 29 | end |
30 | 30 | |
31 | 31 | def thumbnail_path |
32 | - self.image? ? self.full_filename(:display).gsub(File.join(RAILS_ROOT, 'public'), '') : nil | |
32 | + self.image? ? self.full_filename(:display).gsub(File.join(Rails.root, 'public'), '') : nil | |
33 | 33 | end |
34 | 34 | |
35 | 35 | def display_title | ... | ... |
config/environment.rb
... | ... | @@ -11,7 +11,7 @@ extra_controller_dirs = %w[ |
11 | 11 | app/controllers/admin |
12 | 12 | app/controllers/system |
13 | 13 | app/controllers/public |
14 | -].map {|item| File.join(RAILS_ROOT, item) } | |
14 | +].map {|item| File.join(Rails.root, item) } | |
15 | 15 | |
16 | 16 | def noosfero_session_secret |
17 | 17 | require 'fileutils' |
... | ... | @@ -34,8 +34,8 @@ Rails::Initializer.run do |config| |
34 | 34 | # config.frameworks -= [ :action_web_service, :action_mailer ] |
35 | 35 | |
36 | 36 | # Add additional load paths for your own custom dirs |
37 | - # config.load_paths += %W( #{RAILS_ROOT}/extras ) | |
38 | - config.load_paths += %W( #{RAILS_ROOT}/app/sweepers ) | |
37 | + # config.load_paths += %W( #{Rails.root}/extras ) | |
38 | + config.load_paths += %W( #{Rails.root}/app/sweepers ) | |
39 | 39 | |
40 | 40 | # Force all environments to use the same logger level |
41 | 41 | # (by default production uses :info, the others :debug) |
... | ... | @@ -120,7 +120,7 @@ require 'sqlite_extension' |
120 | 120 | |
121 | 121 | # load a local configuration if present, but not under test environment. |
122 | 122 | if !['test', 'cucumber'].include?(ENV['RAILS_ENV']) |
123 | - localconfigfile = File.join(RAILS_ROOT, 'config', 'local.rb') | |
123 | + localconfigfile = File.join(Rails.root, 'config', 'local.rb') | |
124 | 124 | if File.exists?(localconfigfile) |
125 | 125 | require localconfigfile |
126 | 126 | end | ... | ... |
config/initializers/01_load_config.rb
config/initializers/default_icon_theme.rb
1 | 1 | if File.writable?(Rails.root) |
2 | 2 | # create the symlink to the default theme if it does not exist |
3 | - default = File.join(RAILS_ROOT, 'public', 'designs', 'icons', 'default') | |
3 | + default = File.join(Rails.root, 'public', 'designs', 'icons', 'default') | |
4 | 4 | if !File.exists?(default) |
5 | 5 | File.symlink('tango', default) |
6 | 6 | end |
7 | 7 | |
8 | 8 | # create a symlink to system-wide Tango icon set if it does not exist |
9 | - tango_symlink = File.join(RAILS_ROOT, 'public', 'designs', 'icons', 'tango', 'Tango') | |
9 | + tango_symlink = File.join(Rails.root, 'public', 'designs', 'icons', 'tango', 'Tango') | |
10 | 10 | if !File.exist?(tango_symlink) |
11 | 11 | File.symlink('/usr/share/icons/Tango', tango_symlink) |
12 | 12 | end | ... | ... |
config/initializers/default_theme.rb
1 | 1 | if File.writable?(Rails.root) |
2 | 2 | # create the symlink to the default theme if it does not exist |
3 | - default = File.join(RAILS_ROOT, 'public', 'designs', 'themes', 'default') | |
3 | + default = File.join(Rails.root, 'public', 'designs', 'themes', 'default') | |
4 | 4 | if !File.exists?(default) |
5 | 5 | File.symlink('noosfero', default) |
6 | 6 | end | ... | ... |
features/support/fixtures.rb
1 | 1 | # set the very basic fixtures for Noosfero |
2 | 2 | Fixtures.reset_cache |
3 | -fixtures_folder = File.join(RAILS_ROOT, 'test', 'fixtures') | |
3 | +fixtures_folder = File.join(Rails.root, 'test', 'fixtures') | |
4 | 4 | fixtures = ['environments', 'roles'] |
5 | 5 | Fixtures.create_fixtures(fixtures_folder, fixtures) |
6 | 6 | ... | ... |
features/support/selenium.rb
... | ... | @@ -14,7 +14,7 @@ DatabaseCleaner.strategy = :truncation |
14 | 14 | |
15 | 15 | Before do |
16 | 16 | Fixtures.reset_cache |
17 | - fixtures_folder = File.join(RAILS_ROOT, 'test', 'fixtures') | |
17 | + fixtures_folder = File.join(Rails.root, 'test', 'fixtures') | |
18 | 18 | fixtures = ['environments', 'roles'] |
19 | 19 | Fixtures.create_fixtures(fixtures_folder, fixtures) |
20 | 20 | ENV['LANG'] = 'C' | ... | ... |
lib/noosfero.rb
... | ... | @@ -61,7 +61,7 @@ module Noosfero |
61 | 61 | private |
62 | 62 | |
63 | 63 | def self.controllers_in_directory(dir) |
64 | - app_controller_path = Dir.glob(File.join(RAILS_ROOT, 'app', 'controllers', dir, '*_controller.rb')) | |
64 | + app_controller_path = Dir.glob(File.join(Rails.root, 'app', 'controllers', dir, '*_controller.rb')) | |
65 | 65 | app_controller_path.map do |item| |
66 | 66 | item.gsub(/^.*\/([^\/]+)_controller.rb$/, '\1') |
67 | 67 | end | ... | ... |
lib/noosfero/multi_tenancy.rb
... | ... | @@ -25,7 +25,7 @@ module Noosfero |
25 | 25 | private |
26 | 26 | |
27 | 27 | def self.load_map |
28 | - db_file = File.join(RAILS_ROOT, 'config', 'database.yml') | |
28 | + db_file = File.join(Rails.root, 'config', 'database.yml') | |
29 | 29 | db_config = YAML.load_file(db_file) |
30 | 30 | map = { } |
31 | 31 | db_config.each do |env, attr| |
... | ... | @@ -36,7 +36,7 @@ module Noosfero |
36 | 36 | end |
37 | 37 | |
38 | 38 | def self.is_hosted_environment? |
39 | - db_file = File.join(RAILS_ROOT, 'config', 'database.yml') | |
39 | + db_file = File.join(Rails.root, 'config', 'database.yml') | |
40 | 40 | db_config = YAML.load_file(db_file) |
41 | 41 | db_config.select{ |env, attr| RAILS_ENV.to_s.match(/_#{env}$/) }.any? |
42 | 42 | end | ... | ... |
lib/noosfero/plugin.rb
... | ... | @@ -67,7 +67,7 @@ class Noosfero::Plugin |
67 | 67 | end |
68 | 68 | |
69 | 69 | def root_path |
70 | - File.join(RAILS_ROOT, 'plugins', public_name) | |
70 | + File.join(Rails.root, 'plugins', public_name) | |
71 | 71 | end |
72 | 72 | |
73 | 73 | def view_path |
... | ... | @@ -93,7 +93,7 @@ class Noosfero::Plugin |
93 | 93 | end |
94 | 94 | |
95 | 95 | def expanded_template(file_path, locals = {}) |
96 | - views_path = "#{RAILS_ROOT}/plugins/#{self.class.public_name}/views" | |
96 | + views_path = "#{Rails.root}/plugins/#{self.class.public_name}/views" | |
97 | 97 | ERB.new(File.read("#{views_path}/#{file_path}")).result(binding) |
98 | 98 | end |
99 | 99 | ... | ... |
lib/postgresql_attachment_fu.rb
... | ... | @@ -10,7 +10,7 @@ module PostgresqlAttachmentFu |
10 | 10 | def full_filename(thumbnail = nil) |
11 | 11 | file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix].to_s |
12 | 12 | file_system_path = File.join(file_system_path, ActiveRecord::Base.connection.schema_search_path) if ActiveRecord::Base.postgresql? and Noosfero::MultiTenancy.on? |
13 | - File.join(RAILS_ROOT, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail))) | |
13 | + File.join(Rails.root, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail))) | |
14 | 14 | end |
15 | 15 | end |
16 | 16 | ... | ... |
lib/tasks/cucumber.rake
1 | 1 | # This file was generated by |
2 | -$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib') | |
2 | +$LOAD_PATH.unshift(Rails.root + '/vendor/plugins/cucumber/lib') if File.directory?(Rails.root + '/vendor/plugins/cucumber/lib') | |
3 | 3 | |
4 | 4 | unless ARGV.any? {|a| a =~ /^gems/} |
5 | 5 | |
... | ... | @@ -8,7 +8,7 @@ begin |
8 | 8 | |
9 | 9 | # Use vendored cucumber binary if possible. If it's not vendored, |
10 | 10 | # Cucumber::Rake::Task will automatically use installed gem's cucumber binary |
11 | - vendored_cucumber_binary = Dir["#{RAILS_ROOT}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first | |
11 | + vendored_cucumber_binary = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first | |
12 | 12 | |
13 | 13 | namespace :cucumber do |
14 | 14 | Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| | ... | ... |
lib/tasks/doc.rake
... | ... | @@ -5,12 +5,12 @@ namespace :noosfero do |
5 | 5 | end |
6 | 6 | task :link_plugins_textiles do |
7 | 7 | plugins_textiles.each do |file| |
8 | - ln_sf File.join(RAILS_ROOT, file), 'doc/noosfero/plugins/' | |
8 | + ln_sf File.join(Rails.root, file), 'doc/noosfero/plugins/' | |
9 | 9 | end |
10 | 10 | end |
11 | 11 | task :unlink_plugins_textiles do |
12 | - rm_f Dir.glob(File.join(RAILS_ROOT, 'doc/noosfero/plugins/*.textile')) - | |
13 | - [File.join(RAILS_ROOT, 'doc/noosfero/plugins/index.textile')] | |
12 | + rm_f Dir.glob(File.join(Rails.root, 'doc/noosfero/plugins/*.textile')) - | |
13 | + [File.join(Rails.root, 'doc/noosfero/plugins/index.textile')] | |
14 | 14 | end |
15 | 15 | input = Dir.glob('doc/noosfero/**/*.textile') + plugins_textiles.map{|i| "doc/noosfero/plugins/#{File.basename(i)}"} |
16 | 16 | topics_xhtml = input.map { |item| item.sub('.textile', '.en.xhtml') }.uniq | ... | ... |
lib/tasks/error_messages.rake
lib/tasks/multitenancy.rake
... | ... | @@ -2,14 +2,14 @@ namespace :multitenancy do |
2 | 2 | |
3 | 3 | task :create do |
4 | 4 | db_envs = ActiveRecord::Base.configurations.keys.select{ |k| k.match(/_development$|_production$|_test$/) } |
5 | - cd File.join(RAILS_ROOT, 'config', 'environments'), :verbose => true | |
5 | + cd File.join(Rails.root, 'config', 'environments'), :verbose => true | |
6 | 6 | file_envs = Dir.glob "{*_development.rb,*_prodution.rb,*_test.rb}" |
7 | 7 | (db_envs.map{ |e| e + '.rb' } - file_envs).each { |env| ln_s env.split('_').last, env } |
8 | 8 | end |
9 | 9 | |
10 | 10 | task :remove do |
11 | 11 | db_envs = ActiveRecord::Base.configurations.keys.select{ |k| k.match(/_development$|_production$|_test$/) } |
12 | - cd File.join(RAILS_ROOT, 'config', 'environments'), :verbose => true | |
12 | + cd File.join(Rails.root, 'config', 'environments'), :verbose => true | |
13 | 13 | file_envs = Dir.glob "{*_development.rb,*_prodution.rb,*_test.rb}" |
14 | 14 | (file_envs - db_envs.map{ |e| e + '.rb' }).each { |env| safe_unlink env } |
15 | 15 | end | ... | ... |
lib/tasks/po.rake
... | ... | @@ -25,7 +25,7 @@ namespace :po do |
25 | 25 | puts "+----------+----------+------------+--------+--------------+" |
26 | 26 | puts "| Language | Messages | Translated | Fuzzy | Untranslated |" |
27 | 27 | puts "+----------+----------+------------+--------+--------------+" |
28 | - Dir.glob(RAILS_ROOT + '/po/*/noosfero.po').each do |file| | |
28 | + Dir.glob(Rails.root + '/po/*/noosfero.po').each do |file| | |
29 | 29 | language = File.basename(File.dirname(file)) |
30 | 30 | output = `msgfmt --output /dev/null --statistics #{file} 2>&1` |
31 | 31 | translated = extract_po_stat('translated', output) | ... | ... |
lib/tasks/test_rcov.rake
... | ... | @@ -22,8 +22,8 @@ namespace :test do |
22 | 22 | task :rcov do |t| |
23 | 23 | require 'rbconfig' |
24 | 24 | |
25 | - tests = Dir.glob(File.join(RAILS_ROOT, 'test', '*', '*_test.rb')) | |
26 | - outdir = File.join(RAILS_ROOT, 'coverage') | |
25 | + tests = Dir.glob(File.join(Rails.root, 'test', '*', '*_test.rb')) | |
26 | + outdir = File.join(Rails.root, 'coverage') | |
27 | 27 | test_loader = File.join(Config::CONFIG['rubylibdir'], 'rake', 'rake_test_loader.rb') |
28 | 28 | |
29 | 29 | system("rcov", '-o', outdir, '-T', '-x', 'rubygems/*,rcov*', '--rails', '-Ilib:test', test_loader, *tests) | ... | ... |
plugins/mezuro/lib/kalibro/model.rb
... | ... | @@ -88,7 +88,7 @@ class Kalibro::Model |
88 | 88 | end |
89 | 89 | |
90 | 90 | def self.client(endpoint) |
91 | - service_address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yaml") | |
91 | + service_address = YAML.load_file("#{Rails.root}/plugins/mezuro/service.yaml") | |
92 | 92 | Savon::Client.new("#{service_address}#{endpoint}Endpoint/?wsdl") |
93 | 93 | end |
94 | 94 | ... | ... |
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
... | ... | @@ -11,7 +11,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper |
11 | 11 | end |
12 | 12 | |
13 | 13 | def self.create_license_options |
14 | - options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") | |
14 | + options = YAML.load_file("#{Rails.root}/plugins/mezuro/licenses.yaml") | |
15 | 15 | options = options.split(";") |
16 | 16 | formated_options = [] |
17 | 17 | options.each { |option| formated_options << [option, option] } |
... | ... | @@ -50,7 +50,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper |
50 | 50 | end |
51 | 51 | |
52 | 52 | def self.get_license_option(selected) |
53 | - options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") | |
53 | + options = YAML.load_file("#{Rails.root}/plugins/mezuro/licenses.yaml") | |
54 | 54 | options.split(";") |
55 | 55 | selected_option = options.find { |license| license == selected } |
56 | 56 | end | ... | ... |
plugins/mezuro/test/features/echo_port_test.rb
1 | 1 | require "test_helper" |
2 | 2 | |
3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" | |
4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | |
5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | |
6 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" | |
3 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" | |
4 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" | |
5 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" | |
6 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" | |
7 | 7 | |
8 | 8 | class EchoPortTest < ActiveSupport::TestCase |
9 | 9 | |
10 | 10 | def setup |
11 | 11 | @port = Kalibro::Client::Port.new('Echo') |
12 | - address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yaml") | |
12 | + address = YAML.load_file("#{Rails.root}/plugins/mezuro/service.yaml") | |
13 | 13 | address['KalibroService'] = 'KalibroFake' |
14 | 14 | @port.service_address=(address); |
15 | 15 | end | ... | ... |
plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb
1 | 1 | require 'test_helper' |
2 | 2 | |
3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" | |
4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" | |
5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/native_metric_fixtures" | |
6 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | |
7 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | |
8 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" | |
3 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" | |
4 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" | |
5 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/native_metric_fixtures" | |
6 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | |
7 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" | |
8 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" | |
9 | 9 | |
10 | 10 | class MezuroPluginMyprofileControllerTest < ActionController::TestCase |
11 | 11 | ... | ... |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
1 | 1 | require 'test_helper' |
2 | 2 | |
3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | |
4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" | |
5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" | |
6 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" | |
3 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" | |
4 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" | |
5 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" | |
6 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/repository_fixtures" | |
7 | 7 | |
8 | 8 | class MezuroPluginProfileControllerTest < ActionController::TestCase |
9 | 9 | ... | ... |
plugins/mezuro/test/unit/kalibro/base_tool_test.rb
plugins/mezuro/test/unit/kalibro/compound_metric_test.rb
plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb
plugins/mezuro/test/unit/kalibro/configuration_test.rb
plugins/mezuro/test/unit/kalibro/error_test.rb
plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb
1 | 1 | require "test_helper" |
2 | 2 | |
3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | |
4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" | |
3 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | |
4 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" | |
5 | 5 | |
6 | 6 | class MetricConfigurationTest < ActiveSupport::TestCase |
7 | 7 | ... | ... |
plugins/mezuro/test/unit/kalibro/metric_result_test.rb
plugins/mezuro/test/unit/kalibro/module_node_test.rb
plugins/mezuro/test/unit/kalibro/module_result_test.rb
plugins/mezuro/test/unit/kalibro/module_test.rb
plugins/mezuro/test/unit/kalibro/native_metric_test.rb
plugins/mezuro/test/unit/kalibro/project_result_test.rb
plugins/mezuro/test/unit/kalibro/project_test.rb
plugins/mezuro/test/unit/kalibro/range_test.rb
plugins/mezuro/test/unit/kalibro/repository_test.rb
plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb
plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb
plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb
plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb
1 | 1 | require "test_helper" |
2 | 2 | |
3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_fixtures" | |
4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" | |
5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_fixtures" | |
6 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | |
3 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/project_fixtures" | |
4 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" | |
5 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_fixtures" | |
6 | +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" | |
7 | 7 | |
8 | 8 | class ProjectContentTest < ActiveSupport::TestCase |
9 | 9 | ... | ... |
public/dispatch.cgi
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | |
3 | 3 | #!/usr/local/bin/ruby |
4 | 4 | |
5 | -require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) | |
5 | +require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails.root) | |
6 | 6 | |
7 | 7 | # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: |
8 | 8 | # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired | ... | ... |
public/dispatch.fcgi
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | # exceptions which forced the FastCGI instance to exit, great for debugging) |
7 | 7 | # and the number of requests to process before running garbage collection. |
8 | 8 | # |
9 | -# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log | |
9 | +# By default, the FastCGI crash log is Rails.root/log/fastcgi.crash.log | |
10 | 10 | # and the GC period is nil (turned off). A reasonable number of requests |
11 | 11 | # could range from 10-100 depending on the memory footprint of your app. |
12 | 12 | # | ... | ... |
public/dispatch.rb
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | |
3 | 3 | #!/usr/local/bin/ruby |
4 | 4 | |
5 | -require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) | |
5 | +require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails.root) | |
6 | 6 | |
7 | 7 | # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: |
8 | 8 | # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired | ... | ... |
script/reset_db
1 | 1 | #!/usr/bin/env ruby |
2 | 2 | require File.dirname(__FILE__) + '/../config/environment' |
3 | 3 | |
4 | -system "rm #{RAILS_ROOT}/tmp/*.db" | |
5 | -system "rm #{RAILS_ROOT}/db/*.db" | |
6 | -system "rm -rf #{RAILS_ROOT}/public/articles" | |
4 | +system "rm #{Rails.root}/tmp/*.db" | |
5 | +system "rm #{Rails.root}/db/*.db" | |
6 | +system "rm -rf #{Rails.root}/public/articles" | |
7 | 7 | system "rake db:migrate VERSION=0" |
8 | 8 | system "rake db:migrate" |
9 | -system "#{RAILS_ROOT}/script/anhetegua" | |
9 | +system "#{Rails.root}/script/anhetegua" | |
10 | 10 | system "rake db:test:prepare" | ... | ... |
test/factories.rb
... | ... | @@ -265,7 +265,7 @@ module Noosfero::Factory |
265 | 265 | # ExternalFeed |
266 | 266 | ############################################### |
267 | 267 | def defaults_for_external_feed |
268 | - { :address => RAILS_ROOT + '/test/fixtures/files/feed.xml', :blog_id => factory_num_seq } | |
268 | + { :address => Rails.root + '/test/fixtures/files/feed.xml', :blog_id => factory_num_seq } | |
269 | 269 | end |
270 | 270 | |
271 | 271 | def create_external_feed(attrs = {}) |
... | ... | @@ -279,7 +279,7 @@ module Noosfero::Factory |
279 | 279 | # FeedReaderBlock |
280 | 280 | ############################################### |
281 | 281 | def defaults_for_feed_reader_block |
282 | - { :address => RAILS_ROOT + '/test/fixtures/files/feed.xml' } | |
282 | + { :address => Rails.root + '/test/fixtures/files/feed.xml' } | |
283 | 283 | end |
284 | 284 | |
285 | 285 | ############################################### | ... | ... |
test/functional/themes_controller_test.rb
... | ... | @@ -25,7 +25,7 @@ class ThemesControllerTest < ActionController::TestCase |
25 | 25 | FileUtils.rm_rf(TMP_THEMES_DIR) |
26 | 26 | end |
27 | 27 | |
28 | - TMP_THEMES_DIR = RAILS_ROOT + '/test/tmp/themes_controller' | |
28 | + TMP_THEMES_DIR = Rails.root + '/test/tmp/themes_controller' | |
29 | 29 | |
30 | 30 | should 'display themes that can be applied' do |
31 | 31 | env = Environment.default |
... | ... | @@ -216,7 +216,7 @@ class ThemesControllerTest < ActionController::TestCase |
216 | 216 | post :add_image, :profile => 'testinguser', :id => 'mytheme', :image => fixture_file_upload('/files/rails.png', 'image/png', :binary) |
217 | 217 | assert_redirected_to :action => "edit", :id => 'mytheme' |
218 | 218 | assert theme.image_files.include?('rails.png') |
219 | - assert(system('diff', RAILS_ROOT + '/test/fixtures/files/rails.png', TMP_THEMES_DIR + '/mytheme/images/rails.png'), 'should put the correct uploaded file in the right place') | |
219 | + assert(system('diff', Rails.root + '/test/fixtures/files/rails.png', TMP_THEMES_DIR + '/mytheme/images/rails.png'), 'should put the correct uploaded file in the right place') | |
220 | 220 | end |
221 | 221 | |
222 | 222 | should 'link to "test theme"' do | ... | ... |
test/integration/controller_naming_test.rb
... | ... | @@ -3,7 +3,7 @@ require "#{File.dirname(__FILE__)}/../test_helper" |
3 | 3 | class ControllerNamingTest < ActionController::IntegrationTest |
4 | 4 | |
5 | 5 | should 'not have controllers with same name in different folders' do |
6 | - controllers = Dir.glob("#{RAILS_ROOT}/app/controllers/**/*_controller.rb").map { |item| item.split(/\//).last } | |
6 | + controllers = Dir.glob("#{Rails.root}/app/controllers/**/*_controller.rb").map { |item| item.split(/\//).last } | |
7 | 7 | assert_equal controllers.uniq, controllers |
8 | 8 | end |
9 | 9 | ... | ... |
test/integration/tiny_mce_languages_test.rb
... | ... | @@ -11,7 +11,7 @@ class TinyMceLanguagesTest < ActionController::IntegrationTest |
11 | 11 | end |
12 | 12 | |
13 | 13 | def assert_exists_tinymce_language_file(file) |
14 | - filename = RAILS_ROOT + "/public/javascripts/tinymce/jscripts/tiny_mce/" + file | |
14 | + filename = Rails.root + "/public/javascripts/tinymce/jscripts/tiny_mce/" + file | |
15 | 15 | assert(File.exists?(filename), filename + " must exist") |
16 | 16 | end |
17 | 17 | ... | ... |
test/test_helper.rb
... | ... | @@ -19,7 +19,7 @@ require File.dirname(__FILE__) + '/noosfero_doc_test' |
19 | 19 | require File.dirname(__FILE__) + '/action_tracker_test_helper' |
20 | 20 | require File.expand_path(File.dirname(__FILE__) + "/test_solr_helper.rb") |
21 | 21 | |
22 | -FileUtils.rm_rf(File.join(RAILS_ROOT, 'index', 'test')) | |
22 | +FileUtils.rm_rf(File.join(Rails.root, 'index', 'test')) | |
23 | 23 | |
24 | 24 | Image.attachment_options[:path_prefix] = 'test/tmp/public/images' |
25 | 25 | Thumbnail.attachment_options[:path_prefix] = 'test/tmp/public/thumbnails' |
... | ... | @@ -69,7 +69,7 @@ class ActiveSupport::TestCase |
69 | 69 | end |
70 | 70 | |
71 | 71 | def self.all_fixtures |
72 | - Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.yml')).each do |item| | |
72 | + Dir.glob(File.join(Rails.root, 'test', 'fixtures', '*.yml')).each do |item| | |
73 | 73 | fixtures File.basename(item).sub(/\.yml$/, '').to_s |
74 | 74 | end |
75 | 75 | end |
... | ... | @@ -160,7 +160,7 @@ class ActiveSupport::TestCase |
160 | 160 | patch ? patch[1] : nil |
161 | 161 | end.compact |
162 | 162 | s.each do |css_ref| |
163 | - if ! File.exists?( RAILS_ROOT.to_s() +'/public/'+ css_ref ) | |
163 | + if ! File.exists?( Rails.root.to_s() +'/public/'+ css_ref ) | |
164 | 164 | flunk 'CSS reference missed on HTML: "%s"' % css_ref |
165 | 165 | end |
166 | 166 | end |
... | ... | @@ -169,7 +169,7 @@ class ActiveSupport::TestCase |
169 | 169 | # Test image references: |
170 | 170 | (doc/'img').each do |img| |
171 | 171 | src = img.get_attribute( 'src' ).gsub(/\?[0-9]+$/, '') |
172 | - if ! File.exists?( RAILS_ROOT.to_s() +'/public/'+ src ) | |
172 | + if ! File.exists?( Rails.root.to_s() +'/public/'+ src ) | |
173 | 173 | flunk 'Image reference missed on HTML: "%s"' % src |
174 | 174 | end |
175 | 175 | end | ... | ... |
test/unit/application_helper_test.rb
... | ... | @@ -54,10 +54,10 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
54 | 54 | end |
55 | 55 | |
56 | 56 | should 'look for superclasses on view_for_profile actions' do |
57 | - File.expects(:exists?).with("#{RAILS_ROOT}/app/views/blocks/profile_info_actions/float.rhtml").returns(false) | |
58 | - File.expects(:exists?).with("#{RAILS_ROOT}/app/views/blocks/profile_info_actions/float.html.erb").returns(false) | |
59 | - File.expects(:exists?).with("#{RAILS_ROOT}/app/views/blocks/profile_info_actions/numeric.rhtml").returns(false) | |
60 | - File.expects(:exists?).with("#{RAILS_ROOT}/app/views/blocks/profile_info_actions/numeric.html.erb").returns(true) | |
57 | + File.expects(:exists?).with("#{Rails.root}/app/views/blocks/profile_info_actions/float.rhtml").returns(false) | |
58 | + File.expects(:exists?).with("#{Rails.root}/app/views/blocks/profile_info_actions/float.html.erb").returns(false) | |
59 | + File.expects(:exists?).with("#{Rails.root}/app/views/blocks/profile_info_actions/numeric.rhtml").returns(false) | |
60 | + File.expects(:exists?).with("#{Rails.root}/app/views/blocks/profile_info_actions/numeric.html.erb").returns(true) | |
61 | 61 | |
62 | 62 | assert_equal 'blocks/profile_info_actions/numeric.html.erb', view_for_profile_actions(Float) |
63 | 63 | end |
... | ... | @@ -69,13 +69,13 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
69 | 69 | end |
70 | 70 | |
71 | 71 | should 'generate link to stylesheet' do |
72 | - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', 'stylesheets', 'something.css')).returns(true) | |
72 | + File.expects(:exists?).with(File.join(Rails.root, 'public', 'stylesheets', 'something.css')).returns(true) | |
73 | 73 | expects(:filename_for_stylesheet).with('something', nil).returns('/stylesheets/something.css') |
74 | 74 | assert_match '@import url(/stylesheets/something.css)', stylesheet_import('something') |
75 | 75 | end |
76 | 76 | |
77 | 77 | should 'not generate link to unexisting stylesheet' do |
78 | - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', 'stylesheets', 'something.css')).returns(false) | |
78 | + File.expects(:exists?).with(File.join(Rails.root, 'public', 'stylesheets', 'something.css')).returns(false) | |
79 | 79 | expects(:filename_for_stylesheet).with('something', nil).returns('/stylesheets/something.css') |
80 | 80 | assert_no_match %r{@import url(/stylesheets/something.css)}, stylesheet_import('something') |
81 | 81 | end |
... | ... | @@ -174,7 +174,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
174 | 174 | |
175 | 175 | should 'render theme footer' do |
176 | 176 | stubs(:theme_path).returns('/user_themes/mytheme') |
177 | - footer_path = RAILS_ROOT + '/public/user_themes/mytheme/footer.rhtml' | |
177 | + footer_path = Rails.root + '/public/user_themes/mytheme/footer.rhtml' | |
178 | 178 | |
179 | 179 | File.expects(:exists?).with(footer_path).returns(true) |
180 | 180 | expects(:render).with(:file => footer_path, :use_full_path => false).returns("BLI") |
... | ... | @@ -184,8 +184,8 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
184 | 184 | |
185 | 185 | should 'ignore unexisting theme footer' do |
186 | 186 | stubs(:theme_path).returns('/user_themes/mytheme') |
187 | - footer_path = RAILS_ROOT + '/public/user_themes/mytheme/footer.rhtml' | |
188 | - alternate_footer_path = RAILS_ROOT + '/public/user_themes/mytheme/footer.html.erb' | |
187 | + footer_path = Rails.root + '/public/user_themes/mytheme/footer.rhtml' | |
188 | + alternate_footer_path = Rails.root + '/public/user_themes/mytheme/footer.html.erb' | |
189 | 189 | |
190 | 190 | File.expects(:exists?).with(footer_path).returns(false) |
191 | 191 | File.expects(:exists?).with(alternate_footer_path).returns(false) |
... | ... | @@ -196,7 +196,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
196 | 196 | |
197 | 197 | should 'render theme site title' do |
198 | 198 | stubs(:theme_path).returns('/user_themes/mytheme') |
199 | - site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.rhtml' | |
199 | + site_title_path = Rails.root + '/public/user_themes/mytheme/site_title.rhtml' | |
200 | 200 | |
201 | 201 | File.expects(:exists?).with(site_title_path).returns(true) |
202 | 202 | expects(:render).with(:file => site_title_path, :use_full_path => false).returns("Site title") |
... | ... | @@ -206,8 +206,8 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
206 | 206 | |
207 | 207 | should 'ignore unexisting theme site title' do |
208 | 208 | stubs(:theme_path).returns('/user_themes/mytheme') |
209 | - site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.rhtml' | |
210 | - alternate_site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.html.erb' | |
209 | + site_title_path = Rails.root + '/public/user_themes/mytheme/site_title.rhtml' | |
210 | + alternate_site_title_path = Rails.root + '/public/user_themes/mytheme/site_title.html.erb' | |
211 | 211 | |
212 | 212 | File.expects(:exists?).with(site_title_path).returns(false) |
213 | 213 | File.expects(:exists?).with(alternate_site_title_path).returns(false) |
... | ... | @@ -569,7 +569,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
569 | 569 | should 'use favicon from profile theme if the profile has theme' do |
570 | 570 | stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) |
571 | 571 | stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme')) |
572 | - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', '/designs/themes/profile-theme', 'favicon.ico')).returns(true) | |
572 | + File.expects(:exists?).with(File.join(Rails.root, 'public', '/designs/themes/profile-theme', 'favicon.ico')).returns(true) | |
573 | 573 | assert_equal '/designs/themes/profile-theme/favicon.ico', theme_favicon |
574 | 574 | end |
575 | 575 | |
... | ... | @@ -577,7 +577,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
577 | 577 | stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) |
578 | 578 | stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme')) |
579 | 579 | file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/favicon.ico', 'image/x-ico'), :profile => profile) |
580 | - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')).returns(false) | |
580 | + File.expects(:exists?).with(File.join(Rails.root, 'public', theme_path, 'favicon.ico')).returns(false) | |
581 | 581 | |
582 | 582 | assert_match /favicon.ico/, theme_favicon |
583 | 583 | end |
... | ... | @@ -585,7 +585,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
585 | 585 | should 'use favicon from environment if the profile theme and profile articles do not have' do |
586 | 586 | stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) |
587 | 587 | stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme')) |
588 | - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')).returns(false) | |
588 | + File.expects(:exists?).with(File.join(Rails.root, 'public', theme_path, 'favicon.ico')).returns(false) | |
589 | 589 | assert_equal '/designs/themes/new-theme/favicon.ico', theme_favicon |
590 | 590 | end |
591 | 591 | |
... | ... | @@ -595,7 +595,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
595 | 595 | stubs(:environment).returns(env) |
596 | 596 | |
597 | 597 | @controller = ApplicationController.new |
598 | - path = File.join(RAILS_ROOT, 'app', 'views') | |
598 | + path = File.join(Rails.root, 'app', 'views') | |
599 | 599 | @controller.stubs(:view_paths).returns([path]) |
600 | 600 | |
601 | 601 | file = path + '/shared/usermenu/xmpp_chat.rhtml' | ... | ... |
test/unit/colorbox_helper_test.rb
... | ... | @@ -5,8 +5,8 @@ class ColorboxHelperTest < ActiveSupport::TestCase |
5 | 5 | include ColorboxHelper |
6 | 6 | |
7 | 7 | should 'provide the needed files' do |
8 | - assert File.exists?(File.join(RAILS_ROOT, 'public', 'stylesheets', 'colorbox.css')), 'colorbox.css expected to be in public/stylesheets, but not found' | |
9 | - assert File.exists?(File.join(RAILS_ROOT, 'public', 'javascripts', 'colorbox.js')), 'colorbox.js expected to be in public/javascripts, but not found' | |
8 | + assert File.exists?(File.join(Rails.root, 'public', 'stylesheets', 'colorbox.css')), 'colorbox.css expected to be in public/stylesheets, but not found' | |
9 | + assert File.exists?(File.join(Rails.root, 'public', 'javascripts', 'colorbox.js')), 'colorbox.js expected to be in public/javascripts, but not found' | |
10 | 10 | end |
11 | 11 | |
12 | 12 | should 'provide link to close colorbox' do | ... | ... |
test/unit/doc_item_test.rb
... | ... | @@ -27,10 +27,10 @@ class DocItemTest < ActiveSupport::TestCase |
27 | 27 | |
28 | 28 | should 'translate images' do |
29 | 29 | doc = DocItem.new(:language => 'pt', :text => '<p>Look the image:</p><p><img src="/images/doc/myimage.en.png" alt="The image"/></p>') |
30 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.pt.png').returns(false) | |
30 | + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.pt.png').returns(false) | |
31 | 31 | assert_equal doc.text, doc.html |
32 | 32 | |
33 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.pt.png').returns(true) | |
33 | + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.pt.png').returns(true) | |
34 | 34 | assert_match(/<img src="\/images\/doc\/myimage.pt.png"/, doc.html) |
35 | 35 | end |
36 | 36 | |
... | ... | @@ -38,8 +38,8 @@ class DocItemTest < ActiveSupport::TestCase |
38 | 38 | doc = DocItem.new(:language => 'pt', :text => '<p>Look the image:</p><p><img src="/images/doc/myimage.en.png" alt="The image"/></p>') |
39 | 39 | |
40 | 40 | # the image exists in both the system *and* on the theme |
41 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.pt.png').returns(true) | |
42 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(true) | |
41 | + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.pt.png').returns(true) | |
42 | + File.stubs(:exist?).with(Rails.root + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(true) | |
43 | 43 | # the one in the theme must be used |
44 | 44 | assert_match(/<img src="\/designs\/themes\/mytheme\/images\/doc\/myimage.pt.png"/, doc.html('mytheme')) |
45 | 45 | end |
... | ... | @@ -48,9 +48,9 @@ class DocItemTest < ActiveSupport::TestCase |
48 | 48 | doc = DocItem.new(:language => 'pt', :text => '<p>Look the image:</p><p><img src="/images/doc/myimage.en.png" alt="The image"/></p>') |
49 | 49 | |
50 | 50 | # the image has a translation in the system but not in the theme |
51 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.pt.png').returns(true) | |
52 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/designs/themes/mytheme/images/doc/myimage.en.png').returns(false) | |
53 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(false) | |
51 | + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.pt.png').returns(true) | |
52 | + File.stubs(:exist?).with(Rails.root + '/public/designs/themes/mytheme/images/doc/myimage.en.png').returns(false) | |
53 | + File.stubs(:exist?).with(Rails.root + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(false) | |
54 | 54 | # the one in the theme must be used |
55 | 55 | assert_match(/<img src="\/images\/doc\/myimage.pt.png"/, doc.html('mytheme')) |
56 | 56 | end |
... | ... | @@ -59,10 +59,10 @@ class DocItemTest < ActiveSupport::TestCase |
59 | 59 | doc = DocItem.new(:language => 'pt', :text => '<p>Look the image:</p><p><img src="/images/doc/myimage.en.png" alt="The image"/></p>') |
60 | 60 | |
61 | 61 | # the image has no translation, but both system and theme provide an image |
62 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.en.png').returns(true) | |
63 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.pt.png').returns(false) | |
64 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/designs/themes/mytheme/images/doc/myimage.en.png').returns(true) | |
65 | - File.stubs(:exist?).with(RAILS_ROOT + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(false) | |
62 | + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.en.png').returns(true) | |
63 | + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.pt.png').returns(false) | |
64 | + File.stubs(:exist?).with(Rails.root + '/public/designs/themes/mytheme/images/doc/myimage.en.png').returns(true) | |
65 | + File.stubs(:exist?).with(Rails.root + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(false) | |
66 | 66 | # the one in the theme must be used |
67 | 67 | assert_match(/<img src="\/designs\/themes\/mytheme\/images\/doc\/myimage.en.png"/, doc.html('mytheme')) |
68 | 68 | end | ... | ... |
test/unit/doc_topic_test.rb
... | ... | @@ -6,7 +6,7 @@ class DocTopicTest < ActiveSupport::TestCase |
6 | 6 | end |
7 | 7 | |
8 | 8 | should 'load topic data from file' do |
9 | - doc = DocTopic.loadfile(RAILS_ROOT + '/' + 'test/fixtures/files/doctest.en.xhtml') | |
9 | + doc = DocTopic.loadfile(Rails.root + '/' + 'test/fixtures/files/doctest.en.xhtml') | |
10 | 10 | assert_equal 'en', doc.language |
11 | 11 | assert_equal 'Documentation test', doc.title |
12 | 12 | assert_match(/Documentation test/, doc.text) |
... | ... | @@ -14,7 +14,7 @@ class DocTopicTest < ActiveSupport::TestCase |
14 | 14 | end |
15 | 15 | |
16 | 16 | should 'load translated topic from file' do |
17 | - doc = DocTopic.loadfile(RAILS_ROOT + '/' + 'test/fixtures/files/doctest.pt.xhtml') | |
17 | + doc = DocTopic.loadfile(Rails.root + '/' + 'test/fixtures/files/doctest.pt.xhtml') | |
18 | 18 | assert_equal 'pt', doc.language |
19 | 19 | assert_equal 'Teste da documentação', doc.title |
20 | 20 | end | ... | ... |
test/unit/feed_handler_test.rb
... | ... | @@ -90,7 +90,7 @@ class FeedHandlerTest < ActiveSupport::TestCase |
90 | 90 | [:external_feed, :feed_reader_block].each do |container_class| |
91 | 91 | |
92 | 92 | should "reset the errors count after a successfull run (#{container_class})" do |
93 | - container = build(container_class, :update_errors => 1, :address => RAILS_ROOT + '/test/fixtures/files/feed.xml') | |
93 | + container = build(container_class, :update_errors => 1, :address => Rails.root + '/test/fixtures/files/feed.xml') | |
94 | 94 | handler.expects(:actually_process_container).with(container) |
95 | 95 | handler.process(container) |
96 | 96 | assert_equal 0, container.update_errors | ... | ... |
test/unit/folder_helper_test.rb
... | ... | @@ -127,7 +127,7 @@ class FolderHelperTest < ActiveSupport::TestCase |
127 | 127 | |
128 | 128 | private |
129 | 129 | def render(template, the_binding) |
130 | - ERB.new(File.read(RAILS_ROOT + '/app/views/' + template + '.rhtml')).result(the_binding) | |
130 | + ERB.new(File.read(Rails.root + '/app/views/' + template + '.rhtml')).result(the_binding) | |
131 | 131 | end |
132 | 132 | |
133 | 133 | end | ... | ... |
test/unit/image_test.rb
... | ... | @@ -84,7 +84,7 @@ class ImageTest < ActiveSupport::TestCase |
84 | 84 | |
85 | 85 | should 'have a loading image to each size of thumbnails' do |
86 | 86 | Image.attachment_options[:thumbnails].each do |suffix, size| |
87 | - image = RAILS_ROOT + '/public/images/icons-app/image-loading-%s.png' % suffix | |
87 | + image = Rails.root + '/public/images/icons-app/image-loading-%s.png' % suffix | |
88 | 88 | assert File.exists?(image) |
89 | 89 | end |
90 | 90 | end | ... | ... |
test/unit/layout_template_test.rb
... | ... | @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper' |
3 | 3 | class LayoutTemplateTest < ActiveSupport::TestCase |
4 | 4 | |
5 | 5 | should 'read configuration' do |
6 | - YAML.expects(:load_file).with(RAILS_ROOT + '/public/designs/templates/default/config.yml').returns({'number_of_boxes' => 3, 'description' => 'my description', 'title' => 'my title'}) | |
6 | + YAML.expects(:load_file).with(Rails.root + '/public/designs/templates/default/config.yml').returns({'number_of_boxes' => 3, 'description' => 'my description', 'title' => 'my title'}) | |
7 | 7 | t = LayoutTemplate.find('default') |
8 | 8 | assert_equal 3, t.number_of_boxes |
9 | 9 | assert_equal 'my description', t.description |
... | ... | @@ -11,9 +11,9 @@ class LayoutTemplateTest < ActiveSupport::TestCase |
11 | 11 | end |
12 | 12 | |
13 | 13 | should 'list all' do |
14 | - Dir.expects(:glob).with(RAILS_ROOT + '/public/designs/templates/*').returns([RAILS_ROOT + '/public/designs/templates/one', RAILS_ROOT + '/public/designs/templates/two']) | |
15 | - YAML.expects(:load_file).with(RAILS_ROOT + '/public/designs/templates/one/config.yml').returns({}) | |
16 | - YAML.expects(:load_file).with(RAILS_ROOT + '/public/designs/templates/two/config.yml').returns({}) | |
14 | + Dir.expects(:glob).with(Rails.root + '/public/designs/templates/*').returns([Rails.root + '/public/designs/templates/one', Rails.root + '/public/designs/templates/two']) | |
15 | + YAML.expects(:load_file).with(Rails.root + '/public/designs/templates/one/config.yml').returns({}) | |
16 | + YAML.expects(:load_file).with(Rails.root + '/public/designs/templates/two/config.yml').returns({}) | |
17 | 17 | |
18 | 18 | all = LayoutTemplate.all |
19 | 19 | assert_equivalent [ 'one', 'two' ], all.map(&:id) | ... | ... |
test/unit/lightbox_helper_test.rb
... | ... | @@ -9,8 +9,8 @@ class LightboxHelperTest < ActiveSupport::TestCase |
9 | 9 | end |
10 | 10 | |
11 | 11 | should 'provide the needed files' do |
12 | - assert File.exists?(File.join(RAILS_ROOT, 'public', 'stylesheets', 'lightbox.css')), 'lightbox.css expected to be in public/stylesheets, but not found' | |
13 | - assert File.exists?(File.join(RAILS_ROOT, 'public', 'javascripts', 'lightbox.js')), 'lightbox.js expected to be in public/javascripts, but not found' | |
12 | + assert File.exists?(File.join(Rails.root, 'public', 'stylesheets', 'lightbox.css')), 'lightbox.css expected to be in public/stylesheets, but not found' | |
13 | + assert File.exists?(File.join(Rails.root, 'public', 'javascripts', 'lightbox.js')), 'lightbox.js expected to be in public/javascripts, but not found' | |
14 | 14 | end |
15 | 15 | |
16 | 16 | should 'provide lightbox_link_to helper' do | ... | ... |
test/unit/noosfero_test.rb
... | ... | @@ -4,12 +4,12 @@ require 'noosfero' |
4 | 4 | class NoosferoTest < ActiveSupport::TestCase |
5 | 5 | |
6 | 6 | def test_should_list_controllers_in_directory |
7 | - Dir.expects(:glob).with("#{RAILS_ROOT}/app/controllers/lala/*_controller.rb").returns(["app/controllers/lala/system_admin_controller.rb", "app/controllers/lala/environment_admin_controller.rb", "app/controllers/lala/public_controller.rb", "app/controllers/lala/profile_admin_controller.rb"]).once | |
7 | + Dir.expects(:glob).with("#{Rails.root}/app/controllers/lala/*_controller.rb").returns(["app/controllers/lala/system_admin_controller.rb", "app/controllers/lala/environment_admin_controller.rb", "app/controllers/lala/public_controller.rb", "app/controllers/lala/profile_admin_controller.rb"]).once | |
8 | 8 | assert_equal ["system_admin", "environment_admin", "public", "profile_admin"], Noosfero.controllers_in_directory('lala') |
9 | 9 | end |
10 | 10 | |
11 | 11 | def test_should_generate_pattern_for_controllers_in_directory |
12 | - Dir.expects(:glob).with("#{RAILS_ROOT}/app/controllers/lala/*_controller.rb").returns(["app/controllers/lala/system_admin_controller.rb", "app/controllers/lala/environment_admin_controller.rb", "app/controllers/lala/public_controller.rb", "app/controllers/lala/profile_admin_controller.rb"]).once | |
12 | + Dir.expects(:glob).with("#{Rails.root}/app/controllers/lala/*_controller.rb").returns(["app/controllers/lala/system_admin_controller.rb", "app/controllers/lala/environment_admin_controller.rb", "app/controllers/lala/public_controller.rb", "app/controllers/lala/profile_admin_controller.rb"]).once | |
13 | 13 | assert_equal(/(system_admin|environment_admin|public|profile_admin)/, Noosfero.pattern_for_controllers_in_directory('lala')) |
14 | 14 | end |
15 | 15 | ... | ... |
test/unit/profile_test.rb
... | ... | @@ -1142,7 +1142,7 @@ class ProfileTest < ActiveSupport::TestCase |
1142 | 1142 | assert_equal 'default title', p.boxes[0].blocks.first[:title] |
1143 | 1143 | end |
1144 | 1144 | |
1145 | - TMP_THEMES_DIR = RAILS_ROOT + '/test/tmp/profile_themes' | |
1145 | + TMP_THEMES_DIR = Rails.root + '/test/tmp/profile_themes' | |
1146 | 1146 | should 'have themes' do |
1147 | 1147 | Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR) |
1148 | 1148 | ... | ... |
test/unit/theme_test.rb
... | ... | @@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../test_helper' |
2 | 2 | |
3 | 3 | class ThemeTest < ActiveSupport::TestCase |
4 | 4 | |
5 | - TMP_THEMES_DIR = RAILS_ROOT + '/test/tmp/themes' | |
5 | + TMP_THEMES_DIR = Rails.root + '/test/tmp/themes' | |
6 | 6 | |
7 | 7 | def setup |
8 | 8 | Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR) |
... | ... | @@ -13,11 +13,11 @@ class ThemeTest < ActiveSupport::TestCase |
13 | 13 | end |
14 | 14 | |
15 | 15 | should 'list system themes' do |
16 | - Dir.expects(:glob).with(RAILS_ROOT + '/public/designs/themes/*').returns( | |
16 | + Dir.expects(:glob).with(Rails.root + '/public/designs/themes/*').returns( | |
17 | 17 | [ |
18 | - RAILS_ROOT + '/public/designs/themes/themeone', | |
19 | - RAILS_ROOT + '/public/designs/themes/themetwo', | |
20 | - RAILS_ROOT + '/public/designs/themes/themethree' | |
18 | + Rails.root + '/public/designs/themes/themeone', | |
19 | + Rails.root + '/public/designs/themes/themetwo', | |
20 | + Rails.root + '/public/designs/themes/themethree' | |
21 | 21 | ]) |
22 | 22 | |
23 | 23 | assert_equal ['themeone', 'themetwo', 'themethree'], Theme.system_themes.map(&:id) | ... | ... |
test/unit/uploaded_file_test.rb
... | ... | @@ -223,7 +223,7 @@ class UploadedFileTest < ActiveSupport::TestCase |
223 | 223 | |
224 | 224 | should 'have a loading image to each size of thumbnails' do |
225 | 225 | UploadedFile.attachment_options[:thumbnails].each do |suffix, size| |
226 | - image = RAILS_ROOT + '/public/images/icons-app/image-loading-%s.png' % suffix | |
226 | + image = Rails.root + '/public/images/icons-app/image-loading-%s.png' % suffix | |
227 | 227 | assert File.exists?(image) |
228 | 228 | end |
229 | 229 | end |
... | ... | @@ -231,10 +231,10 @@ class UploadedFileTest < ActiveSupport::TestCase |
231 | 231 | should 'return a thumbnail for images' do |
232 | 232 | f = UploadedFile.new |
233 | 233 | f.expects(:image?).returns(true) |
234 | - f.expects(:full_filename).with(:display).returns(File.join(RAILS_ROOT, 'public', 'images', '0000', '0005', 'x.png')) | |
234 | + f.expects(:full_filename).with(:display).returns(File.join(Rails.root, 'public', 'images', '0000', '0005', 'x.png')) | |
235 | 235 | assert_equal '/images/0000/0005/x.png', f.thumbnail_path |
236 | 236 | f = UploadedFile.new |
237 | - f.stubs(:full_filename).with(:display).returns(File.join(RAILS_ROOT, 'public', 'images', '0000', '0005', 'x.png')) | |
237 | + f.stubs(:full_filename).with(:display).returns(File.join(Rails.root, 'public', 'images', '0000', '0005', 'x.png')) | |
238 | 238 | f.expects(:image?).returns(false) |
239 | 239 | assert_nil f.thumbnail_path |
240 | 240 | end | ... | ... |
vendor/ezcrypto-0.7.2/test/test_helper.rb
... | ... | @@ -8,13 +8,13 @@ require 'active_record' |
8 | 8 | #require 'active_support/breakpoint' |
9 | 9 | |
10 | 10 | |
11 | -unless defined?(RAILS_ROOT) | |
11 | +unless defined?(Rails.root) | |
12 | 12 | root_path = File.join(File.dirname(__FILE__), '..') |
13 | 13 | unless RUBY_PLATFORM =~ /mswin32/ |
14 | 14 | require 'pathname' |
15 | 15 | root_path = Pathname.new(root_path).cleanpath.to_s |
16 | 16 | end |
17 | - RAILS_ROOT = root_path | |
17 | + Rails.root = root_path | |
18 | 18 | end |
19 | 19 | |
20 | 20 | ... | ... |
vendor/plugins/access_control/lib/permission_check.rb
... | ... | @@ -34,9 +34,9 @@ module PermissionCheck |
34 | 34 | end |
35 | 35 | |
36 | 36 | def access_denied_template_path |
37 | - if File.exists?(File.join(RAILS_ROOT, 'app', 'views', 'access_control', 'access_denied.rhtml')) | |
38 | - File.join(RAILS_ROOT, 'app', 'views', 'access_control', 'access_denied.rhtml') | |
39 | - elsif File.exists?(File.join(RAILS_ROOT, 'app','views', 'shared', 'access_denied.rhtml')) | |
37 | + if File.exists?(File.join(Rails.root, 'app', 'views', 'access_control', 'access_denied.rhtml')) | |
38 | + File.join(Rails.root, 'app', 'views', 'access_control', 'access_denied.rhtml') | |
39 | + elsif File.exists?(File.join(Rails.root, 'app','views', 'shared', 'access_denied.rhtml')) | |
40 | 40 | File.join('shared', 'access_denied.rhtml') |
41 | 41 | else |
42 | 42 | File.join(File.dirname(__FILE__), '..', 'views', 'access_denied.rhtml') | ... | ... |
vendor/plugins/access_control/test/permission_check_test.rb
... | ... | @@ -28,8 +28,8 @@ class PermissionCheckTest < Test::Unit::TestCase |
28 | 28 | end |
29 | 29 | |
30 | 30 | def test_try_render_shared_access_denied_view |
31 | - File.expects(:exists?).with(File.join(RAILS_ROOT, 'app', 'views', 'access_control', 'access_denied.rhtml')) | |
32 | - File.expects(:exists?).with(File.join(RAILS_ROOT, 'app', 'views', 'shared', 'access_denied.rhtml')) | |
31 | + File.expects(:exists?).with(File.join(Rails.root, 'app', 'views', 'access_control', 'access_denied.rhtml')) | |
32 | + File.expects(:exists?).with(File.join(Rails.root, 'app', 'views', 'shared', 'access_denied.rhtml')) | |
33 | 33 | AccessControlTestController.access_denied_template_path |
34 | 34 | end |
35 | 35 | ... | ... |
vendor/plugins/action_tracker/test/test_helper.rb
1 | -ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..' | |
2 | -require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb')) | |
1 | +ENV['Rails.root'] ||= File.dirname(__FILE__) + '/../../../..' | |
2 | +require File.expand_path(File.join(ENV['Rails.root'], 'config/environment.rb')) | |
3 | 3 | |
4 | 4 | ENV["RAILS_ENV"] = "test" |
5 | 5 | require 'test_help' | ... | ... |
vendor/plugins/acts_as_solr_reloaded/config/solr_environment.rb
... | ... | @@ -7,21 +7,21 @@ require 'net/http' |
7 | 7 | dir = File.dirname(__FILE__) |
8 | 8 | SOLR_PATH = File.expand_path("#{dir}/../solr") unless defined? SOLR_PATH |
9 | 9 | |
10 | -unless defined? RAILS_ROOT | |
11 | - # define RAILS_ROOT for test environment | |
12 | - RAILS_ROOT = defined?(Rails) ? Rails.root : File.expand_path("#{File.dirname(__FILE__)}/../test") | |
10 | +unless defined? Rails.root | |
11 | + # define Rails.root for test environment | |
12 | + Rails.root = defined?(Rails) ? Rails.root : File.expand_path("#{File.dirname(__FILE__)}/../test") | |
13 | 13 | end |
14 | 14 | unless defined? RAILS_ENV |
15 | 15 | RAILS_ENV = ENV['RAILS_ENV'] |
16 | 16 | end |
17 | 17 | unless defined? SOLR_LOGS_PATH |
18 | - SOLR_LOGS_PATH = ENV["SOLR_LOGS_PATH"] || "#{RAILS_ROOT}/log" | |
18 | + SOLR_LOGS_PATH = ENV["SOLR_LOGS_PATH"] || "#{Rails.root}/log" | |
19 | 19 | end |
20 | 20 | unless defined? SOLR_PIDS_PATH |
21 | - SOLR_PIDS_PATH = ENV["SOLR_PIDS_PATH"] || "#{RAILS_ROOT}/tmp/pids" | |
21 | + SOLR_PIDS_PATH = ENV["SOLR_PIDS_PATH"] || "#{Rails.root}/tmp/pids" | |
22 | 22 | end |
23 | 23 | unless defined? SOLR_DATA_PATH |
24 | - SOLR_DATA_PATH = ENV["SOLR_DATA_PATH"] || "#{RAILS_ROOT}/solr/#{ENV['RAILS_ENV']}" | |
24 | + SOLR_DATA_PATH = ENV["SOLR_DATA_PATH"] || "#{Rails.root}/solr/#{ENV['RAILS_ENV']}" | |
25 | 25 | end |
26 | 26 | unless defined? SOLR_CONFIG_PATH |
27 | 27 | SOLR_CONFIG_PATH = ENV["SOLR_CONFIG_PATH"] || "#{SOLR_PATH}/solr" |
... | ... | @@ -31,7 +31,7 @@ unless defined? SOLR_PID_FILE |
31 | 31 | end |
32 | 32 | |
33 | 33 | unless defined? SOLR_PORT |
34 | - config = YAML::load_file(RAILS_ROOT+'/config/solr.yml') | |
34 | + config = YAML::load_file(Rails.root+'/config/solr.yml') | |
35 | 35 | raise("No solr environment defined for RAILS_ENV = #{ENV['RAILS_ENV'].inspect}") unless config[ENV['RAILS_ENV']] |
36 | 36 | |
37 | 37 | SOLR_HOST = ENV['HOST'] || URI.parse(config[ENV['RAILS_ENV']]['url']).host | ... | ... |
vendor/plugins/acts_as_solr_reloaded/lib/tasks/database.rake
... | ... | @@ -5,7 +5,7 @@ namespace :db do |
5 | 5 | begin |
6 | 6 | ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => "*:*")) |
7 | 7 | ActsAsSolr::Post.execute(Solr::Request::Commit.new) |
8 | - (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.{yml,csv}'))).each do |fixture_file| | |
8 | + (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(Rails.root, 'test', 'fixtures', '*.{yml,csv}'))).each do |fixture_file| | |
9 | 9 | ActsAsSolr::SolrFixtures.load(File.basename(fixture_file, '.*')) |
10 | 10 | end |
11 | 11 | puts "The fixtures loaded have been added to Solr" | ... | ... |
vendor/plugins/acts_as_solr_reloaded/lib/tasks/solr.rake
... | ... | @@ -158,7 +158,7 @@ namespace :solr do |
158 | 158 | |
159 | 159 | logger = ActiveRecord::Base.logger = Logger.new(STDOUT) |
160 | 160 | logger.level = ActiveSupport::BufferedLogger::INFO unless debug_output |
161 | - Dir["#{RAILS_ROOT}/app/models/*.rb"].each{ |file| require file } | |
161 | + Dir["#{Rails.root}/app/models/*.rb"].each{ |file| require file } | |
162 | 162 | |
163 | 163 | if start_server |
164 | 164 | puts "Starting Solr server..." | ... | ... |
vendor/plugins/acts_as_solr_reloaded/solr_test_rakefile.rb
vendor/plugins/acts_as_solr_reloaded/test/test_helper.rb
... | ... | @@ -16,7 +16,7 @@ require 'mongo_mapper' |
16 | 16 | |
17 | 17 | class Rails |
18 | 18 | def self.root |
19 | - RAILS_ROOT | |
19 | + Rails.root | |
20 | 20 | end |
21 | 21 | |
22 | 22 | def self.env |
... | ... | @@ -26,7 +26,7 @@ end |
26 | 26 | |
27 | 27 | MongoMapper.database = "acts_as_solr_reloaded-test" |
28 | 28 | |
29 | -RAILS_ROOT = File.dirname(__FILE__) unless defined? RAILS_ROOT | |
29 | +Rails.root = File.dirname(__FILE__) unless defined? Rails.root | |
30 | 30 | RAILS_ENV = 'test' unless defined? RAILS_ENV |
31 | 31 | ENV["RAILS_ENV"] = "test" |
32 | 32 | ... | ... |
vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb
1 | 1 | module Technoweenie # :nodoc: |
2 | 2 | module AttachmentFu # :nodoc: |
3 | 3 | @@default_processors = %w(ImageScience Rmagick MiniMagick Gd2 CoreImage) |
4 | - @@tempfile_path = File.join(RAILS_ROOT, 'tmp', 'attachment_fu') | |
4 | + @@tempfile_path = File.join(Rails.root, 'tmp', 'attachment_fu') | |
5 | 5 | @@content_types = ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg'] |
6 | 6 | mattr_reader :content_types, :tempfile_path, :default_processors |
7 | 7 | mattr_writer :tempfile_path | ... | ... |
vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb
... | ... | @@ -12,18 +12,18 @@ module Technoweenie # :nodoc: |
12 | 12 | # |
13 | 13 | # # This assumes a model name like MyModel |
14 | 14 | # # public/#{table_name} is the default filesystem path |
15 | - # RAILS_ROOT/public/my_models/5/blah.jpg | |
15 | + # Rails.root/public/my_models/5/blah.jpg | |
16 | 16 | # |
17 | 17 | # Overwrite this method in your model to customize the filename. |
18 | 18 | # The optional thumbnail argument will output the thumbnail's filename. |
19 | 19 | def full_filename(thumbnail = nil) |
20 | 20 | file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix].to_s |
21 | - File.join(RAILS_ROOT, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail))) | |
21 | + File.join(Rails.root, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail))) | |
22 | 22 | end |
23 | 23 | |
24 | 24 | # Used as the base path that #public_filename strips off full_filename to create the public path |
25 | 25 | def base_path |
26 | - @base_path ||= File.join(RAILS_ROOT, 'public') | |
26 | + @base_path ||= File.join(Rails.root, 'public') | |
27 | 27 | end |
28 | 28 | |
29 | 29 | # The attachment ID used in the full path of a file | ... | ... |
vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb
... | ... | @@ -12,12 +12,12 @@ module Technoweenie # :nodoc: |
12 | 12 | # |
13 | 13 | # == Configuration |
14 | 14 | # |
15 | - # Configuration is done via <tt>RAILS_ROOT/config/amazon_s3.yml</tt> and is loaded according to the <tt>RAILS_ENV</tt>. | |
15 | + # Configuration is done via <tt>Rails.root/config/amazon_s3.yml</tt> and is loaded according to the <tt>RAILS_ENV</tt>. | |
16 | 16 | # The minimum connection options that you must specify are a bucket name, your access key id and your secret access key. |
17 | 17 | # If you don't already have your access keys, all you need to sign up for the S3 service is an account at Amazon. |
18 | 18 | # You can sign up for S3 and get access keys by visiting http://aws.amazon.com/s3. |
19 | 19 | # |
20 | - # Example configuration (RAILS_ROOT/config/amazon_s3.yml) | |
20 | + # Example configuration (Rails.root/config/amazon_s3.yml) | |
21 | 21 | # |
22 | 22 | # development: |
23 | 23 | # bucket_name: appname_development |
... | ... | @@ -36,7 +36,7 @@ module Technoweenie # :nodoc: |
36 | 36 | # |
37 | 37 | # You can change the location of the config path by passing a full path to the :s3_config_path option. |
38 | 38 | # |
39 | - # has_attachment :storage => :s3, :s3_config_path => (RAILS_ROOT + '/config/s3.yml') | |
39 | + # has_attachment :storage => :s3, :s3_config_path => (Rails.root + '/config/s3.yml') | |
40 | 40 | # |
41 | 41 | # === Required configuration parameters |
42 | 42 | # |
... | ... | @@ -132,7 +132,7 @@ module Technoweenie # :nodoc: |
132 | 132 | end |
133 | 133 | |
134 | 134 | begin |
135 | - @@s3_config_path = base.attachment_options[:s3_config_path] || (RAILS_ROOT + '/config/amazon_s3.yml') | |
135 | + @@s3_config_path = base.attachment_options[:s3_config_path] || (Rails.root + '/config/amazon_s3.yml') | |
136 | 136 | @@s3_config = @@s3_config = YAML.load(ERB.new(File.read(@@s3_config_path)).result)[RAILS_ENV].symbolize_keys |
137 | 137 | #rescue |
138 | 138 | # raise ConfigFileNotFoundError.new('File %s not found' % @@s3_config_path) |
... | ... | @@ -203,7 +203,7 @@ module Technoweenie # :nodoc: |
203 | 203 | # |
204 | 204 | # The resulting url is in the form: <tt>http(s)://:server/:bucket_name/:table_name/:id/:file</tt> where |
205 | 205 | # the <tt>:server</tt> variable defaults to <tt>AWS::S3 URL::DEFAULT_HOST</tt> (s3.amazonaws.com) and can be |
206 | - # set using the configuration parameters in <tt>RAILS_ROOT/config/amazon_s3.yml</tt>. | |
206 | + # set using the configuration parameters in <tt>Rails.root/config/amazon_s3.yml</tt>. | |
207 | 207 | # |
208 | 208 | # The optional thumbnail argument will output the thumbnail's filename (if any). |
209 | 209 | def s3_url(thumbnail = nil) | ... | ... |
vendor/plugins/attachment_fu/test/test_helper.rb
1 | 1 | $:.unshift(File.dirname(__FILE__) + '/../lib') |
2 | 2 | |
3 | 3 | ENV['RAILS_ENV'] = 'test' |
4 | -ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..' | |
4 | +ENV['Rails.root'] ||= File.dirname(__FILE__) + '/../../../..' | |
5 | 5 | |
6 | 6 | require 'test/unit' |
7 | -require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb')) | |
7 | +require File.expand_path(File.join(ENV['Rails.root'], 'config/environment.rb')) | |
8 | 8 | require 'active_record/fixtures' |
9 | 9 | require 'action_controller/test_process' |
10 | 10 | ... | ... |
vendor/plugins/nested_has_many_through/spec/spec_helper.rb
... | ... | @@ -7,7 +7,7 @@ require 'spec/rails' |
7 | 7 | Spec::Runner.configure do |config| |
8 | 8 | config.use_transactional_fixtures = true |
9 | 9 | config.use_instantiated_fixtures = false |
10 | - config.fixture_path = RAILS_ROOT + '/spec/fixtures' | |
10 | + config.fixture_path = Rails.root + '/spec/fixtures' | |
11 | 11 | |
12 | 12 | # You can declare fixtures for each behaviour like this: |
13 | 13 | # describe "...." do | ... | ... |