1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Move binder to launcher

This commit is contained in:
schneems 2016-02-03 14:12:17 -06:00
parent 6c4ff1aa9c
commit f646242821
2 changed files with 13 additions and 13 deletions

View file

@ -51,9 +51,6 @@ module Puma
setup_options
@binder = Binder.new(@events)
@binder.import_from_env
begin
@parser.parse! @argv
@cli_options[:rackup] = @argv.shift if @argv.last
@ -61,11 +58,9 @@ module Puma
exit 1
end
@launcher = Puma::Launcher.new(@cli_options)
@launcher = Puma::Launcher.new(@cli_options, events: @events)
@launcher.events = self.events
@launcher.config = self.config
@launcher.binder = self.binder
@launcher.argv = @argv
@launcher.setup(@options)
@ -119,7 +114,9 @@ module Puma
## BACKWARDS COMPAT FOR TESTS
# The Binder object containing the sockets bound to.
attr_reader :binder
def binder
@launcher.binder
end
# The Configuration object used.
attr_reader :config

View file

@ -1,10 +1,17 @@
require 'puma/binder'
module Puma
class Launcher
def initialize(cli_options = {})
def initialize(cli_options = {}, launcher_options = {})
@cli_options = cli_options
@runner = nil
@events = launcher_options[:events] or raise "must provide :events key"
@binder = Binder.new(@events)
@binder.import_from_env
end
attr_reader :binder, :events
## THIS STUFF IS NEEDED FOR RUNNER
# Delegate +log+ to +@events+
@ -30,10 +37,6 @@ module Puma
@binder
end
def events
@events
end
# Delegate +error+ to +@events+
#
def error(str)
@ -84,7 +87,7 @@ module Puma
end
end
attr_accessor :options, :binder, :config, :events, :argv
attr_accessor :options, :binder, :config, :argv
## THIS STUFF IS NEEDED FOR RUNNER