about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-02-25 15:05:14 -0800
committerEric Wong <normalperson@yhbt.net>2010-02-25 17:04:33 -0800
commit4b4ac5ed5d62cab76790661ba92a9ac4d5f1c105 (patch)
treebaef9d0ee6ab556f47db935222a603d345507c30 /lib
parent036df6c373df6d7f52005fbbd3196646934329d3 (diff)
downloadunicorn-4b4ac5ed5d62cab76790661ba92a9ac4d5f1c105.tar.gz
The temporary paths we create to mimic script/server-emulation
did not work when working_directory was used.  Now we defer
path creation until after working_directory is bound.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn/configurator.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index f6d13ab..b586c67 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -10,7 +10,7 @@ module Unicorn
   # See http://unicorn.bogomips.org/examples/unicorn.conf.rb for an
   # example config file.  An example config file for use with nginx is
   # also available at http://unicorn.bogomips.org/examples/nginx.conf
-  class Configurator < Struct.new(:set, :config_file)
+  class Configurator < Struct.new(:set, :config_file, :after_reload)
 
     # Default settings for Unicorn
     DEFAULTS = {
@@ -34,6 +34,10 @@ module Unicorn
       self.set = Hash.new(:unset)
       use_defaults = defaults.delete(:use_defaults)
       self.config_file = defaults.delete(:config_file)
+
+      # after_reload is only used by unicorn_rails, unsupported otherwise
+      self.after_reload = defaults.delete(:after_reload)
+
       set.merge!(DEFAULTS) if use_defaults
       defaults.each { |key, value| self.send(key, value) }
       Hash === set[:listener_opts] or
@@ -53,6 +57,9 @@ module Unicorn
         test(?w, path) || test(?w, File.dirname(path)) or \
               raise ArgumentError, "directory for #{var}=#{path} not writable"
       end
+
+      # unicorn_rails creates dirs here after working_directory is bound
+      after_reload.call if after_reload
     end
 
     def commit!(server, options = {}) #:nodoc: