about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-04-23 19:05:09 -0700
committerEric Wong <normalperson@yhbt.net>2009-04-23 19:08:07 -0700
commit900a69f585be24dbf3a6885eecbd2aec7f839400 (patch)
tree8960a647c49423d30ab88400d065fd341b1d1d58 /bin
parent5eed9d4e3ec219740034ba243eb72d96ff8c82b4 (diff)
downloadunicorn-900a69f585be24dbf3a6885eecbd2aec7f839400.tar.gz
I've experienced occasional problems with this so it's
probably best to stay on the safe side.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/unicorn_rails13
1 files changed, 4 insertions, 9 deletions
diff --git a/bin/unicorn_rails b/bin/unicorn_rails
index 083e9d8..b3fda7b 100755
--- a/bin/unicorn_rails
+++ b/bin/unicorn_rails
@@ -114,10 +114,9 @@ end
 
 require 'pp' if $DEBUG
 
-# Loads Rails and the private version of Rack it bundles. Returns a
-# lambda of arity==0 that will return *another* lambda of arity==1
-# suitable for using inside Rack::Builder.new block.
-rails_loader = lambda do ||
+# 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.
   begin
     require 'config/boot'
   rescue LoadError => err
@@ -128,7 +127,7 @@ rails_loader = lambda do ||
   defined?(::Rails::VERSION::STRING) or
     abort "Rails::VERSION::STRING not defined by config/boot"
 
-  case config
+  inner_app = case config
   when nil
     require 'config/environment'
 
@@ -154,12 +153,8 @@ rails_loader = lambda do ||
     require config
     Object.const_get(File.basename(config, '.rb').capitalize)
   end
-end
 
-# this won't run until after forking if preload_app is false
-app = lambda do ||
   map_path ||= '/'
-  inner_app = rails_loader.call
   Rack::Builder.new do
     if inner_app.class.to_s == "Unicorn::App::OldRails"
       if map_path != '/'