From: Hongli Lai <hongli@phusion.nl>
To: Eric Wong <normalperson@yhbt.net>
Cc: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: unicorn_rails cleanup (possible fix for Rails3) pushed
Date: Tue, 8 Jun 2010 21:25:38 +0200 [thread overview]
Message-ID: <AANLkTimtK_mjX_8zmEccxz4j5yjl49KUu07ilK66BU-9@mail.gmail.com> (raw)
In-Reply-To: <20100608192034.GA2940@dcvr.yhbt.net>
On Tue, Jun 8, 2010 at 9:20 PM, Eric Wong <normalperson@yhbt.net> wrote:
> Thanks Hongli, so this only affects people who remove the
> config.ru that Rails 3 creates for them? Yikes...
No. The problem even occurs if you already have config.ru. But the
thing is, Rails 3 has deprecated ActionController::Dispatcher a few
weeks ago and replaced it with a stub. Rails::Rack::Static changed its
interface and must be constructed differently. The only way to obtain
a valid Rack endpoint for the app seems to be parsing
config/application.rb
> A few comments:
>
> + if ::Rails::VERSION::MAJOR >= 3 && ::File.exist?('config/application.rb')
> + ::File.read('config/application.rb') =~ /^module (.+)$/
>
> Maybe a more flexible regexp like this: /^module\s+([\w:]+)\s*$/ (or
> maybe even starting with: "^\s*") would be more reliable for folks who
> leave extra spaces around.
I think it's easier to just call 'strip'. :)
> Unfortunately, Ruby is not Python :)
>
> @@ -148,9 +167,9 @@ def rails_builder(daemonize)
> else
> use Rails::Rack::LogTailer unless daemonize
> use Rails::Rack::Debugger if $DEBUG
> + use Rails::Rack::Static, map_path
> map(map_path) do
> - use Rails::Rack::Static
> - run ActionController::Dispatcher.new
> + run rails_dispatcher
>
> Changing the call to use Rails::Rack::Static there is wrong. map_path
> is the URI prefix (RAILS_RELATIVE_URL_ROOT) and not the static file
> path we serve from. It appears the deprecation in Rails 3 broke some
> things and ActionDispatch::Static is configured slightly differently.
>
> Let me know if the edited patch below looks alright to you.
Yes it looks fine. A bit overcomplicated regexp compared to using
'strip' but whatever works. :)
With kind regards,
Hongli Lai
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: info@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying
next prev parent reply other threads:[~2010-06-08 19:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-08 12:24 unicorn_rails cleanup (possible fix for Rails3) pushed Hongli Lai
2010-06-08 19:20 ` Eric Wong
2010-06-08 19:25 ` Hongli Lai [this message]
2010-06-08 20:55 ` Eric Wong
2010-06-11 20:32 ` Eric Wong
-- strict thread matches above, loose matches on Subject: below --
2010-06-04 1:58 Eric Wong
2010-06-04 2:13 ` Michael Guterl
2010-06-04 2:48 ` Eric Wong
2010-06-08 2:49 ` Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTimtK_mjX_8zmEccxz4j5yjl49KUu07ilK66BU-9@mail.gmail.com \
--to=hongli@phusion.nl \
--cc=mongrel-unicorn@rubyforge.org \
--cc=normalperson@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).