From 639cfbc251ac93b1b464c1220a884f2362906ec0 Mon Sep 17 00:00:00 2001 From: Rafael Reggiani Manzo Date: Tue, 6 Nov 2012 16:22:11 -0200 Subject: [PATCH] Replaced all occurences of RAILS_ROOT to Rails.root --- app/controllers/public/chat_controller.rb | 2 +- app/helpers/application_helper.rb | 16 ++++++++-------- app/models/doc_item.rb | 2 +- app/models/doc_section.rb | 2 +- app/models/layout_template.rb | 4 ++-- app/models/theme.rb | 4 ++-- app/models/uploaded_file.rb | 2 +- config/environment.rb | 8 ++++---- config/initializers/01_load_config.rb | 2 +- config/initializers/default_icon_theme.rb | 4 ++-- config/initializers/default_theme.rb | 2 +- features/support/fixtures.rb | 2 +- features/support/selenium.rb | 2 +- lib/noosfero.rb | 2 +- lib/noosfero/multi_tenancy.rb | 4 ++-- lib/noosfero/plugin.rb | 4 ++-- lib/postgresql_attachment_fu.rb | 2 +- lib/tasks/cucumber.rake | 4 ++-- lib/tasks/doc.rake | 6 +++--- lib/tasks/error_messages.rake | 2 +- lib/tasks/multitenancy.rake | 4 ++-- lib/tasks/po.rake | 2 +- lib/tasks/test_rcov.rake | 4 ++-- plugins/mezuro/lib/kalibro/model.rb | 2 +- plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb | 4 ++-- plugins/mezuro/test/features/echo_port_test.rb | 10 +++++----- plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb | 12 ++++++------ plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb | 8 ++++---- plugins/mezuro/test/unit/kalibro/base_tool_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/compound_metric_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/configuration_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/error_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb | 4 ++-- plugins/mezuro/test/unit/kalibro/metric_result_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/module_node_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/module_result_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/module_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/native_metric_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/project_result_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/project_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/range_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/repository_test.rb | 2 +- plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb | 2 +- plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb | 2 +- plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb | 2 +- plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb | 8 ++++---- public/dispatch.cgi | 2 +- public/dispatch.fcgi | 2 +- public/dispatch.rb | 2 +- script/reset_db | 8 ++++---- test/factories.rb | 4 ++-- test/functional/themes_controller_test.rb | 4 ++-- test/integration/controller_naming_test.rb | 2 +- test/integration/tiny_mce_languages_test.rb | 2 +- test/test_helper.rb | 8 ++++---- test/unit/application_helper_test.rb | 32 ++++++++++++++++---------------- test/unit/colorbox_helper_test.rb | 4 ++-- test/unit/doc_item_test.rb | 22 +++++++++++----------- test/unit/doc_topic_test.rb | 4 ++-- test/unit/feed_handler_test.rb | 2 +- test/unit/folder_helper_test.rb | 2 +- test/unit/image_test.rb | 2 +- test/unit/layout_template_test.rb | 8 ++++---- test/unit/lightbox_helper_test.rb | 4 ++-- test/unit/noosfero_test.rb | 4 ++-- test/unit/profile_test.rb | 2 +- test/unit/theme_test.rb | 10 +++++----- test/unit/uploaded_file_test.rb | 6 +++--- vendor/ezcrypto-0.7.2/test/test_helper.rb | 4 ++-- vendor/plugins/access_control/lib/permission_check.rb | 6 +++--- vendor/plugins/access_control/test/permission_check_test.rb | 4 ++-- vendor/plugins/action_tracker/test/test_helper.rb | 4 ++-- vendor/plugins/acts_as_solr_reloaded/config/solr_environment.rb | 14 +++++++------- vendor/plugins/acts_as_solr_reloaded/lib/tasks/database.rake | 2 +- vendor/plugins/acts_as_solr_reloaded/lib/tasks/solr.rake | 2 +- vendor/plugins/acts_as_solr_reloaded/solr_test_rakefile.rb | 2 +- vendor/plugins/acts_as_solr_reloaded/test/test_helper.rb | 4 ++-- vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb | 2 +- vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb | 6 +++--- vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb | 10 +++++----- vendor/plugins/attachment_fu/test/test_helper.rb | 4 ++-- vendor/plugins/nested_has_many_through/spec/spec_helper.rb | 2 +- 83 files changed, 185 insertions(+), 185 deletions(-) diff --git a/app/controllers/public/chat_controller.rb b/app/controllers/public/chat_controller.rb index 84dac08..235b3bd 100644 --- a/app/controllers/public/chat_controller.rb +++ b/app/controllers/public/chat_controller.rb @@ -19,7 +19,7 @@ class ChatController < PublicController def avatar profile = environment.profiles.find_by_identifier(params[:id]) filename, mimetype = profile_icon(profile, :minor, true) - data = File.read(File.join(RAILS_ROOT, 'public', filename)) + data = File.read(File.join(Rails.root, 'public', filename)) render :text => data, :layout => false, :content_type => mimetype expires_in 24.hours end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8b9ba01..b643974 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -301,7 +301,7 @@ module ApplicationHelper name = klass.name.underscore VIEW_EXTENSIONS.each do |ext| - return "blocks/profile_info_actions/"+name+ext if File.exists?(File.join(RAILS_ROOT, 'app', 'views', 'blocks', 'profile_info_actions', name+ext)) + return "blocks/profile_info_actions/"+name+ext if File.exists?(File.join(Rails.root, 'app', 'views', 'blocks', 'profile_info_actions', name+ext)) end view_for_profile_actions(klass.superclass) @@ -320,7 +320,7 @@ module ApplicationHelper "\n" + sources.flatten.map do |source| filename = filename_for_stylesheet(source.to_s, themed_source) - if File.exists?(File.join(RAILS_ROOT, 'public', filename)) + if File.exists?(File.join(Rails.root, 'public', filename)) "@import url(#{filename});\n" else "/* Not included: url(#{filename}) */\n" @@ -392,7 +392,7 @@ module ApplicationHelper def theme_include(template) ['.rhtml', '.html.erb'].each do |ext| - file = (RAILS_ROOT + '/public' + theme_path + '/' + template + ext) + file = (Rails.root + '/public' + theme_path + '/' + template + ext) if File.exists?(file) return render :file => file, :use_full_path => false end @@ -402,7 +402,7 @@ module ApplicationHelper def theme_favicon return '/designs/themes/' + current_theme + '/favicon.ico' if profile.nil? || profile.theme.nil? - if File.exists?(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')) + if File.exists?(File.join(Rails.root, 'public', theme_path, 'favicon.ico')) '/designs/themes/' + profile.theme + '/favicon.ico' else favicon = profile.articles.find_by_path('favicon.ico') @@ -498,7 +498,7 @@ module ApplicationHelper compact.uniq.map{ |c| cat_name = c.gsub( /[-_\s,.;'"]+/, '_' ) cat_icon = "/images/icons-cat/#{cat_name}.png" - if ! File.exists? RAILS_ROOT.to_s() + '/public/' + cat_icon + if ! File.exists? Rails.root.to_s() + '/public/' + cat_icon cat_icon = '/images/icons-cat/undefined.png' end content_tag 'span', @@ -654,7 +654,7 @@ module ApplicationHelper end def theme_option(opt = nil) - conf = RAILS_ROOT.to_s() + + conf = Rails.root.to_s() + '/public' + theme_path + '/theme.yml' if File.exists?(conf) @@ -693,7 +693,7 @@ module ApplicationHelper option.each do |file| file = theme_path + '/javascript/'+ file +'.js' - if File.exists? RAILS_ROOT.to_s() +'/public'+ file + if File.exists? Rails.root.to_s() +'/public'+ file html << javascript_src_tag( file, {} ) else html << '' @@ -924,7 +924,7 @@ module ApplicationHelper theme_icon_themes = theme_option(:icon_theme) || [] for icon_theme in theme_icon_themes do theme_path = "/designs/icons/#{icon_theme}/style.css" - if File.exists?(File.join(RAILS_ROOT, 'public', theme_path)) + if File.exists?(File.join(Rails.root, 'public', theme_path)) icon_themes << theme_path end end diff --git a/app/models/doc_item.rb b/app/models/doc_item.rb index 8c2124d..e27b5d2 100644 --- a/app/models/doc_item.rb +++ b/app/models/doc_item.rb @@ -31,7 +31,7 @@ class DocItem search_path.unshift("/designs/themes/#{theme}#{translation}") # higher priority search_path.push("/designs/themes/#{theme}#{image}") # lower priority end - search_path.find {|file| File.exist?("#{RAILS_ROOT}/public#{file}") } + search_path.find {|file| File.exist?("#{Rails.root}/public#{file}") } end end diff --git a/app/models/doc_section.rb b/app/models/doc_section.rb index 2482e13..43493f4 100644 --- a/app/models/doc_section.rb +++ b/app/models/doc_section.rb @@ -1,7 +1,7 @@ class DocSection < DocItem def self.root_dir - @root_dir ||= File.join(RAILS_ROOT, 'doc', 'noosfero') + @root_dir ||= File.join(Rails.root, 'doc', 'noosfero') end def items diff --git a/app/models/layout_template.rb b/app/models/layout_template.rb index 991faf6..6246770 100644 --- a/app/models/layout_template.rb +++ b/app/models/layout_template.rb @@ -7,7 +7,7 @@ class LayoutTemplate end def self.all - Dir.glob(File.join(RAILS_ROOT, 'public', 'designs', 'templates', '*')).map {|item| find(File.basename(item)) } + Dir.glob(File.join(Rails.root, 'public', 'designs', 'templates', '*')).map {|item| find(File.basename(item)) } end attr_reader :id @@ -30,7 +30,7 @@ class LayoutTemplate protected def read_config - @config = YAML.load_file(File.join(RAILS_ROOT, 'public', 'designs', 'templates', id, 'config.yml')) + @config = YAML.load_file(File.join(Rails.root, 'public', 'designs', 'templates', id, 'config.yml')) end end diff --git a/app/models/theme.rb b/app/models/theme.rb index 5512bc5..3b33bff 100644 --- a/app/models/theme.rb +++ b/app/models/theme.rb @@ -10,11 +10,11 @@ class Theme end def user_themes_dir - File.join(RAILS_ROOT, 'public', 'user_themes') + File.join(Rails.root, 'public', 'user_themes') end def system_themes_dir - File.join(RAILS_ROOT, 'public', 'designs', 'themes') + File.join(Rails.root, 'public', 'designs', 'themes') end def create(id, attributes = {}) diff --git a/app/models/uploaded_file.rb b/app/models/uploaded_file.rb index caa30b6..6acb154 100644 --- a/app/models/uploaded_file.rb +++ b/app/models/uploaded_file.rb @@ -29,7 +29,7 @@ class UploadedFile < Article end def thumbnail_path - self.image? ? self.full_filename(:display).gsub(File.join(RAILS_ROOT, 'public'), '') : nil + self.image? ? self.full_filename(:display).gsub(File.join(Rails.root, 'public'), '') : nil end def display_title diff --git a/config/environment.rb b/config/environment.rb index d942811..d1e1b28 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -11,7 +11,7 @@ extra_controller_dirs = %w[ app/controllers/admin app/controllers/system app/controllers/public -].map {|item| File.join(RAILS_ROOT, item) } +].map {|item| File.join(Rails.root, item) } def noosfero_session_secret require 'fileutils' @@ -34,8 +34,8 @@ Rails::Initializer.run do |config| # config.frameworks -= [ :action_web_service, :action_mailer ] # Add additional load paths for your own custom dirs - # config.load_paths += %W( #{RAILS_ROOT}/extras ) - config.load_paths += %W( #{RAILS_ROOT}/app/sweepers ) + # config.load_paths += %W( #{Rails.root}/extras ) + config.load_paths += %W( #{Rails.root}/app/sweepers ) # Force all environments to use the same logger level # (by default production uses :info, the others :debug) @@ -120,7 +120,7 @@ require 'sqlite_extension' # load a local configuration if present, but not under test environment. if !['test', 'cucumber'].include?(ENV['RAILS_ENV']) - localconfigfile = File.join(RAILS_ROOT, 'config', 'local.rb') + localconfigfile = File.join(Rails.root, 'config', 'local.rb') if File.exists?(localconfigfile) require localconfigfile end diff --git a/config/initializers/01_load_config.rb b/config/initializers/01_load_config.rb index f1e5dd2..d43aad9 100644 --- a/config/initializers/01_load_config.rb +++ b/config/initializers/01_load_config.rb @@ -1,2 +1,2 @@ -file = "#{RAILS_ROOT}/config/noosfero.yml" +file = "#{Rails.root}/config/noosfero.yml" NOOSFERO_CONF = File.exists?(file) ? YAML.load_file(file)[RAILS_ENV] || {} : {} diff --git a/config/initializers/default_icon_theme.rb b/config/initializers/default_icon_theme.rb index f59cc27..1bfc372 100644 --- a/config/initializers/default_icon_theme.rb +++ b/config/initializers/default_icon_theme.rb @@ -1,12 +1,12 @@ if File.writable?(Rails.root) # create the symlink to the default theme if it does not exist - default = File.join(RAILS_ROOT, 'public', 'designs', 'icons', 'default') + default = File.join(Rails.root, 'public', 'designs', 'icons', 'default') if !File.exists?(default) File.symlink('tango', default) end # create a symlink to system-wide Tango icon set if it does not exist - tango_symlink = File.join(RAILS_ROOT, 'public', 'designs', 'icons', 'tango', 'Tango') + tango_symlink = File.join(Rails.root, 'public', 'designs', 'icons', 'tango', 'Tango') if !File.exist?(tango_symlink) File.symlink('/usr/share/icons/Tango', tango_symlink) end diff --git a/config/initializers/default_theme.rb b/config/initializers/default_theme.rb index b2bfae8..893c071 100644 --- a/config/initializers/default_theme.rb +++ b/config/initializers/default_theme.rb @@ -1,6 +1,6 @@ if File.writable?(Rails.root) # create the symlink to the default theme if it does not exist - default = File.join(RAILS_ROOT, 'public', 'designs', 'themes', 'default') + default = File.join(Rails.root, 'public', 'designs', 'themes', 'default') if !File.exists?(default) File.symlink('noosfero', default) end diff --git a/features/support/fixtures.rb b/features/support/fixtures.rb index 60ef4c9..84d7afa 100644 --- a/features/support/fixtures.rb +++ b/features/support/fixtures.rb @@ -1,6 +1,6 @@ # set the very basic fixtures for Noosfero Fixtures.reset_cache -fixtures_folder = File.join(RAILS_ROOT, 'test', 'fixtures') +fixtures_folder = File.join(Rails.root, 'test', 'fixtures') fixtures = ['environments', 'roles'] Fixtures.create_fixtures(fixtures_folder, fixtures) diff --git a/features/support/selenium.rb b/features/support/selenium.rb index 8b04b7b..0776e1d 100644 --- a/features/support/selenium.rb +++ b/features/support/selenium.rb @@ -14,7 +14,7 @@ DatabaseCleaner.strategy = :truncation Before do Fixtures.reset_cache - fixtures_folder = File.join(RAILS_ROOT, 'test', 'fixtures') + fixtures_folder = File.join(Rails.root, 'test', 'fixtures') fixtures = ['environments', 'roles'] Fixtures.create_fixtures(fixtures_folder, fixtures) ENV['LANG'] = 'C' diff --git a/lib/noosfero.rb b/lib/noosfero.rb index 3e23665..42fafb8 100644 --- a/lib/noosfero.rb +++ b/lib/noosfero.rb @@ -61,7 +61,7 @@ module Noosfero private def self.controllers_in_directory(dir) - app_controller_path = Dir.glob(File.join(RAILS_ROOT, 'app', 'controllers', dir, '*_controller.rb')) + app_controller_path = Dir.glob(File.join(Rails.root, 'app', 'controllers', dir, '*_controller.rb')) app_controller_path.map do |item| item.gsub(/^.*\/([^\/]+)_controller.rb$/, '\1') end diff --git a/lib/noosfero/multi_tenancy.rb b/lib/noosfero/multi_tenancy.rb index 65621b4..d5d5057 100644 --- a/lib/noosfero/multi_tenancy.rb +++ b/lib/noosfero/multi_tenancy.rb @@ -25,7 +25,7 @@ module Noosfero private def self.load_map - db_file = File.join(RAILS_ROOT, 'config', 'database.yml') + db_file = File.join(Rails.root, 'config', 'database.yml') db_config = YAML.load_file(db_file) map = { } db_config.each do |env, attr| @@ -36,7 +36,7 @@ module Noosfero end def self.is_hosted_environment? - db_file = File.join(RAILS_ROOT, 'config', 'database.yml') + db_file = File.join(Rails.root, 'config', 'database.yml') db_config = YAML.load_file(db_file) db_config.select{ |env, attr| RAILS_ENV.to_s.match(/_#{env}$/) }.any? end diff --git a/lib/noosfero/plugin.rb b/lib/noosfero/plugin.rb index 3868559..7d73d02 100644 --- a/lib/noosfero/plugin.rb +++ b/lib/noosfero/plugin.rb @@ -67,7 +67,7 @@ class Noosfero::Plugin end def root_path - File.join(RAILS_ROOT, 'plugins', public_name) + File.join(Rails.root, 'plugins', public_name) end def view_path @@ -93,7 +93,7 @@ class Noosfero::Plugin end def expanded_template(file_path, locals = {}) - views_path = "#{RAILS_ROOT}/plugins/#{self.class.public_name}/views" + views_path = "#{Rails.root}/plugins/#{self.class.public_name}/views" ERB.new(File.read("#{views_path}/#{file_path}")).result(binding) end diff --git a/lib/postgresql_attachment_fu.rb b/lib/postgresql_attachment_fu.rb index 404882b..98ae7fb 100644 --- a/lib/postgresql_attachment_fu.rb +++ b/lib/postgresql_attachment_fu.rb @@ -10,7 +10,7 @@ module PostgresqlAttachmentFu def full_filename(thumbnail = nil) file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix].to_s file_system_path = File.join(file_system_path, ActiveRecord::Base.connection.schema_search_path) if ActiveRecord::Base.postgresql? and Noosfero::MultiTenancy.on? - File.join(RAILS_ROOT, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail))) + File.join(Rails.root, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail))) end end diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index 3c553cf..12cc7bf 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -1,5 +1,5 @@ # This file was generated by -$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib') +$LOAD_PATH.unshift(Rails.root + '/vendor/plugins/cucumber/lib') if File.directory?(Rails.root + '/vendor/plugins/cucumber/lib') unless ARGV.any? {|a| a =~ /^gems/} @@ -8,7 +8,7 @@ begin # Use vendored cucumber binary if possible. If it's not vendored, # Cucumber::Rake::Task will automatically use installed gem's cucumber binary - vendored_cucumber_binary = Dir["#{RAILS_ROOT}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first + vendored_cucumber_binary = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first namespace :cucumber do Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| diff --git a/lib/tasks/doc.rake b/lib/tasks/doc.rake index 54a843f..0d065e6 100644 --- a/lib/tasks/doc.rake +++ b/lib/tasks/doc.rake @@ -5,12 +5,12 @@ namespace :noosfero do end task :link_plugins_textiles do plugins_textiles.each do |file| - ln_sf File.join(RAILS_ROOT, file), 'doc/noosfero/plugins/' + ln_sf File.join(Rails.root, file), 'doc/noosfero/plugins/' end end task :unlink_plugins_textiles do - rm_f Dir.glob(File.join(RAILS_ROOT, 'doc/noosfero/plugins/*.textile')) - - [File.join(RAILS_ROOT, 'doc/noosfero/plugins/index.textile')] + rm_f Dir.glob(File.join(Rails.root, 'doc/noosfero/plugins/*.textile')) - + [File.join(Rails.root, 'doc/noosfero/plugins/index.textile')] end input = Dir.glob('doc/noosfero/**/*.textile') + plugins_textiles.map{|i| "doc/noosfero/plugins/#{File.basename(i)}"} topics_xhtml = input.map { |item| item.sub('.textile', '.en.xhtml') }.uniq diff --git a/lib/tasks/error_messages.rake b/lib/tasks/error_messages.rake index a866d99..e802376 100644 --- a/lib/tasks/error_messages.rake +++ b/lib/tasks/error_messages.rake @@ -1,4 +1,4 @@ -templates = Dir.glob(RAILS_ROOT + '/public/*.html.erb') +templates = Dir.glob(Rails.root + '/public/*.html.erb') targets = [] templates.each do |template| target = template.gsub(/.erb$/, '') diff --git a/lib/tasks/multitenancy.rake b/lib/tasks/multitenancy.rake index d573252..0a3a176 100644 --- a/lib/tasks/multitenancy.rake +++ b/lib/tasks/multitenancy.rake @@ -2,14 +2,14 @@ namespace :multitenancy do task :create do db_envs = ActiveRecord::Base.configurations.keys.select{ |k| k.match(/_development$|_production$|_test$/) } - cd File.join(RAILS_ROOT, 'config', 'environments'), :verbose => true + cd File.join(Rails.root, 'config', 'environments'), :verbose => true file_envs = Dir.glob "{*_development.rb,*_prodution.rb,*_test.rb}" (db_envs.map{ |e| e + '.rb' } - file_envs).each { |env| ln_s env.split('_').last, env } end task :remove do db_envs = ActiveRecord::Base.configurations.keys.select{ |k| k.match(/_development$|_production$|_test$/) } - cd File.join(RAILS_ROOT, 'config', 'environments'), :verbose => true + cd File.join(Rails.root, 'config', 'environments'), :verbose => true file_envs = Dir.glob "{*_development.rb,*_prodution.rb,*_test.rb}" (file_envs - db_envs.map{ |e| e + '.rb' }).each { |env| safe_unlink env } end diff --git a/lib/tasks/po.rake b/lib/tasks/po.rake index 3b0cd34..d56164b 100644 --- a/lib/tasks/po.rake +++ b/lib/tasks/po.rake @@ -25,7 +25,7 @@ namespace :po do puts "+----------+----------+------------+--------+--------------+" puts "| Language | Messages | Translated | Fuzzy | Untranslated |" puts "+----------+----------+------------+--------+--------------+" - Dir.glob(RAILS_ROOT + '/po/*/noosfero.po').each do |file| + Dir.glob(Rails.root + '/po/*/noosfero.po').each do |file| language = File.basename(File.dirname(file)) output = `msgfmt --output /dev/null --statistics #{file} 2>&1` translated = extract_po_stat('translated', output) diff --git a/lib/tasks/test_rcov.rake b/lib/tasks/test_rcov.rake index 216085a..39e92b8 100644 --- a/lib/tasks/test_rcov.rake +++ b/lib/tasks/test_rcov.rake @@ -22,8 +22,8 @@ namespace :test do task :rcov do |t| require 'rbconfig' - tests = Dir.glob(File.join(RAILS_ROOT, 'test', '*', '*_test.rb')) - outdir = File.join(RAILS_ROOT, 'coverage') + tests = Dir.glob(File.join(Rails.root, 'test', '*', '*_test.rb')) + outdir = File.join(Rails.root, 'coverage') test_loader = File.join(Config::CONFIG['rubylibdir'], 'rake', 'rake_test_loader.rb') system("rcov", '-o', outdir, '-T', '-x', 'rubygems/*,rcov*', '--rails', '-Ilib:test', test_loader, *tests) diff --git a/plugins/mezuro/lib/kalibro/model.rb b/plugins/mezuro/lib/kalibro/model.rb index 38b807a..d78b7e6 100644 --- a/plugins/mezuro/lib/kalibro/model.rb +++ b/plugins/mezuro/lib/kalibro/model.rb @@ -88,7 +88,7 @@ class Kalibro::Model end def self.client(endpoint) - service_address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yaml") + service_address = YAML.load_file("#{Rails.root}/plugins/mezuro/service.yaml") Savon::Client.new("#{service_address}#{endpoint}Endpoint/?wsdl") end diff --git a/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb b/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb index 4e0c4e5..c11fe14 100644 --- a/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb +++ b/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb @@ -11,7 +11,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper end def self.create_license_options - options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") + options = YAML.load_file("#{Rails.root}/plugins/mezuro/licenses.yaml") options = options.split(";") formated_options = [] options.each { |option| formated_options << [option, option] } @@ -50,7 +50,7 @@ class MezuroPlugin::Helpers::ContentViewerHelper end def self.get_license_option(selected) - options = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/licenses.yaml") + options = YAML.load_file("#{Rails.root}/plugins/mezuro/licenses.yaml") options.split(";") selected_option = options.find { |license| license == selected } end diff --git a/plugins/mezuro/test/features/echo_port_test.rb b/plugins/mezuro/test/features/echo_port_test.rb index 9ebdfd6..286f25c 100644 --- a/plugins/mezuro/test/features/echo_port_test.rb +++ b/plugins/mezuro/test/features/echo_port_test.rb @@ -1,15 +1,15 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" class EchoPortTest < ActiveSupport::TestCase def setup @port = Kalibro::Client::Port.new('Echo') - address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yaml") + address = YAML.load_file("#{Rails.root}/plugins/mezuro/service.yaml") address['KalibroService'] = 'KalibroFake' @port.service_address=(address); end diff --git a/plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb b/plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb index f4f38eb..d26f750 100644 --- a/plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb +++ b/plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb @@ -1,11 +1,11 @@ require 'test_helper' -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/native_metric_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/native_metric_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" class MezuroPluginMyprofileControllerTest < ActionController::TestCase diff --git a/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb b/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb index 581ead8..0ca11dd 100644 --- a/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb +++ b/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb @@ -1,9 +1,9 @@ require 'test_helper' -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/repository_fixtures" class MezuroPluginProfileControllerTest < ActionController::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/base_tool_test.rb b/plugins/mezuro/test/unit/kalibro/base_tool_test.rb index f4a00f2..71a37ab 100644 --- a/plugins/mezuro/test/unit/kalibro/base_tool_test.rb +++ b/plugins/mezuro/test/unit/kalibro/base_tool_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" class BaseToolTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/compound_metric_test.rb b/plugins/mezuro/test/unit/kalibro/compound_metric_test.rb index c3437d2..3573f8e 100644 --- a/plugins/mezuro/test/unit/kalibro/compound_metric_test.rb +++ b/plugins/mezuro/test/unit/kalibro/compound_metric_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/compound_metric_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/compound_metric_fixtures" class CompoundMetricTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb b/plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb index 2b7bcc1..9fb8c34 100644 --- a/plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb +++ b/plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/compound_metric_with_error_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/compound_metric_with_error_fixtures" class CompoundMetricWithErrorTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/configuration_test.rb b/plugins/mezuro/test/unit/kalibro/configuration_test.rb index 72625aa..2c5dd10 100644 --- a/plugins/mezuro/test/unit/kalibro/configuration_test.rb +++ b/plugins/mezuro/test/unit/kalibro/configuration_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" class ConfigurationTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/error_test.rb b/plugins/mezuro/test/unit/kalibro/error_test.rb index 4faf108..121e14f 100644 --- a/plugins/mezuro/test/unit/kalibro/error_test.rb +++ b/plugins/mezuro/test/unit/kalibro/error_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" class ErrorTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb b/plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb index f5c5a99..32bfc95 100644 --- a/plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb +++ b/plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb @@ -1,7 +1,7 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" class MetricConfigurationTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/metric_result_test.rb b/plugins/mezuro/test/unit/kalibro/metric_result_test.rb index 41deaac..0d7d8f3 100644 --- a/plugins/mezuro/test/unit/kalibro/metric_result_test.rb +++ b/plugins/mezuro/test/unit/kalibro/metric_result_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_result_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_result_fixtures" class MetricResultTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/module_node_test.rb b/plugins/mezuro/test/unit/kalibro/module_node_test.rb index d507452..c26dfde 100644 --- a/plugins/mezuro/test/unit/kalibro/module_node_test.rb +++ b/plugins/mezuro/test/unit/kalibro/module_node_test.rb @@ -1,5 +1,5 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_node_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_node_fixtures" class ModuleNodeTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/module_result_test.rb b/plugins/mezuro/test/unit/kalibro/module_result_test.rb index aacd7eb..16e02ee 100644 --- a/plugins/mezuro/test/unit/kalibro/module_result_test.rb +++ b/plugins/mezuro/test/unit/kalibro/module_result_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" class ModuleResultTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/module_test.rb b/plugins/mezuro/test/unit/kalibro/module_test.rb index 7067620..e1681ac 100644 --- a/plugins/mezuro/test/unit/kalibro/module_test.rb +++ b/plugins/mezuro/test/unit/kalibro/module_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_fixtures" class ModuleTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/native_metric_test.rb b/plugins/mezuro/test/unit/kalibro/native_metric_test.rb index 616aaf7..5f6e0bb 100644 --- a/plugins/mezuro/test/unit/kalibro/native_metric_test.rb +++ b/plugins/mezuro/test/unit/kalibro/native_metric_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/native_metric_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/native_metric_fixtures" class NativeMetricTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/project_result_test.rb b/plugins/mezuro/test/unit/kalibro/project_result_test.rb index 12dc082..5024db2 100644 --- a/plugins/mezuro/test/unit/kalibro/project_result_test.rb +++ b/plugins/mezuro/test/unit/kalibro/project_result_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" class ProjectResultTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/project_test.rb b/plugins/mezuro/test/unit/kalibro/project_test.rb index e61d080..9df8b08 100644 --- a/plugins/mezuro/test/unit/kalibro/project_test.rb +++ b/plugins/mezuro/test/unit/kalibro/project_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/project_fixtures" class ProjectTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/range_test.rb b/plugins/mezuro/test/unit/kalibro/range_test.rb index cb63680..adbd08c 100644 --- a/plugins/mezuro/test/unit/kalibro/range_test.rb +++ b/plugins/mezuro/test/unit/kalibro/range_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" class RangeTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/repository_test.rb b/plugins/mezuro/test/unit/kalibro/repository_test.rb index 145c11a..00c0d9c 100644 --- a/plugins/mezuro/test/unit/kalibro/repository_test.rb +++ b/plugins/mezuro/test/unit/kalibro/repository_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/repository_fixtures" class RepositoryTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb b/plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb index 9ede13d..fb1b4cf 100644 --- a/plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb +++ b/plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/stack_trace_element_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/stack_trace_element_fixtures" class StackTraceElementTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb b/plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb index 2c1d7c9..54411ba 100644 --- a/plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb +++ b/plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb @@ -1,6 +1,6 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" class ConfigurationContentTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb b/plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb index de63ede..9d48a3e 100644 --- a/plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb +++ b/plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb @@ -1,5 +1,5 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_result_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_result_fixtures" class ContentViewerHelperTest < ActiveSupport::TestCase diff --git a/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb b/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb index 28dbb75..549e6bf 100644 --- a/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb +++ b/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb @@ -1,9 +1,9 @@ require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/project_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_fixtures" +require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" class ProjectContentTest < ActiveSupport::TestCase diff --git a/public/dispatch.cgi b/public/dispatch.cgi index dfe5dc3..aba4c92 100755 --- a/public/dispatch.cgi +++ b/public/dispatch.cgi @@ -2,7 +2,7 @@ #!/usr/local/bin/ruby -require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) +require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails.root) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired diff --git a/public/dispatch.fcgi b/public/dispatch.fcgi index d02c35b..9ba819c 100755 --- a/public/dispatch.fcgi +++ b/public/dispatch.fcgi @@ -6,7 +6,7 @@ # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # -# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log +# By default, the FastCGI crash log is Rails.root/log/fastcgi.crash.log # and the GC period is nil (turned off). A reasonable number of requests # could range from 10-100 depending on the memory footprint of your app. # diff --git a/public/dispatch.rb b/public/dispatch.rb index dfe5dc3..aba4c92 100755 --- a/public/dispatch.rb +++ b/public/dispatch.rb @@ -2,7 +2,7 @@ #!/usr/local/bin/ruby -require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) +require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails.root) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired diff --git a/script/reset_db b/script/reset_db index 74e3ae1..86f4067 100755 --- a/script/reset_db +++ b/script/reset_db @@ -1,10 +1,10 @@ #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/environment' -system "rm #{RAILS_ROOT}/tmp/*.db" -system "rm #{RAILS_ROOT}/db/*.db" -system "rm -rf #{RAILS_ROOT}/public/articles" +system "rm #{Rails.root}/tmp/*.db" +system "rm #{Rails.root}/db/*.db" +system "rm -rf #{Rails.root}/public/articles" system "rake db:migrate VERSION=0" system "rake db:migrate" -system "#{RAILS_ROOT}/script/anhetegua" +system "#{Rails.root}/script/anhetegua" system "rake db:test:prepare" diff --git a/test/factories.rb b/test/factories.rb index 7b97fc2..65467a5 100644 --- a/test/factories.rb +++ b/test/factories.rb @@ -265,7 +265,7 @@ module Noosfero::Factory # ExternalFeed ############################################### def defaults_for_external_feed - { :address => RAILS_ROOT + '/test/fixtures/files/feed.xml', :blog_id => factory_num_seq } + { :address => Rails.root + '/test/fixtures/files/feed.xml', :blog_id => factory_num_seq } end def create_external_feed(attrs = {}) @@ -279,7 +279,7 @@ module Noosfero::Factory # FeedReaderBlock ############################################### def defaults_for_feed_reader_block - { :address => RAILS_ROOT + '/test/fixtures/files/feed.xml' } + { :address => Rails.root + '/test/fixtures/files/feed.xml' } end ############################################### diff --git a/test/functional/themes_controller_test.rb b/test/functional/themes_controller_test.rb index 6574fd1..daa44ab 100644 --- a/test/functional/themes_controller_test.rb +++ b/test/functional/themes_controller_test.rb @@ -25,7 +25,7 @@ class ThemesControllerTest < ActionController::TestCase FileUtils.rm_rf(TMP_THEMES_DIR) end - TMP_THEMES_DIR = RAILS_ROOT + '/test/tmp/themes_controller' + TMP_THEMES_DIR = Rails.root + '/test/tmp/themes_controller' should 'display themes that can be applied' do env = Environment.default @@ -216,7 +216,7 @@ class ThemesControllerTest < ActionController::TestCase post :add_image, :profile => 'testinguser', :id => 'mytheme', :image => fixture_file_upload('/files/rails.png', 'image/png', :binary) assert_redirected_to :action => "edit", :id => 'mytheme' assert theme.image_files.include?('rails.png') - 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') + 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') end should 'link to "test theme"' do diff --git a/test/integration/controller_naming_test.rb b/test/integration/controller_naming_test.rb index 6bd9821..a248c77 100644 --- a/test/integration/controller_naming_test.rb +++ b/test/integration/controller_naming_test.rb @@ -3,7 +3,7 @@ require "#{File.dirname(__FILE__)}/../test_helper" class ControllerNamingTest < ActionController::IntegrationTest should 'not have controllers with same name in different folders' do - controllers = Dir.glob("#{RAILS_ROOT}/app/controllers/**/*_controller.rb").map { |item| item.split(/\//).last } + controllers = Dir.glob("#{Rails.root}/app/controllers/**/*_controller.rb").map { |item| item.split(/\//).last } assert_equal controllers.uniq, controllers end diff --git a/test/integration/tiny_mce_languages_test.rb b/test/integration/tiny_mce_languages_test.rb index c4a720c..768e26c 100644 --- a/test/integration/tiny_mce_languages_test.rb +++ b/test/integration/tiny_mce_languages_test.rb @@ -11,7 +11,7 @@ class TinyMceLanguagesTest < ActionController::IntegrationTest end def assert_exists_tinymce_language_file(file) - filename = RAILS_ROOT + "/public/javascripts/tinymce/jscripts/tiny_mce/" + file + filename = Rails.root + "/public/javascripts/tinymce/jscripts/tiny_mce/" + file assert(File.exists?(filename), filename + " must exist") end diff --git a/test/test_helper.rb b/test/test_helper.rb index 36935d4..90d145c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -19,7 +19,7 @@ require File.dirname(__FILE__) + '/noosfero_doc_test' require File.dirname(__FILE__) + '/action_tracker_test_helper' require File.expand_path(File.dirname(__FILE__) + "/test_solr_helper.rb") -FileUtils.rm_rf(File.join(RAILS_ROOT, 'index', 'test')) +FileUtils.rm_rf(File.join(Rails.root, 'index', 'test')) Image.attachment_options[:path_prefix] = 'test/tmp/public/images' Thumbnail.attachment_options[:path_prefix] = 'test/tmp/public/thumbnails' @@ -69,7 +69,7 @@ class ActiveSupport::TestCase end def self.all_fixtures - Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.yml')).each do |item| + Dir.glob(File.join(Rails.root, 'test', 'fixtures', '*.yml')).each do |item| fixtures File.basename(item).sub(/\.yml$/, '').to_s end end @@ -160,7 +160,7 @@ class ActiveSupport::TestCase patch ? patch[1] : nil end.compact s.each do |css_ref| - if ! File.exists?( RAILS_ROOT.to_s() +'/public/'+ css_ref ) + if ! File.exists?( Rails.root.to_s() +'/public/'+ css_ref ) flunk 'CSS reference missed on HTML: "%s"' % css_ref end end @@ -169,7 +169,7 @@ class ActiveSupport::TestCase # Test image references: (doc/'img').each do |img| src = img.get_attribute( 'src' ).gsub(/\?[0-9]+$/, '') - if ! File.exists?( RAILS_ROOT.to_s() +'/public/'+ src ) + if ! File.exists?( Rails.root.to_s() +'/public/'+ src ) flunk 'Image reference missed on HTML: "%s"' % src end end diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index 0efbddf..f2379b5 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -54,10 +54,10 @@ class ApplicationHelperTest < ActiveSupport::TestCase end should 'look for superclasses on view_for_profile actions' do - File.expects(:exists?).with("#{RAILS_ROOT}/app/views/blocks/profile_info_actions/float.rhtml").returns(false) - File.expects(:exists?).with("#{RAILS_ROOT}/app/views/blocks/profile_info_actions/float.html.erb").returns(false) - File.expects(:exists?).with("#{RAILS_ROOT}/app/views/blocks/profile_info_actions/numeric.rhtml").returns(false) - File.expects(:exists?).with("#{RAILS_ROOT}/app/views/blocks/profile_info_actions/numeric.html.erb").returns(true) + File.expects(:exists?).with("#{Rails.root}/app/views/blocks/profile_info_actions/float.rhtml").returns(false) + File.expects(:exists?).with("#{Rails.root}/app/views/blocks/profile_info_actions/float.html.erb").returns(false) + File.expects(:exists?).with("#{Rails.root}/app/views/blocks/profile_info_actions/numeric.rhtml").returns(false) + File.expects(:exists?).with("#{Rails.root}/app/views/blocks/profile_info_actions/numeric.html.erb").returns(true) assert_equal 'blocks/profile_info_actions/numeric.html.erb', view_for_profile_actions(Float) end @@ -69,13 +69,13 @@ class ApplicationHelperTest < ActiveSupport::TestCase end should 'generate link to stylesheet' do - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', 'stylesheets', 'something.css')).returns(true) + File.expects(:exists?).with(File.join(Rails.root, 'public', 'stylesheets', 'something.css')).returns(true) expects(:filename_for_stylesheet).with('something', nil).returns('/stylesheets/something.css') assert_match '@import url(/stylesheets/something.css)', stylesheet_import('something') end should 'not generate link to unexisting stylesheet' do - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', 'stylesheets', 'something.css')).returns(false) + File.expects(:exists?).with(File.join(Rails.root, 'public', 'stylesheets', 'something.css')).returns(false) expects(:filename_for_stylesheet).with('something', nil).returns('/stylesheets/something.css') assert_no_match %r{@import url(/stylesheets/something.css)}, stylesheet_import('something') end @@ -174,7 +174,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase should 'render theme footer' do stubs(:theme_path).returns('/user_themes/mytheme') - footer_path = RAILS_ROOT + '/public/user_themes/mytheme/footer.rhtml' + footer_path = Rails.root + '/public/user_themes/mytheme/footer.rhtml' File.expects(:exists?).with(footer_path).returns(true) expects(:render).with(:file => footer_path, :use_full_path => false).returns("BLI") @@ -184,8 +184,8 @@ class ApplicationHelperTest < ActiveSupport::TestCase should 'ignore unexisting theme footer' do stubs(:theme_path).returns('/user_themes/mytheme') - footer_path = RAILS_ROOT + '/public/user_themes/mytheme/footer.rhtml' - alternate_footer_path = RAILS_ROOT + '/public/user_themes/mytheme/footer.html.erb' + footer_path = Rails.root + '/public/user_themes/mytheme/footer.rhtml' + alternate_footer_path = Rails.root + '/public/user_themes/mytheme/footer.html.erb' File.expects(:exists?).with(footer_path).returns(false) File.expects(:exists?).with(alternate_footer_path).returns(false) @@ -196,7 +196,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase should 'render theme site title' do stubs(:theme_path).returns('/user_themes/mytheme') - site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.rhtml' + site_title_path = Rails.root + '/public/user_themes/mytheme/site_title.rhtml' File.expects(:exists?).with(site_title_path).returns(true) expects(:render).with(:file => site_title_path, :use_full_path => false).returns("Site title") @@ -206,8 +206,8 @@ class ApplicationHelperTest < ActiveSupport::TestCase should 'ignore unexisting theme site title' do stubs(:theme_path).returns('/user_themes/mytheme') - site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.rhtml' - alternate_site_title_path = RAILS_ROOT + '/public/user_themes/mytheme/site_title.html.erb' + site_title_path = Rails.root + '/public/user_themes/mytheme/site_title.rhtml' + alternate_site_title_path = Rails.root + '/public/user_themes/mytheme/site_title.html.erb' File.expects(:exists?).with(site_title_path).returns(false) File.expects(:exists?).with(alternate_site_title_path).returns(false) @@ -569,7 +569,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase should 'use favicon from profile theme if the profile has theme' do stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme')) - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', '/designs/themes/profile-theme', 'favicon.ico')).returns(true) + File.expects(:exists?).with(File.join(Rails.root, 'public', '/designs/themes/profile-theme', 'favicon.ico')).returns(true) assert_equal '/designs/themes/profile-theme/favicon.ico', theme_favicon end @@ -577,7 +577,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme')) file = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/favicon.ico', 'image/x-ico'), :profile => profile) - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')).returns(false) + File.expects(:exists?).with(File.join(Rails.root, 'public', theme_path, 'favicon.ico')).returns(false) assert_match /favicon.ico/, theme_favicon end @@ -585,7 +585,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase should 'use favicon from environment if the profile theme and profile articles do not have' do stubs(:environment).returns(fast_create(Environment, :theme => 'new-theme')) stubs(:profile).returns(fast_create(Profile, :theme => 'profile-theme')) - File.expects(:exists?).with(File.join(RAILS_ROOT, 'public', theme_path, 'favicon.ico')).returns(false) + File.expects(:exists?).with(File.join(Rails.root, 'public', theme_path, 'favicon.ico')).returns(false) assert_equal '/designs/themes/new-theme/favicon.ico', theme_favicon end @@ -595,7 +595,7 @@ class ApplicationHelperTest < ActiveSupport::TestCase stubs(:environment).returns(env) @controller = ApplicationController.new - path = File.join(RAILS_ROOT, 'app', 'views') + path = File.join(Rails.root, 'app', 'views') @controller.stubs(:view_paths).returns([path]) file = path + '/shared/usermenu/xmpp_chat.rhtml' diff --git a/test/unit/colorbox_helper_test.rb b/test/unit/colorbox_helper_test.rb index 129aa8c..c42d830 100644 --- a/test/unit/colorbox_helper_test.rb +++ b/test/unit/colorbox_helper_test.rb @@ -5,8 +5,8 @@ class ColorboxHelperTest < ActiveSupport::TestCase include ColorboxHelper should 'provide the needed files' do - assert File.exists?(File.join(RAILS_ROOT, 'public', 'stylesheets', 'colorbox.css')), 'colorbox.css expected to be in public/stylesheets, but not found' - assert File.exists?(File.join(RAILS_ROOT, 'public', 'javascripts', 'colorbox.js')), 'colorbox.js expected to be in public/javascripts, but not found' + assert File.exists?(File.join(Rails.root, 'public', 'stylesheets', 'colorbox.css')), 'colorbox.css expected to be in public/stylesheets, but not found' + assert File.exists?(File.join(Rails.root, 'public', 'javascripts', 'colorbox.js')), 'colorbox.js expected to be in public/javascripts, but not found' end should 'provide link to close colorbox' do diff --git a/test/unit/doc_item_test.rb b/test/unit/doc_item_test.rb index 7c15f05..228a398 100644 --- a/test/unit/doc_item_test.rb +++ b/test/unit/doc_item_test.rb @@ -27,10 +27,10 @@ class DocItemTest < ActiveSupport::TestCase should 'translate images' do doc = DocItem.new(:language => 'pt', :text => '

Look the image:

The image

') - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.pt.png').returns(false) + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.pt.png').returns(false) assert_equal doc.text, doc.html - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.pt.png').returns(true) + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.pt.png').returns(true) assert_match(/ 'pt', :text => '

Look the image:

The image

') # the image exists in both the system *and* on the theme - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.pt.png').returns(true) - File.stubs(:exist?).with(RAILS_ROOT + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(true) + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.pt.png').returns(true) + File.stubs(:exist?).with(Rails.root + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(true) # the one in the theme must be used assert_match(/ 'pt', :text => '

Look the image:

The image

') # the image has a translation in the system but not in the theme - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.pt.png').returns(true) - File.stubs(:exist?).with(RAILS_ROOT + '/public/designs/themes/mytheme/images/doc/myimage.en.png').returns(false) - File.stubs(:exist?).with(RAILS_ROOT + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(false) + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.pt.png').returns(true) + File.stubs(:exist?).with(Rails.root + '/public/designs/themes/mytheme/images/doc/myimage.en.png').returns(false) + File.stubs(:exist?).with(Rails.root + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(false) # the one in the theme must be used assert_match(/ 'pt', :text => '

Look the image:

The image

') # the image has no translation, but both system and theme provide an image - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.en.png').returns(true) - File.stubs(:exist?).with(RAILS_ROOT + '/public/images/doc/myimage.pt.png').returns(false) - File.stubs(:exist?).with(RAILS_ROOT + '/public/designs/themes/mytheme/images/doc/myimage.en.png').returns(true) - File.stubs(:exist?).with(RAILS_ROOT + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(false) + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.en.png').returns(true) + File.stubs(:exist?).with(Rails.root + '/public/images/doc/myimage.pt.png').returns(false) + File.stubs(:exist?).with(Rails.root + '/public/designs/themes/mytheme/images/doc/myimage.en.png').returns(true) + File.stubs(:exist?).with(Rails.root + '/public/designs/themes/mytheme/images/doc/myimage.pt.png').returns(false) # the one in the theme must be used assert_match(/ 1, :address => RAILS_ROOT + '/test/fixtures/files/feed.xml') + container = build(container_class, :update_errors => 1, :address => Rails.root + '/test/fixtures/files/feed.xml') handler.expects(:actually_process_container).with(container) handler.process(container) assert_equal 0, container.update_errors diff --git a/test/unit/folder_helper_test.rb b/test/unit/folder_helper_test.rb index c2dc11e..4392f7f 100644 --- a/test/unit/folder_helper_test.rb +++ b/test/unit/folder_helper_test.rb @@ -127,7 +127,7 @@ class FolderHelperTest < ActiveSupport::TestCase private def render(template, the_binding) - ERB.new(File.read(RAILS_ROOT + '/app/views/' + template + '.rhtml')).result(the_binding) + ERB.new(File.read(Rails.root + '/app/views/' + template + '.rhtml')).result(the_binding) end end diff --git a/test/unit/image_test.rb b/test/unit/image_test.rb index 5899a71..59c52c1 100644 --- a/test/unit/image_test.rb +++ b/test/unit/image_test.rb @@ -84,7 +84,7 @@ class ImageTest < ActiveSupport::TestCase should 'have a loading image to each size of thumbnails' do Image.attachment_options[:thumbnails].each do |suffix, size| - image = RAILS_ROOT + '/public/images/icons-app/image-loading-%s.png' % suffix + image = Rails.root + '/public/images/icons-app/image-loading-%s.png' % suffix assert File.exists?(image) end end diff --git a/test/unit/layout_template_test.rb b/test/unit/layout_template_test.rb index 7c2fbae..f9079b3 100644 --- a/test/unit/layout_template_test.rb +++ b/test/unit/layout_template_test.rb @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper' class LayoutTemplateTest < ActiveSupport::TestCase should 'read configuration' do - YAML.expects(:load_file).with(RAILS_ROOT + '/public/designs/templates/default/config.yml').returns({'number_of_boxes' => 3, 'description' => 'my description', 'title' => 'my title'}) + YAML.expects(:load_file).with(Rails.root + '/public/designs/templates/default/config.yml').returns({'number_of_boxes' => 3, 'description' => 'my description', 'title' => 'my title'}) t = LayoutTemplate.find('default') assert_equal 3, t.number_of_boxes assert_equal 'my description', t.description @@ -11,9 +11,9 @@ class LayoutTemplateTest < ActiveSupport::TestCase end should 'list all' do - Dir.expects(:glob).with(RAILS_ROOT + '/public/designs/templates/*').returns([RAILS_ROOT + '/public/designs/templates/one', RAILS_ROOT + '/public/designs/templates/two']) - YAML.expects(:load_file).with(RAILS_ROOT + '/public/designs/templates/one/config.yml').returns({}) - YAML.expects(:load_file).with(RAILS_ROOT + '/public/designs/templates/two/config.yml').returns({}) + Dir.expects(:glob).with(Rails.root + '/public/designs/templates/*').returns([Rails.root + '/public/designs/templates/one', Rails.root + '/public/designs/templates/two']) + YAML.expects(:load_file).with(Rails.root + '/public/designs/templates/one/config.yml').returns({}) + YAML.expects(:load_file).with(Rails.root + '/public/designs/templates/two/config.yml').returns({}) all = LayoutTemplate.all assert_equivalent [ 'one', 'two' ], all.map(&:id) diff --git a/test/unit/lightbox_helper_test.rb b/test/unit/lightbox_helper_test.rb index b5f3eb6..c5c1ca8 100644 --- a/test/unit/lightbox_helper_test.rb +++ b/test/unit/lightbox_helper_test.rb @@ -9,8 +9,8 @@ class LightboxHelperTest < ActiveSupport::TestCase end should 'provide the needed files' do - assert File.exists?(File.join(RAILS_ROOT, 'public', 'stylesheets', 'lightbox.css')), 'lightbox.css expected to be in public/stylesheets, but not found' - assert File.exists?(File.join(RAILS_ROOT, 'public', 'javascripts', 'lightbox.js')), 'lightbox.js expected to be in public/javascripts, but not found' + assert File.exists?(File.join(Rails.root, 'public', 'stylesheets', 'lightbox.css')), 'lightbox.css expected to be in public/stylesheets, but not found' + assert File.exists?(File.join(Rails.root, 'public', 'javascripts', 'lightbox.js')), 'lightbox.js expected to be in public/javascripts, but not found' end should 'provide lightbox_link_to helper' do diff --git a/test/unit/noosfero_test.rb b/test/unit/noosfero_test.rb index 5767d20..c7506bf 100644 --- a/test/unit/noosfero_test.rb +++ b/test/unit/noosfero_test.rb @@ -4,12 +4,12 @@ require 'noosfero' class NoosferoTest < ActiveSupport::TestCase def test_should_list_controllers_in_directory - 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 + 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 assert_equal ["system_admin", "environment_admin", "public", "profile_admin"], Noosfero.controllers_in_directory('lala') end def test_should_generate_pattern_for_controllers_in_directory - 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 + 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 assert_equal(/(system_admin|environment_admin|public|profile_admin)/, Noosfero.pattern_for_controllers_in_directory('lala')) end diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index bff378d..41ce20d 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -1142,7 +1142,7 @@ class ProfileTest < ActiveSupport::TestCase assert_equal 'default title', p.boxes[0].blocks.first[:title] end - TMP_THEMES_DIR = RAILS_ROOT + '/test/tmp/profile_themes' + TMP_THEMES_DIR = Rails.root + '/test/tmp/profile_themes' should 'have themes' do Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR) diff --git a/test/unit/theme_test.rb b/test/unit/theme_test.rb index f8f21d7..ddd9ecb 100644 --- a/test/unit/theme_test.rb +++ b/test/unit/theme_test.rb @@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../test_helper' class ThemeTest < ActiveSupport::TestCase - TMP_THEMES_DIR = RAILS_ROOT + '/test/tmp/themes' + TMP_THEMES_DIR = Rails.root + '/test/tmp/themes' def setup Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR) @@ -13,11 +13,11 @@ class ThemeTest < ActiveSupport::TestCase end should 'list system themes' do - Dir.expects(:glob).with(RAILS_ROOT + '/public/designs/themes/*').returns( + Dir.expects(:glob).with(Rails.root + '/public/designs/themes/*').returns( [ - RAILS_ROOT + '/public/designs/themes/themeone', - RAILS_ROOT + '/public/designs/themes/themetwo', - RAILS_ROOT + '/public/designs/themes/themethree' + Rails.root + '/public/designs/themes/themeone', + Rails.root + '/public/designs/themes/themetwo', + Rails.root + '/public/designs/themes/themethree' ]) assert_equal ['themeone', 'themetwo', 'themethree'], Theme.system_themes.map(&:id) diff --git a/test/unit/uploaded_file_test.rb b/test/unit/uploaded_file_test.rb index 55f774f..f189550 100644 --- a/test/unit/uploaded_file_test.rb +++ b/test/unit/uploaded_file_test.rb @@ -223,7 +223,7 @@ class UploadedFileTest < ActiveSupport::TestCase should 'have a loading image to each size of thumbnails' do UploadedFile.attachment_options[:thumbnails].each do |suffix, size| - image = RAILS_ROOT + '/public/images/icons-app/image-loading-%s.png' % suffix + image = Rails.root + '/public/images/icons-app/image-loading-%s.png' % suffix assert File.exists?(image) end end @@ -231,10 +231,10 @@ class UploadedFileTest < ActiveSupport::TestCase should 'return a thumbnail for images' do f = UploadedFile.new f.expects(:image?).returns(true) - f.expects(:full_filename).with(:display).returns(File.join(RAILS_ROOT, 'public', 'images', '0000', '0005', 'x.png')) + f.expects(:full_filename).with(:display).returns(File.join(Rails.root, 'public', 'images', '0000', '0005', 'x.png')) assert_equal '/images/0000/0005/x.png', f.thumbnail_path f = UploadedFile.new - f.stubs(:full_filename).with(:display).returns(File.join(RAILS_ROOT, 'public', 'images', '0000', '0005', 'x.png')) + f.stubs(:full_filename).with(:display).returns(File.join(Rails.root, 'public', 'images', '0000', '0005', 'x.png')) f.expects(:image?).returns(false) assert_nil f.thumbnail_path end diff --git a/vendor/ezcrypto-0.7.2/test/test_helper.rb b/vendor/ezcrypto-0.7.2/test/test_helper.rb index e63150e..d4a9c40 100644 --- a/vendor/ezcrypto-0.7.2/test/test_helper.rb +++ b/vendor/ezcrypto-0.7.2/test/test_helper.rb @@ -8,13 +8,13 @@ require 'active_record' #require 'active_support/breakpoint' -unless defined?(RAILS_ROOT) +unless defined?(Rails.root) root_path = File.join(File.dirname(__FILE__), '..') unless RUBY_PLATFORM =~ /mswin32/ require 'pathname' root_path = Pathname.new(root_path).cleanpath.to_s end - RAILS_ROOT = root_path + Rails.root = root_path end diff --git a/vendor/plugins/access_control/lib/permission_check.rb b/vendor/plugins/access_control/lib/permission_check.rb index f191c2e..d8eed71 100644 --- a/vendor/plugins/access_control/lib/permission_check.rb +++ b/vendor/plugins/access_control/lib/permission_check.rb @@ -34,9 +34,9 @@ module PermissionCheck end def access_denied_template_path - if File.exists?(File.join(RAILS_ROOT, 'app', 'views', 'access_control', 'access_denied.rhtml')) - File.join(RAILS_ROOT, 'app', 'views', 'access_control', 'access_denied.rhtml') - elsif File.exists?(File.join(RAILS_ROOT, 'app','views', 'shared', 'access_denied.rhtml')) + if File.exists?(File.join(Rails.root, 'app', 'views', 'access_control', 'access_denied.rhtml')) + File.join(Rails.root, 'app', 'views', 'access_control', 'access_denied.rhtml') + elsif File.exists?(File.join(Rails.root, 'app','views', 'shared', 'access_denied.rhtml')) File.join('shared', 'access_denied.rhtml') else File.join(File.dirname(__FILE__), '..', 'views', 'access_denied.rhtml') diff --git a/vendor/plugins/access_control/test/permission_check_test.rb b/vendor/plugins/access_control/test/permission_check_test.rb index d52d695..91fdd70 100644 --- a/vendor/plugins/access_control/test/permission_check_test.rb +++ b/vendor/plugins/access_control/test/permission_check_test.rb @@ -28,8 +28,8 @@ class PermissionCheckTest < Test::Unit::TestCase end def test_try_render_shared_access_denied_view - File.expects(:exists?).with(File.join(RAILS_ROOT, 'app', 'views', 'access_control', 'access_denied.rhtml')) - File.expects(:exists?).with(File.join(RAILS_ROOT, 'app', 'views', 'shared', 'access_denied.rhtml')) + File.expects(:exists?).with(File.join(Rails.root, 'app', 'views', 'access_control', 'access_denied.rhtml')) + File.expects(:exists?).with(File.join(Rails.root, 'app', 'views', 'shared', 'access_denied.rhtml')) AccessControlTestController.access_denied_template_path end diff --git a/vendor/plugins/action_tracker/test/test_helper.rb b/vendor/plugins/action_tracker/test/test_helper.rb index 4975b1e..5e9c634 100755 --- a/vendor/plugins/action_tracker/test/test_helper.rb +++ b/vendor/plugins/action_tracker/test/test_helper.rb @@ -1,5 +1,5 @@ -ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..' -require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb')) +ENV['Rails.root'] ||= File.dirname(__FILE__) + '/../../../..' +require File.expand_path(File.join(ENV['Rails.root'], 'config/environment.rb')) ENV["RAILS_ENV"] = "test" require 'test_help' diff --git a/vendor/plugins/acts_as_solr_reloaded/config/solr_environment.rb b/vendor/plugins/acts_as_solr_reloaded/config/solr_environment.rb index 7c69d11..62445ad 100644 --- a/vendor/plugins/acts_as_solr_reloaded/config/solr_environment.rb +++ b/vendor/plugins/acts_as_solr_reloaded/config/solr_environment.rb @@ -7,21 +7,21 @@ require 'net/http' dir = File.dirname(__FILE__) SOLR_PATH = File.expand_path("#{dir}/../solr") unless defined? SOLR_PATH -unless defined? RAILS_ROOT - # define RAILS_ROOT for test environment - RAILS_ROOT = defined?(Rails) ? Rails.root : File.expand_path("#{File.dirname(__FILE__)}/../test") +unless defined? Rails.root + # define Rails.root for test environment + Rails.root = defined?(Rails) ? Rails.root : File.expand_path("#{File.dirname(__FILE__)}/../test") end unless defined? RAILS_ENV RAILS_ENV = ENV['RAILS_ENV'] end unless defined? SOLR_LOGS_PATH - SOLR_LOGS_PATH = ENV["SOLR_LOGS_PATH"] || "#{RAILS_ROOT}/log" + SOLR_LOGS_PATH = ENV["SOLR_LOGS_PATH"] || "#{Rails.root}/log" end unless defined? SOLR_PIDS_PATH - SOLR_PIDS_PATH = ENV["SOLR_PIDS_PATH"] || "#{RAILS_ROOT}/tmp/pids" + SOLR_PIDS_PATH = ENV["SOLR_PIDS_PATH"] || "#{Rails.root}/tmp/pids" end unless defined? SOLR_DATA_PATH - SOLR_DATA_PATH = ENV["SOLR_DATA_PATH"] || "#{RAILS_ROOT}/solr/#{ENV['RAILS_ENV']}" + SOLR_DATA_PATH = ENV["SOLR_DATA_PATH"] || "#{Rails.root}/solr/#{ENV['RAILS_ENV']}" end unless defined? SOLR_CONFIG_PATH SOLR_CONFIG_PATH = ENV["SOLR_CONFIG_PATH"] || "#{SOLR_PATH}/solr" @@ -31,7 +31,7 @@ unless defined? SOLR_PID_FILE end unless defined? SOLR_PORT - config = YAML::load_file(RAILS_ROOT+'/config/solr.yml') + config = YAML::load_file(Rails.root+'/config/solr.yml') raise("No solr environment defined for RAILS_ENV = #{ENV['RAILS_ENV'].inspect}") unless config[ENV['RAILS_ENV']] SOLR_HOST = ENV['HOST'] || URI.parse(config[ENV['RAILS_ENV']]['url']).host diff --git a/vendor/plugins/acts_as_solr_reloaded/lib/tasks/database.rake b/vendor/plugins/acts_as_solr_reloaded/lib/tasks/database.rake index ea63419..e41942f 100644 --- a/vendor/plugins/acts_as_solr_reloaded/lib/tasks/database.rake +++ b/vendor/plugins/acts_as_solr_reloaded/lib/tasks/database.rake @@ -5,7 +5,7 @@ namespace :db do begin ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => "*:*")) ActsAsSolr::Post.execute(Solr::Request::Commit.new) - (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.{yml,csv}'))).each do |fixture_file| + (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(Rails.root, 'test', 'fixtures', '*.{yml,csv}'))).each do |fixture_file| ActsAsSolr::SolrFixtures.load(File.basename(fixture_file, '.*')) end puts "The fixtures loaded have been added to Solr" diff --git a/vendor/plugins/acts_as_solr_reloaded/lib/tasks/solr.rake b/vendor/plugins/acts_as_solr_reloaded/lib/tasks/solr.rake index 22a3811..8bc94c2 100644 --- a/vendor/plugins/acts_as_solr_reloaded/lib/tasks/solr.rake +++ b/vendor/plugins/acts_as_solr_reloaded/lib/tasks/solr.rake @@ -158,7 +158,7 @@ namespace :solr do logger = ActiveRecord::Base.logger = Logger.new(STDOUT) logger.level = ActiveSupport::BufferedLogger::INFO unless debug_output - Dir["#{RAILS_ROOT}/app/models/*.rb"].each{ |file| require file } + Dir["#{Rails.root}/app/models/*.rb"].each{ |file| require file } if start_server puts "Starting Solr server..." diff --git a/vendor/plugins/acts_as_solr_reloaded/solr_test_rakefile.rb b/vendor/plugins/acts_as_solr_reloaded/solr_test_rakefile.rb index 8f711f5..497da99 100644 --- a/vendor/plugins/acts_as_solr_reloaded/solr_test_rakefile.rb +++ b/vendor/plugins/acts_as_solr_reloaded/solr_test_rakefile.rb @@ -2,5 +2,5 @@ require 'rubygems' require 'rake' dir = File.dirname(__FILE__) $:.unshift("#{dir}/lib") -RAILS_ROOT = dir +Rails.root = dir require "acts_as_solr/tasks" diff --git a/vendor/plugins/acts_as_solr_reloaded/test/test_helper.rb b/vendor/plugins/acts_as_solr_reloaded/test/test_helper.rb index 66be519..90929a0 100644 --- a/vendor/plugins/acts_as_solr_reloaded/test/test_helper.rb +++ b/vendor/plugins/acts_as_solr_reloaded/test/test_helper.rb @@ -16,7 +16,7 @@ require 'mongo_mapper' class Rails def self.root - RAILS_ROOT + Rails.root end def self.env @@ -26,7 +26,7 @@ end MongoMapper.database = "acts_as_solr_reloaded-test" -RAILS_ROOT = File.dirname(__FILE__) unless defined? RAILS_ROOT +Rails.root = File.dirname(__FILE__) unless defined? Rails.root RAILS_ENV = 'test' unless defined? RAILS_ENV ENV["RAILS_ENV"] = "test" diff --git a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb index ed7cd39..19fca35 100644 --- a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb +++ b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb @@ -1,7 +1,7 @@ module Technoweenie # :nodoc: module AttachmentFu # :nodoc: @@default_processors = %w(ImageScience Rmagick MiniMagick Gd2 CoreImage) - @@tempfile_path = File.join(RAILS_ROOT, 'tmp', 'attachment_fu') + @@tempfile_path = File.join(Rails.root, 'tmp', 'attachment_fu') @@content_types = ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg'] mattr_reader :content_types, :tempfile_path, :default_processors mattr_writer :tempfile_path diff --git a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb index a714a86..e63d1e7 100644 --- a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb +++ b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb @@ -12,18 +12,18 @@ module Technoweenie # :nodoc: # # # This assumes a model name like MyModel # # public/#{table_name} is the default filesystem path - # RAILS_ROOT/public/my_models/5/blah.jpg + # Rails.root/public/my_models/5/blah.jpg # # Overwrite this method in your model to customize the filename. # The optional thumbnail argument will output the thumbnail's filename. def full_filename(thumbnail = nil) file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix].to_s - File.join(RAILS_ROOT, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail))) + File.join(Rails.root, file_system_path, *partitioned_path(thumbnail_name_for(thumbnail))) end # Used as the base path that #public_filename strips off full_filename to create the public path def base_path - @base_path ||= File.join(RAILS_ROOT, 'public') + @base_path ||= File.join(Rails.root, 'public') end # The attachment ID used in the full path of a file diff --git a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb index 2c2be13..effd886 100644 --- a/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb +++ b/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb @@ -12,12 +12,12 @@ module Technoweenie # :nodoc: # # == Configuration # - # Configuration is done via RAILS_ROOT/config/amazon_s3.yml and is loaded according to the RAILS_ENV. + # Configuration is done via Rails.root/config/amazon_s3.yml and is loaded according to the RAILS_ENV. # The minimum connection options that you must specify are a bucket name, your access key id and your secret access key. # If you don't already have your access keys, all you need to sign up for the S3 service is an account at Amazon. # You can sign up for S3 and get access keys by visiting http://aws.amazon.com/s3. # - # Example configuration (RAILS_ROOT/config/amazon_s3.yml) + # Example configuration (Rails.root/config/amazon_s3.yml) # # development: # bucket_name: appname_development @@ -36,7 +36,7 @@ module Technoweenie # :nodoc: # # You can change the location of the config path by passing a full path to the :s3_config_path option. # - # has_attachment :storage => :s3, :s3_config_path => (RAILS_ROOT + '/config/s3.yml') + # has_attachment :storage => :s3, :s3_config_path => (Rails.root + '/config/s3.yml') # # === Required configuration parameters # @@ -132,7 +132,7 @@ module Technoweenie # :nodoc: end begin - @@s3_config_path = base.attachment_options[:s3_config_path] || (RAILS_ROOT + '/config/amazon_s3.yml') + @@s3_config_path = base.attachment_options[:s3_config_path] || (Rails.root + '/config/amazon_s3.yml') @@s3_config = @@s3_config = YAML.load(ERB.new(File.read(@@s3_config_path)).result)[RAILS_ENV].symbolize_keys #rescue # raise ConfigFileNotFoundError.new('File %s not found' % @@s3_config_path) @@ -203,7 +203,7 @@ module Technoweenie # :nodoc: # # The resulting url is in the form: http(s)://:server/:bucket_name/:table_name/:id/:file where # the :server variable defaults to AWS::S3 URL::DEFAULT_HOST (s3.amazonaws.com) and can be - # set using the configuration parameters in RAILS_ROOT/config/amazon_s3.yml. + # set using the configuration parameters in Rails.root/config/amazon_s3.yml. # # The optional thumbnail argument will output the thumbnail's filename (if any). def s3_url(thumbnail = nil) diff --git a/vendor/plugins/attachment_fu/test/test_helper.rb b/vendor/plugins/attachment_fu/test/test_helper.rb index ccd53e5..c3bbab9 100644 --- a/vendor/plugins/attachment_fu/test/test_helper.rb +++ b/vendor/plugins/attachment_fu/test/test_helper.rb @@ -1,10 +1,10 @@ $:.unshift(File.dirname(__FILE__) + '/../lib') ENV['RAILS_ENV'] = 'test' -ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..' +ENV['Rails.root'] ||= File.dirname(__FILE__) + '/../../../..' require 'test/unit' -require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb')) +require File.expand_path(File.join(ENV['Rails.root'], 'config/environment.rb')) require 'active_record/fixtures' require 'action_controller/test_process' diff --git a/vendor/plugins/nested_has_many_through/spec/spec_helper.rb b/vendor/plugins/nested_has_many_through/spec/spec_helper.rb index 8e21f5b..6ef8611 100644 --- a/vendor/plugins/nested_has_many_through/spec/spec_helper.rb +++ b/vendor/plugins/nested_has_many_through/spec/spec_helper.rb @@ -7,7 +7,7 @@ require 'spec/rails' Spec::Runner.configure do |config| config.use_transactional_fixtures = true config.use_instantiated_fixtures = false - config.fixture_path = RAILS_ROOT + '/spec/fixtures' + config.fixture_path = Rails.root + '/spec/fixtures' # You can declare fixtures for each behaviour like this: # describe "...." do -- libgit2 0.21.2