From 29661ccaaa03ab07f4de0d5c38f730f1d557b418 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 24 Feb 2010 15:35:42 -0800 Subject: unicorn_rails: make this Rails 3-compatible The stock config/boot.rb file in a Rails 3 app is much lighter and does not export any Rails/RAILS_* constants, so we'll wait until we get config/environment.rb loaded. --- bin/unicorn_rails | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/unicorn_rails b/bin/unicorn_rails index b1458fc..8a7c21a 100755 --- a/bin/unicorn_rails +++ b/bin/unicorn_rails @@ -122,21 +122,19 @@ require 'pp' if $DEBUG # this won't run until after forking if preload_app is false app = lambda do || - # Load Rails and the private version of Rack it bundles. + # Load Rails and (possibly) the private version of Rack it bundles. begin require 'config/boot' rescue LoadError => err abort "#$0 must be run inside RAILS_ROOT: #{err.inspect}" end - defined?(::RAILS_ROOT) or abort "RAILS_ROOT not defined by config/boot" - defined?(::RAILS_ENV) or abort "RAILS_ENV not defined by config/boot" - defined?(::Rails::VERSION::STRING) or - abort "Rails::VERSION::STRING not defined by config/boot" inner_app = case config when nil require 'config/environment' + defined?(::Rails::VERSION::STRING) or + abort "Rails::VERSION::STRING not defined by config/{boot,environment}" # it seems Rails >=2.2 support Rack, but only >=2.3 requires it old_rails = case ::Rails::VERSION::MAJOR when 0, 1 then true -- cgit v1.2.3-24-ge0c7