diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-02-28 19:20:11 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-02-28 19:20:11 -0800 |
commit | a4a8bf7604d1c15c5a8fb9cb6be37e8bccb32e52 (patch) | |
tree | 56486ea2e59414f4a4e97109309ed69e7dec7cdb /lib/unicorn.rb | |
parent | 947b8e5d312446b63a7dbd5be51a1bebf421cea8 (diff) | |
download | unicorn-a4a8bf7604d1c15c5a8fb9cb6be37e8bccb32e52.tar.gz |
Do not assume the user wants config.ru to be Encoding::BINARY for 1.9.
Diffstat (limited to 'lib/unicorn.rb')
-rw-r--r-- | lib/unicorn.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb index 43ef9e8..8c0ff6e 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -35,15 +35,13 @@ module Unicorn def builder(ru, opts) if ru =~ /\.ru\z/ # parse embedded command-line options in config.ru comments - if File.open(ru, "rb") { |fp| fp.sysread(fp.stat.size) } =~ /^#\\(.*)/ - opts.parse! $1.split(/\s+/) - end + /^#\\(.*)/ =~ File.read(ru) and opts.parse!($1.split(/\s+/)) end lambda do || inner_app = case ru when /\.ru$/ - raw = File.open(ru, "rb") { |fp| fp.sysread(fp.stat.size) } + raw = File.read(ru) raw.sub!(/^__END__\n.*/, '') eval("Rack::Builder.new {(#{raw}\n)}.to_app", TOPLEVEL_BINDING, ru) else |