Permalink
Browse files

Replacing RAILS_ROOT with Rails.root and RAILS_ENV with Rails.env

  • Loading branch information...
1 parent 43ca38f commit 0c40a0837c5aaff97708d2cc3e79d6d94f42ffcd @oleander oleander committed Jan 26, 2012
Showing with 138 additions and 131 deletions.
  1. +4 −4 README
  2. +7 −0 README.md
  3. +2 −2 Rakefile
  4. +2 −2 app/controllers/application_controller.rb
  5. +3 −3 app/models/repository.rb
  6. +2 −2 app/processors/application.rb
  7. +1 −1 config/initializers/gitorious_config.rb
  8. +1 −1 config/initializers/rack_patch.rb
  9. +2 −2 config/ultrasphinx/default.base
  10. +2 −2 data/hooks/messaging.rb
  11. +1 −1 data/hooks/rails_env.rb
  12. +4 −4 doc/recipes/install-centos.txt
  13. +4 −4 doc/recipes/install-ubuntu.sh
  14. +4 −4 doc/recipes/install-ubuntu.txt
  15. +4 −4 doc/templates/centos/git-ultrasphinx
  16. +4 −4 doc/templates/ubuntu/git-ultrasphinx
  17. +1 −1 lib/gitorious/reservations.rb
  18. +1 −1 public/dispatch.cgi
  19. +1 −1 public/dispatch.fcgi
  20. +1 −1 public/dispatch.rb
  21. +1 −1 script/create_wikis
  22. +1 −1 script/destroy_invalid_events
  23. +1 −1 script/fixup_hooks
  24. +5 −5 script/git-daemon
  25. +2 −2 script/gitorious
  26. +1 −1 script/rebuild_events
  27. +1 −1 script/shard_git_repositories_by_hash
  28. +4 −4 script/spec_server
  29. +2 −2 test/test_helper.rb
  30. +1 −1 test/unit/cloner_test.rb
  31. +1 −1 test/unit/helpers/blobs_helper_test.rb
  32. +1 −1 test/unit/repository_test.rb
  33. +2 −2 vendor/factory_girl/lib/factory_girl.rb
  34. +2 −2 vendor/plugins/activemessaging/forwarding_poller.rb
  35. +4 −4 vendor/plugins/activemessaging/generators/processor/templates/jruby_poller
  36. +1 −1 vendor/plugins/activemessaging/generators/tracer/templates/trace_processor.rb
  37. +8 −8 vendor/plugins/activemessaging/lib/activemessaging.rb
  38. +3 −3 vendor/plugins/activemessaging/lib/activemessaging/gateway.rb
  39. +1 −1 vendor/plugins/activemessaging/lib/activemessaging/support.rb
  40. +2 −2 vendor/plugins/activemessaging/poller.rb
  41. +1 −1 vendor/plugins/activemessaging/test/test_helper.rb
  42. +1 −1 vendor/plugins/exception_notification/README
  43. +2 −2 vendor/plugins/exception_notification/lib/exception_notifiable.rb
  44. +2 −2 vendor/plugins/exception_notification/lib/exception_notifier.rb
  45. +1 −1 vendor/plugins/exception_notification/lib/exception_notifier_helper.rb
  46. +1 −1 vendor/plugins/exception_notification/test/test_helper.rb
  47. +1 −1 vendor/plugins/localized_dates/init.rb
  48. +1 −1 vendor/plugins/localized_dates/install.rb
  49. +1 −1 vendor/plugins/localized_dates/lib/tasks/localized_dates.rake
  50. +1 −1 vendor/plugins/open_id_authentication/README
  51. +1 −1 vendor/plugins/open_id_authentication/lib/open_id_authentication.rb
  52. +1 −1 vendor/plugins/open_id_authentication/test/test_helper.rb
  53. +4 −4 vendor/plugins/ultrasphinx/DEPLOYMENT_NOTES
  54. +2 −2 vendor/plugins/ultrasphinx/README
  55. +1 −1 vendor/plugins/ultrasphinx/examples/default.base
  56. +10 −10 vendor/plugins/ultrasphinx/generators/ultrasphinx_migration/templates/migration.rb
  57. +1 −1 vendor/plugins/ultrasphinx/lib/tasks/ultrasphinx.rake
  58. +1 −1 vendor/plugins/ultrasphinx/lib/ultrasphinx.rb
  59. +3 −3 vendor/plugins/ultrasphinx/lib/ultrasphinx/configure.rb
  60. +1 −1 vendor/plugins/ultrasphinx/lib/ultrasphinx/search.rb
  61. +1 −1 vendor/plugins/ultrasphinx/lib/ultrasphinx/search/internals.rb
  62. +5 −5 vendor/plugins/ultrasphinx/lib/ultrasphinx/ultrasphinx.rb
View
8 README
@@ -178,7 +178,7 @@ that the code is working as intended.
There is at the time being one gem that's required to run the tests, so start
out with
- [sudo] rake gems:install RAILS_ENV=test
+ [sudo] rake gems:install Rails.env=test
to make sure the test specific gems are installed. Then run the entire test
suite:
@@ -227,9 +227,9 @@ information about how to set this up.
Get Sphinx going
================
- $ env RAILS_ENV=production rake ultrasphinx:configure
- $ env RAILS_ENV=production rake ultrasphinx:index
- $ env RAILS_ENV=production rake ultrasphinx:daemon:start
+ $ env Rails.env=production rake ultrasphinx:configure
+ $ env Rails.env=production rake ultrasphinx:index
+ $ env Rails.env=production rake ultrasphinx:daemon:start
This sequence of commands will configure, index the database and start the
sphinx daemon
View
@@ -0,0 +1,7 @@
+# Gitorious soon Water
+
+## Installation
+
+1. Add your database credentials under `config/database.yml` section `development`
+2. Install all dependencies using `bundle install`
+3. Create an empty database `bundle exec rake db:create:all`
View
@@ -5,6 +5,6 @@ require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
-require 'rake/rdoctask'
+require "rdoc/task"
-Rails::Application.load_tasks
+Gitorious::Application.load_tasks
@@ -39,7 +39,7 @@ class ApplicationController < ActionController::Base
rescue_from RecordThrottling::LimitReachedError, :with => :render_throttled_record
def rescue_action(exception)
- return super if RAILS_ENV != "production"
+ return super if Rails.env != "production"
case exception
# Can't catch RoutingError with rescue_from it seems,
@@ -179,7 +179,7 @@ def check_repository_for_commits
end
def render_not_found
- render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
+ render :file => "#{Rails.root}/public/404.html", :status => 404
end
def render_git_timeout
View
@@ -251,11 +251,11 @@ def has_commits?
end
def self.git_backend
- RAILS_ENV == "test" ? MockGitBackend : GitBackend
+ Rails.env == "test" ? MockGitBackend : GitBackend
end
def git_backend
- RAILS_ENV == "test" ? MockGitBackend : GitBackend
+ Rails.env == "test" ? MockGitBackend : GitBackend
end
def to_param
@@ -776,7 +776,7 @@ def add_owner_as_watchers
def self.create_hooks(path)
hooks = File.join(GitoriousConfig["repository_base_path"], ".hooks")
Dir.chdir(path) do
- hooks_base_path = File.expand_path("#{RAILS_ROOT}/data/hooks")
+ hooks_base_path = File.expand_path("#{Rails.root}/data/hooks")
if not File.symlink?(hooks)
if not File.exist?(hooks)
@@ -19,11 +19,11 @@ class ApplicationProcessor < ActiveMessaging::Processor
def ActiveMessaging.logger
@@logger ||= begin
- io = RAILS_ENV == "development" ? STDOUT : File.join(RAILS_ROOT, "log", "message_processing.log")
+ io = Rails.env == "development" ? STDOUT : File.join(Rails.root, "log", "message_processing.log")
logger = ActiveSupport::BufferedLogger.new(io)
#logger.level = ActiveSupport::BufferedLogger.const_get(Rails.configuration.log_level.to_s.upcase)
logger.level = ActiveSupport::BufferedLogger::INFO
- if RAILS_ENV == "production"
+ if Rails.env == "production"
logger.auto_flushing = true
end
logger
@@ -1,4 +1,4 @@
-GitoriousConfig = c = YAML::load_file(File.join(Rails.root,"config/gitorious.yml"))[RAILS_ENV]
+GitoriousConfig = c = YAML::load_file(File.join(Rails.root,"config/gitorious.yml"))[Rails.env]
# make the default be publicly open
GitoriousConfig['public_mode'] = true if GitoriousConfig['public_mode'].nil?
@@ -10,7 +10,7 @@
# If this happens to you, please verify that the code is in fact correct
if RUBY_VERSION >= '1.9'
if Rack.version > '1.0'
- raise "Gitorious bundles a patch to Rack which has not been tested on Rack after version 1.0. Please consult RAILS_ROOT/config/intitalizers/rack_patch.rb and verify if the patch is needed"
+ raise "Gitorious bundles a patch to Rack which has not been tested on Rack after version 1.0. Please consult Rails.root/config/intitalizers/rack_patch.rb and verify if the patch is needed"
end
require 'rack_multipart_patch'
end
@@ -2,7 +2,7 @@
#
# Sphinx/Ultrasphinx user-configurable options.
#
-# Copy this file to RAILS_ROOT/config/ultrasphinx. You can use individual
+# Copy this file to Rails.root/config/ultrasphinx. You can use individual
# namespaces if you want (e.g. development.base, production.base,
# test.base). Note that ERb is also allowed.
#
@@ -18,7 +18,7 @@
# .conf files. Do not symlink the .conf file to the .base file; it's wrong.
#
-<% path = "#{RAILS_ROOT}/db/sphinx/" %>
+<% path = "#{Rails.root}/db/sphinx/" %>
# Indexing options
indexer
View
@@ -22,7 +22,7 @@
print "=> Syncing Gitorious... "
-RAILS_ENV = 'production'
+Rails.env = 'production'
class Publisher
def connect
@@ -32,7 +32,7 @@ def connect
end
def stomp_server_and_port
- gitorious_yaml = YAML::load_file(File.join(File.dirname(__FILE__), "..", "..", "config", "gitorious.yml"))[RAILS_ENV]
+ gitorious_yaml = YAML::load_file(File.join(File.dirname(__FILE__), "..", "..", "config", "gitorious.yml"))[Rails.env]
server = gitorious_yaml['stomp_server_address'] || 'localhost'
host = (gitorious_yaml['stomp_server_port'] || '61613').to_i
return [server, host]
View
@@ -4,6 +4,6 @@
print "=> Syncing Gitorious... "
$stdout.flush
-ENV["RAILS_ENV"] ||= "production"
+ENV["Rails.env"] ||= "production"
require File.join(app_root,"/config/environment")
@@ -192,9 +192,9 @@ cp config/gitorious.sample.yml config/gitorious.yml
7.4 Final Website Setup
cd /var/www/gitorious
-rake db:create RAILS_ENV=production
-rake db:migrate RAILS_ENV=production
-rake ultrasphinx:bootstrap RAILS_ENV=production
+rake db:create Rails.env=production
+rake db:migrate Rails.env=production
+rake ultrasphinx:bootstrap Rails.env=production
7.5 Setup CronJobs
@@ -203,7 +203,7 @@ rake ultrasphinx:bootstrap RAILS_ENV=production
- copy and paste the following 2 lines:
*/2 * * * * /opt/ruby-enterprise/bin/ruby /var/www/gitorious/script/task_performer
-* */1 * * * cd /var/www/gitorious && /opt/ruby-enterprise/bin/rake ultrasphinx:index RAILS_ENV=production
+* */1 * * * cd /var/www/gitorious && /opt/ruby-enterprise/bin/rake ultrasphinx:index Rails.env=production
8.1 Append to /home/git/.bash_profile [*]
@@ -161,13 +161,13 @@ su - git -c "echo 'export RUBY_HOME=/opt/ruby-enterprise' >> ~/.bash_profile"
su - git -c "echo 'export GEM_HOME=\$RUBY_HOME/lib/ruby/gems/1.8/gems' >> ~/.bash_profile"
su - git -c "echo 'export PATH=\$RUBY_HOME/bin:\$PATH' >> ~/.bash_profile"
-su - git -c "cd /var/www/gitorious && rake db:create RAILS_ENV=production"
-su - git -c "cd /var/www/gitorious && rake db:migrate RAILS_ENV=production"
-su - git -c "cd /var/www/gitorious && rake ultrasphinx:bootstrap RAILS_ENV=production"
+su - git -c "cd /var/www/gitorious && rake db:create Rails.env=production"
+su - git -c "cd /var/www/gitorious && rake db:migrate Rails.env=production"
+su - git -c "cd /var/www/gitorious && rake ultrasphinx:bootstrap Rails.env=production"
rm ~/tmp/crontab && touch ~/tmp/crontab
echo "*/2 * * * * /opt/ruby-enterprise/bin/ruby /var/www/gitorious/script/task_performer" >> ~/tmp/crontab
-echo "* */1 * * * cd /var/www/gitorious && /opt/ruby-enterprise/bin/rake ultrasphinx:index RAILS_ENV=production" >> ~/tmp/crontab
+echo "* */1 * * * cd /var/www/gitorious && /opt/ruby-enterprise/bin/rake ultrasphinx:index Rails.env=production" >> ~/tmp/crontab
mv ~/tmp/crontab /home/git
chown git:git /home/git/crontab
su - git -c "crontab -u git /home/git/crontab"
@@ -210,9 +210,9 @@ cp config/gitorious.sample.yml config/gitorious.yml
7.4 Final Website Setup
cd /var/www/gitorious
-rake db:create RAILS_ENV=production
-rake db:migrate RAILS_ENV=production
-rake ultrasphinx:bootstrap RAILS_ENV=production
+rake db:create Rails.env=production
+rake db:migrate Rails.env=production
+rake ultrasphinx:bootstrap Rails.env=production
7.5 Setup CronJobs
@@ -221,7 +221,7 @@ rake ultrasphinx:bootstrap RAILS_ENV=production
- copy and paste the following 2 lines:
*/2 * * * * /opt/ruby-enterprise/bin/ruby /var/www/gitorious/script/task_performer
-* */1 * * * cd /var/www/gitorious && /opt/ruby-enterprise/bin/rake ultrasphinx:index RAILS_ENV=production
+* */1 * * * cd /var/www/gitorious && /opt/ruby-enterprise/bin/rake ultrasphinx:index Rails.env=production
8.1 [UNKNOWN] Append to /home/git/.bash_profile
@@ -9,10 +9,10 @@
# pidfile: /var/www/gitorious/db/sphinx/log/searchd.pid
RETVAL=0
-START_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:start RAILS_ENV=production"
-STOP_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:stop RAILS_ENV=production"
-RESTART_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:restart RAILS_ENV=production"
-STATUS_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:status RAILS_ENV=production"
+START_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:start Rails.env=production"
+STOP_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:stop Rails.env=production"
+RESTART_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:restart Rails.env=production"
+STATUS_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:status Rails.env=production"
LOCK_FILE=/var/lock/git-ultrasphinx
PID_FILE=/var/www/gitorious/db/sphinx/log/searchd.pid
@@ -12,10 +12,10 @@
# Author: Fabio Akita <fabioakita@gmail.com>
RETVAL=0
-START_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:start RAILS_ENV=production"
-STOP_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:stop RAILS_ENV=production"
-RESTART_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:restart RAILS_ENV=production"
-STATUS_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:status RAILS_ENV=production"
+START_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:start Rails.env=production"
+STOP_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:stop Rails.env=production"
+RESTART_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:restart Rails.env=production"
+STATUS_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:status Rails.env=production"
LOCK_FILE=/var/lock/git-ultrasphinx
PID_FILE=/var/www/gitorious/db/sphinx/log/searchd.pid
@@ -25,7 +25,7 @@ def unaccounted_root_names
end
def reserved_root_names
- @reserved_root_names ||= unaccounted_root_names + Dir[File.join(RAILS_ROOT, "public", "*")].map{|f| File.basename(f) }
+ @reserved_root_names ||= unaccounted_root_names + Dir[File.join(Rails.root, "public", "*")].map{|f| File.basename(f) }
end
def controller_names
View
@@ -1,6 +1,6 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
-require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
+require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails.root)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
View
@@ -4,7 +4,7 @@
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
-# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
+# By default, the FastCGI crash log is Rails.root/log/fastcgi.crash.log
# and the GC period is nil (turned off). A reasonable number of requests
# could range from 10-100 depending on the memory footprint of your app.
#
View
@@ -1,6 +1,6 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
-require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
+require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails.root)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
View
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby -KU
ENV["PATH"] = "/usr/local/bin/:/opt/local/bin:#{ENV["PATH"]}"
-ENV["RAILS_ENV"] ||= "production"
+ENV["Rails.env"] ||= "production"
require File.dirname(__FILE__) + "/../config/environment"
action = ARGV[0]
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
-ENV["RAILS_ENV"] ||= "production"
+ENV["Rails.env"] ||= "production"
require File.dirname(__FILE__)+'/../config/environment'
Event.find(:all).each do |event|
View
@@ -11,7 +11,7 @@ if File.exist?(LOCK_FILE_PATH)
exit(1)
end
-ENV["RAILS_ENV"] ||= "production"
+ENV["Rails.env"] ||= "production"
require File.dirname(__FILE__) + "/../config/environment"
View
@@ -7,7 +7,7 @@ require 'socket'
require 'fcntl'
require "optparse"
-ENV["RAILS_ENV"] ||= "production"
+ENV["Rails.env"] ||= "production"
require File.dirname(__FILE__)+'/../config/environment'
Rails.configuration.log_level = :info # Disable debug
@@ -123,7 +123,7 @@ module Git
if ip_family == "AF_INET6"
repository.cloned_from(ip)
else
- geoip = GeoIP.new(File.join(RAILS_ROOT, "data", "GeoIP.dat"))
+ geoip = GeoIP.new(File.join(Rails.root, "data", "GeoIP.dat"))
localization = geoip.country(ip)
geoip.close
repository.cloned_from(ip, localization[3], localization[5], 'git')
@@ -263,8 +263,8 @@ end
options = {
:port => 9418,
:host => "0.0.0.0",
- :logfile => File.join(RAILS_ROOT, "log", "git-daemon.log"),
- :pidfile => File.join(RAILS_ROOT, "log", "git-daemon.pid"),
+ :logfile => File.join(Rails.root, "log", "git-daemon.log"),
+ :pidfile => File.join(Rails.root, "log", "git-daemon.pid"),
:daemonize => false,
:reuseaddr => true,
:disable_geoip => false,
@@ -306,7 +306,7 @@ OptionParser.new do |opts|
exit
end
- # opts.on("-e", "--environment", "RAILS_ENV to use") do |o|
+ # opts.on("-e", "--environment", "Rails.env to use") do |o|
# options[:port] = o
# end
end.parse!
View
@@ -13,9 +13,9 @@ end
#$DEBUG=true
-RAILS_ENV = ENV['RAILS_ENV'] ||= 'production'
+Rails.env = ENV['Rails.env'] ||= 'production'
-GitoriousConfig = YAML::load_file(conf_file)[RAILS_ENV]
+GitoriousConfig = YAML::load_file(conf_file)[Rails.env]
ENV["PATH"] = "/usr/local/bin/:/opt/local/bin:#{ENV["PATH"]}"
View
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby -KU
ENV["PATH"] = "/usr/local/bin/:/opt/local/bin:#{ENV["PATH"]}"
-ENV["RAILS_ENV"] ||= "production"
+ENV["Rails.env"] ||= "production"
require File.dirname(__FILE__) + "/../config/environment"
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby -KU
ENV["PATH"] = "/usr/local/bin/:/opt/local/bin:#{ENV["PATH"]}"
-ENV["RAILS_ENV"] ||= "production"
+ENV["Rails.env"] ||= "production"
require File.dirname(__FILE__) + "/../config/environment"
require "pp"
require "fileutils"
Oops, something went wrong.

0 comments on commit 0c40a08

Please sign in to comment.