@@ -19,7 +19,9 @@ def self.boot(options = {})
1919 def initialize ( options = { } )
2020 @foreground = options . fetch ( :foreground , false )
2121 @env = options [ :env ] || default_env
22- @applications = Hash . new { |h , k | h [ k ] = ApplicationManager . new ( k , env ) }
22+ @applications = Hash . new do |hash , key |
23+ hash [ key ] = ApplicationManager . new ( *key , env )
24+ end
2325 @pidfile = env . pidfile_path . open ( 'a' )
2426 @mutex = Mutex . new
2527 end
@@ -57,12 +59,12 @@ def serve(client)
5759 app_client = client . recv_io
5860 command = JSON . load ( client . read ( client . gets . to_i ) )
5961
60- args , default_rails_env = command . values_at ( 'args' , 'default_rails_env' )
62+ args , default_rails_env , spawn_env = command . values_at ( 'args' , 'default_rails_env' , 'spawn_env ')
6163
6264 if Spring . command? ( args . first )
6365 log "running command #{ args . first } "
6466 client . puts
65- client . puts @applications [ rails_env_for ( args , default_rails_env ) ] . run ( app_client )
67+ client . puts @applications [ rails_env_for ( args , default_rails_env , spawn_env ) ] . run ( app_client )
6668 else
6769 log "command not found #{ args . first } "
6870 client . close
@@ -73,8 +75,8 @@ def serve(client)
7375 redirect_output
7476 end
7577
76- def rails_env_for ( args , default_rails_env )
77- Spring . command ( args . first ) . env ( args . drop ( 1 ) ) || default_rails_env
78+ def rails_env_for ( args , default_rails_env , spawn_env )
79+ [ Spring . command ( args . first ) . env ( args . drop ( 1 ) ) || default_rails_env , spawn_env ]
7880 end
7981
8082 # Boot the server into the process group of the current session.
0 commit comments