unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Micah Chalmer <micah@micahchalmer.net>
To: mongrel-unicorn@rubyforge.org
Subject: [PATCH 2/2] Make -N/--no-default-middleware option work
Date: Thu, 6 Jun 2013 23:03:36 -0400	[thread overview]
Message-ID: <B44BDB77-4C32-4552-8A16-EC59DE9C6B18@micahchalmer.net> (raw)

This fixes the -N (a.k.a. --no-defaut-middleware) option, which
was not working.  The problem was that Unicorn::Configurator::RACKUP
is cleared before the lambda returned by Unicorn.builder is run,
which means that checking whether the :no_default_middleware option
was set from the lambda could not detect anything.  This patch copies
it to a local variable that won't get clobbered, restoring the feature.
---
lib/unicorn.rb | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index f0ceffe..2535159 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -35,6 +35,10 @@ module Unicorn
    # allow Configurator to parse cli switches embedded in the ru file
    op = Unicorn::Configurator::RACKUP.merge!(:file => ru, :optparse => op)

+    # Op is going to get cleared before the returned lambda is called, so
+    # save this value so that it's still there when we need it:
+    no_default_middleware = op[:no_default_middleware]
+
    # always called after config file parsing, may be called after forking
    lambda do ||
      inner_app = case ru
@@ -49,7 +53,7 @@ module Unicorn

      pp({ :inner_app => inner_app }) if $DEBUG

-      return inner_app if op[:no_default_middleware]
+      return inner_app if no_default_middleware

      # return value, matches rackup defaults based on env
      # Unicorn does not support persistent connections, but Rainbows!
-- 
1.8.2

_______________________________________________
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

                 reply	other threads:[~2013-06-07  3:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=B44BDB77-4C32-4552-8A16-EC59DE9C6B18@micahchalmer.net \
    --to=micah@micahchalmer.net \
    --cc=mongrel-unicorn@rubyforge.org \
    /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).