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