Skip to content

Commit

Permalink
changed RAILS_ENV to Rails.env in most spots
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Youch committed Mar 17, 2011
1 parent f0ab8ff commit e37082b
Show file tree
Hide file tree
Showing 70 changed files with 245 additions and 391 deletions.
28 changes: 11 additions & 17 deletions Gemfile
Expand Up @@ -17,30 +17,24 @@ gem 'net-ssh', :require => 'net/ssh'
gem 'rmagick', :require => 'RMagick'
gem 'libxml-ruby', :require => 'xml'
gem 'soap4r', :require => 'soap/soap'
gem 'json'
gem 'json', '~> 1.4.6'
gem 'SystemTimer', :require => 'system_timer'
gem 'memcache-client', :require => 'memcache'
gem 'resthome'
gem "nokogiri"

group :test do
# gem "cucumber", "0.6.2"
# gem "rspec", "1.3.0"
# gem "rspec-rails", "1.3.2"
gem "database_cleaner", '0.4.3'
gem "factory_girl"
gem "webrat", "0.6.0"
# gem "cucumber-rails", "0.2.4"
group :development, :test, :spec, :cucumber, :selenium do
gem 'rspec-rails'
gem 'cucumber-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'factory_girl_rails'
gem 'jquery-rails'
gem 'rails_code_qa'
gem 'hpricot'
gem 'fakeweb'
end

group :selenium do
# gem 'cucumber-rails', '0.2.4'
gem 'database_cleaner', '0.4.3'
gem 'webrat', '0.6.0'
# gem 'rspec', '1.3.0'
# gem 'rspec-rails', '1.3.2'
gem 'selenium-client', '1.2.18'



end
92 changes: 82 additions & 10 deletions Gemfile.lock
Expand Up @@ -33,19 +33,59 @@ GEM
activesupport (3.0.5)
arel (2.0.9)
builder (2.1.2)
capybara (0.4.1.2)
celerity (>= 0.7.9)
culerity (>= 0.2.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.27)
xpath (~> 0.1.3)
celerity (0.8.8)
childprocess (0.1.7)
ffi (~> 0.6.3)
crack (0.1.8)
cucumber (0.10.0)
builder (>= 2.1.2)
diff-lcs (~> 1.1.2)
gherkin (~> 2.3.2)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
cucumber-rails (0.3.2)
cucumber (>= 0.8.0)
culerity (0.2.15)
daemons (1.1.0)
database_cleaner (0.4.3)
database_cleaner (0.6.6)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
factory_girl (1.3.3)
factory_girl_rails (1.0.1)
factory_girl (~> 1.3)
railties (>= 3.0.0)
fakeweb (1.3.0)
ffi (0.6.3)
rake (>= 0.8.7)
flay (1.4.1)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
flog (2.5.0)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
gherkin (2.3.4)
json (~> 1.4.6)
gruff (0.3.6)
hpricot (0.8.4)
httparty (0.7.4)
crack (= 0.1.8)
httpclient (2.1.6.1)
i18n (0.5.0)
json (1.5.1)
jquery-rails (0.2.7)
rails (~> 3.0)
thor (~> 0.14.4)
json (1.4.6)
json_pure (1.5.1)
libxml-ruby (1.1.4)
mail (2.2.15)
activesupport (>= 2.3.6)
Expand All @@ -58,7 +98,7 @@ GEM
mime-types (1.16)
mysql (2.8.1)
net-ssh (2.1.3)
nokogiri (1.3.1)
nokogiri (1.4.4)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.6.13)
Expand All @@ -74,27 +114,54 @@ GEM
activesupport (= 3.0.5)
bundler (~> 1.0)
railties (= 3.0.5)
rails_code_qa (0.4.1)
flay (= 1.4.1)
flog (= 2.5.0)
rcov (= 0.9.9)
railties (3.0.5)
actionpack (= 3.0.5)
activesupport (= 3.0.5)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
rcov (0.9.9)
resthome (0.8.0)
httparty
rmagick (2.13.1)
rspec (2.5.0)
rspec-core (~> 2.5.0)
rspec-expectations (~> 2.5.0)
rspec-mocks (~> 2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.5.0)
rspec-rails (2.5.0)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.5.0)
ruby_parser (2.0.6)
sexp_processor (~> 3.0)
rubyzip (0.9.4)
selenium-client (1.2.18)
selenium-webdriver (0.1.3)
childprocess (~> 0.1.5)
ffi (~> 0.6.3)
json_pure
rubyzip
sexp_processor (3.0.5)
slave (1.2.1)
soap4r (1.5.8)
httpclient (>= 2.1.1)
syntax (1.0.0)
term-ansicolor (1.0.5)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.25)
webrat (0.6.0)
nokogiri (>= 1.2.0)
rack (>= 1.0)
xpath (0.1.3)
nokogiri (~> 1.3)

PLATFORMS
ruby
Expand All @@ -103,12 +170,16 @@ DEPENDENCIES
BlueCloth
RedCloth
SystemTimer
capybara
cucumber-rails
daemons
database_cleaner (= 0.4.3)
factory_girl
database_cleaner
factory_girl_rails
fakeweb
gruff
hpricot
json
jquery-rails
json (~> 1.4.6)
libxml-ruby
maruku
memcache-client
Expand All @@ -118,9 +189,10 @@ DEPENDENCIES
nokogiri
radius
rails (= 3.0.5)
rails_code_qa
resthome
rmagick
rspec-rails
selenium-client (= 1.2.18)
slave
soap4r
webrat (= 0.6.0)
5 changes: 1 addition & 4 deletions Rakefile
Expand Up @@ -2,9 +2,6 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

Rails::Application.load_tasks
Webiva::Application.load_tasks
8 changes: 4 additions & 4 deletions app/controllers/application_controller.rb
Expand Up @@ -183,7 +183,7 @@ def activate_domain(domain=nil)

# Cancel out of domain activations
# if we are testing
if RAILS_ENV == 'test' || RAILS_ENV == 'cucumber' || RAILS_ENV == 'selenium'
if Rails.env == 'test' || Rails.env == 'cucumber' || Rails.env == 'selenium'
DomainModel.activate_domain(Domain.find(CMS_DEFAULTS['testing_domain']).get_info,'production',false)
return true
else
Expand Down Expand Up @@ -266,7 +266,7 @@ def set_language #:nodoc:
session[:cms_language] = params[:set_language]
end

Locale.set(session[:cms_language]) unless RAILS_ENV == 'test'
Locale.set(session[:cms_language]) unless Rails.env == 'test'

end

Expand Down Expand Up @@ -530,12 +530,12 @@ def send_domain_file(df, opts={})

def sanitize_backtrace(trace) # :nodoc:
re = Regexp.new(/^#{Regexp.escape(rails_root)}/)
trace.map { |line| Pathname.new(line.gsub(re, "[RAILS_ROOT]")).cleanpath.to_s }
trace.map { |line| Pathname.new(line.gsub(re, "[Rails.root]")).cleanpath.to_s }
end

def rails_root # :nodoc:
return @rails_root if @rails_root
@rails_root = Pathname.new(RAILS_ROOT).cleanpath.to_s
@rails_root = Pathname.new(Rails.root).cleanpath.to_s
end

end
2 changes: 1 addition & 1 deletion app/controllers/cms_controller.rb
Expand Up @@ -146,7 +146,7 @@ def self.content_action(action,url,options = {})
def self.get_content_models_and_actions # :nodoc:
content_models = []
content_actions = []
Dir.glob("#{RAILS_ROOT}/app/controllers/editor/[a-z0-9\-_]*_controller.rb") do |file|
Dir.glob("#{Rails.root}/app/controllers/editor/[a-z0-9\-_]*_controller.rb") do |file|
if file =~ /\/([a-z0-9\-_]+)_controller.rb$/
controller_name = $1
if controller_name != 'admin'
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/module_app_controller.rb
Expand Up @@ -79,7 +79,7 @@ def handle_page
end

# Handle the www issue
unless RAILS_ENV == 'test' || RAILS_ENV == 'cucumber' # Skip ssl and domain switches in test mode
unless Rails.env == 'test' || Rails.env == 'cucumber' # Skip ssl and domain switches in test mode
if DomainModel.active_domain[:www_prefix] != @www_prefix
dest_http = request.ssl? ? 'https://' : 'http://'

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/module_controller.rb
Expand Up @@ -13,7 +13,7 @@ class ModuleController < CmsController # :nodoc: all
protected

def validate_module
if !active_module(self.class.to_s.include?('AdminController')) && RAILS_ENV != 'test'
if !active_module(self.class.to_s.include?('AdminController')) && Rails.env != 'test'
redirect_to :controller => '/modules'
return false
else
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/page_controller.rb
Expand Up @@ -66,7 +66,7 @@ def cache_force #:nodoc:

public

if RAILS_ENV == 'test'
if Rails.env == 'test'
def set_test_renderer(rnd) #:nodoc:
@test_renderer = rnd
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/paragraph_controller.rb
Expand Up @@ -260,7 +260,7 @@ def self.get_editor_paragraphs #:nodoc:
# and the

paragraphs = []
Dir.glob("#{RAILS_ROOT}/app/controllers/editor/[a-z0-9\-_]*_controller.rb") do |file|
Dir.glob("#{Rails.root}/app/controllers/editor/[a-z0-9\-_]*_controller.rb") do |file|
if file =~ /\/([a-z0-9\-_]+)_controller.rb$/
controller_name = $1
if controller_name != 'admin'
Expand Down Expand Up @@ -292,7 +292,7 @@ def self.get_editor_controllers #:nodoc:1
# Find all the controllers in the 'editors' subdirectory,

controllers = []
Dir.glob("#{RAILS_ROOT}/app/controllers/editor/[a-z0-9\-_]*_controller.rb") do |file|
Dir.glob("#{Rails.root}/app/controllers/editor/[a-z0-9\-_]*_controller.rb") do |file|
if file =~ /\/([a-z0-9\-_]+)_controller.rb$/
controller_name = $1
cls = "Editor::#{controller_name.camelcase}Controller".constantize
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/paragraph_feature.rb
Expand Up @@ -1961,13 +1961,13 @@ def parse_feature(feature,context) #:nodoc:
begin
feature_parser.parse(feature.body_html || feature.body)
rescue Radius::MissingEndTagError => err
if RAILS_ENV!='production' || myself.editor?
if Rails.env!='production' || myself.editor?
"<div><b>#{'Feature Definition Contains an Error'.t}</b><br/>#{err.to_s.t}</div>"
else
""
end
rescue Radius::UndefinedTagError => err
if RAILS_ENV!='production' || myself.editor?
if Rails.env!='production' || myself.editor?
"<div><b>#{'Feature Definition Contains an Undefined tag:'.t}</b>#{err.to_s.t}</div>"
else
""
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/paragraph_renderer.rb
Expand Up @@ -405,7 +405,7 @@ def render_paragraph(args)
# data_paragraph :data => @file.image_data, :type => 'image/jpeg'
#
# # renders the specified file (the full path of the file must be specified
# data_paragraph :file => "#{RAILS_ROOT}/tmp/widgets/something.gif"
# data_paragraph :file => "#{Rails.root}/tmp/widgets/something.gif"
#
# # renders the specified domain file
# data_paragraph :domain_file => @domain_file
Expand Down Expand Up @@ -785,7 +785,7 @@ def self.get_editor_features #:nodoc:
# and the

feature_list = []
Dir.glob("#{RAILS_ROOT}/app/controllers/editor/[a-z0-9\-_]*_renderer.rb") do |file|
Dir.glob("#{Rails.root}/app/controllers/editor/[a-z0-9\-_]*_renderer.rb") do |file|
if file =~ /\/([a-z0-9\-_]+)_renderer.rb$/
renderer_name = $1
cls_name = "Editor::#{renderer_name.camelcase}Renderer"
Expand All @@ -796,7 +796,7 @@ def self.get_editor_features #:nodoc:
end
end
end
Dir.glob("#{RAILS_ROOT}/app/controllers/editor/[a-z0-9\-_]*_feature.rb") do |file|
Dir.glob("#{Rails.root}/app/controllers/editor/[a-z0-9\-_]*_feature.rb") do |file|
if file =~ /\/([a-z0-9\-_]+)_feature.rb$/
renderer_name = $1
cls_name = "Editor::#{renderer_name.camelcase}Feature"
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/public_controller.rb
Expand Up @@ -98,7 +98,7 @@ def image
return
end

render :nothing => true if RAILS_ENV == 'test'
render :nothing => true if Rails.env == 'test'
if USE_X_SEND_FILE
x_send_file(name,:type => mime_type,:disposition => 'inline',:filename => df.name)
else
Expand Down Expand Up @@ -174,7 +174,7 @@ def file_store
mime_type = @df.mime_type
end

render :nothing => true if RAILS_ENV == 'test'
render :nothing => true if Rails.env == 'test'

if USE_X_SEND_FILE
x_send_file(abs_name,:type => mime_type,:disposition => 'inline',:filename => @df.name)
Expand All @@ -200,7 +200,7 @@ def file_version(params)
return redirect_to version.url if df.processor != 'local'
return render(:inline => 'File not found', :status => 404) unless version.copy_local!

render :nothing => true if RAILS_ENV == 'test'
render :nothing => true if Rails.env == 'test'

name = version.filename
if df.mime_type.blank?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/transmit_file_controller.rb
Expand Up @@ -40,7 +40,7 @@ def file_version
def delete
key = params[:path][1]
DomainFile::LocalProcessor.get_directories_to_delete(key).each do |dir|
dir = "#{RAILS_ROOT}/public" + dir
dir = "#{Rails.root}/public" + dir
FileUtils.rm_rf(dir) if File.directory?(dir)
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/content_model_type.rb
Expand Up @@ -44,7 +44,7 @@ def self.human_name
end

def self.subclasses
@@subclasses[self] = []
@@subclasses = []
end

def self.human_attribute_name(attribute)
Expand Down
2 changes: 1 addition & 1 deletion app/models/content_node.rb
Expand Up @@ -229,7 +229,7 @@ def self.search(language,query,options = { })
begin
handler_info[:class].search(language,query,options)
rescue Exception => e
raise e unless RAILS_ENV == 'production'
raise e unless Rails.env == 'production'
return internal_search(language,query,options)
end
else
Expand Down

0 comments on commit e37082b

Please sign in to comment.