about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-11-06 02:34:55 +0000
committerEric Wong <normalperson@yhbt.net>2013-11-06 02:36:27 +0000
commit0151fa2bcba2371a36d22d072ca756f2959de1e0 (patch)
treea173a2f89cf329251c0d222d703fb91b8f5fe4b2
parent41bbed9a9e60f942a620d171034257b5c84e1eb0 (diff)
downloadyahns-0151fa2bcba2371a36d22d072ca756f2959de1e0.tar.gz
We cannot declare apps before working_directory is bound.
-rw-r--r--lib/yahns/rackup_handler.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/yahns/rackup_handler.rb b/lib/yahns/rackup_handler.rb
index 9fbebbf..356caaf 100644
--- a/lib/yahns/rackup_handler.rb
+++ b/lib/yahns/rackup_handler.rb
@@ -11,6 +11,10 @@ module Yahns::RackupHandler # :nodoc:
   def self.run(app, o)
     cfg = Yahns::Config.new
     cfg.instance_eval do
+      # we need this because "rackup -D" sends us to "/", which might be
+      # fine for most apps, but we have SIGUSR2 restarts to support
+      working_directory(Yahns::START[:cwd])
+
       app(:rack, app) do
         addr = o[:listen] || "#{o[:Host]||default_host}:#{o[:Port]||8080}"
         # allow listening to multiple addresses
@@ -31,10 +35,6 @@ module Yahns::RackupHandler # :nodoc:
         x = x.to_sym
         val = o[x] and __send__(x, val)
       end
-
-      # we need this because "rackup -D" sends us to "/", which might be
-      # fine for most apps, but we have SIGUSR2 restarts to support
-      working_directory(Yahns::START[:cwd])
     end
     Yahns::Server.new(cfg).start.join
   end