diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-02-24 15:04:15 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-02-24 15:24:54 -0800 |
commit | a5064bc0bb549ca60e3e4d5f1a912bafa46c7f5f (patch) | |
tree | b6e074a3e4104de4b4cf45b8579414692ee7c547 /bin/rainbows | |
parent | ecdc78d04e874f64bfea1b787aa8f3d469df8e79 (diff) | |
download | rainbows-a5064bc0bb549ca60e3e4d5f1a912bafa46c7f5f.tar.gz |
The Unicorn.builder helper will help us avoid namespace conflicts inside config.ru, allowing us to pass tests. While we're at it, port some tests over from the latest unicorn.git for dealing with bad configs.
Diffstat (limited to 'bin/rainbows')
-rw-r--r-- | bin/rainbows | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/bin/rainbows b/bin/rainbows index 77059ef..ba7ee7f 100644 --- a/bin/rainbows +++ b/bin/rainbows @@ -122,37 +122,7 @@ end require 'pp' if $DEBUG -app = lambda do || - # require Rack as late as possible in case $LOAD_PATH is modified - # in config.ru or command-line - inner_app = case config - when /\.ru$/ - raw = File.open(config, "rb") { |fp| fp.sysread(fp.stat.size) } - raw.sub!(/^__END__\n.*/, '') - eval("Rack::Builder.new {(#{raw}\n)}.to_app", nil, config) - else - require config - Object.const_get(File.basename(config, '.rb').capitalize) - end - pp({ :inner_app => inner_app }) if $DEBUG - case ENV["RACK_ENV"] - when "development" - Rack::Builder.new do - use Rack::CommonLogger, $stderr - use Rack::ShowExceptions - use Rack::Lint - run inner_app - end.to_app - when "deployment" - Rack::Builder.new do - use Rack::CommonLogger, $stderr - run inner_app - end.to_app - else - inner_app - end -end - +app = Unicorn.builder(config) listeners << "#{host}:#{port}" if set_listener if $DEBUG @@ -163,5 +133,5 @@ if $DEBUG }) end -Unicorn::Launcher.daemonize! if daemonize +Unicorn::Launcher.daemonize!(options) if daemonize Rainbows.run(app, options) |