lib/golden_brindle/start.rb in golden_brindle-0.1 vs lib/golden_brindle/start.rb in golden_brindle-0.1.1

- old
+ new

@@ -10,16 +10,16 @@ ["-b", "--bundler", "Use bundler to start unicorn instances", :@bundler, false], ["-d", "--daemonize", "Run daemonized in the background", :@daemon, false], ['', "--preload", "Preload application", :@preload, false], ['-p', '--port PORT', "Which port to bind to (if set numbers of servers - start port number)", :@port, Unicorn::Const::DEFAULT_PORT], ['-a', '--address ADDR', "Address to bind to", :@address, Unicorn::Const::DEFAULT_HOST], - ['-o', '--listen {HOST:PORT|PATH}',"listen on HOST:PORT or PATH, separeted by comma (default: #{Unicorn::Const::DEFAULT_LISTEN})", :@listen, Unicorn::Const::DEFAULT_LISTEN], + ['-o', '--listen {HOST:PORT|PATH}',"listen on HOST:PORT or PATH, separated by comma (default: #{Unicorn::Const::DEFAULT_LISTEN})", :@listen, Unicorn::Const::DEFAULT_LISTEN], ['-l', '--log FILE', "Where to write log messages", :@log_file, "log/unicorn.log"], ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "tmp/pids/unicorn.pid"], ['-n', '--num-workers INT', "Number of Unicorn workers", :@workers, 4], ['-N', '--num-servers INT', "Number of Unicorn listen records", :@servers, 1], - ['-t', '--timeout TIME', "Time to wait (in seconds) before killing a stalled thread", :@timeout, 60], + ['-t', '--timeout INT', "Time to wait (in seconds) before killing a stalled thread", :@timeout, 60], ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, Dir.pwd], ['-D', '--debug', "Enable debugging mode", :@debug, false], ['-C', '--config PATH', "Use a mongrel based config file", :@config_file, nil], ['-S', '--script PATH', "Load the Unicorn-specific config file", :@config_script, nil], ['', '--user USER', "User to run as", :@user, nil], @@ -147,11 +147,11 @@ :listeners => [], :pid => @pid_file, :config_file => @config_script, :worker_processes => @workers.to_i, :working_directory => @cwd, - :timeout => @timeout + :timeout => @timeout.to_i } # set user via Unicorn options. If we don't set group - then use only user options[:user] = @user unless @user.nil? options[:stderr_path] = options[:stdout_path] = @log_file if @daemon # ensure Rails standard tmp paths exist @@ -221,10 +221,14 @@ app = rails_builder(@daemon) if @daemon Unicorn::Launcher.daemonize!(options) end puts "start Unicorn..." - Unicorn.run(app, options) + if Unicorn.respond_to?(:run) + Unicorn.run(app, options) + else + Unicorn::HttpServer.new(app, options).start.join + end end end end