Class: Puma::CLI
- Inherits:
-
Object
- Object
- Puma::CLI
- Defined in:
- lib/puma/cli.rb
Overview
Handles invoke a Puma::Server in a command line style.
Constant Summary collapse
- KEYS_NOT_TO_PERSIST_IN_STATE =
Deprecated.
6.0.0
Launcher::KEYS_NOT_TO_PERSIST_IN_STATE
Instance Attribute Summary collapse
-
#launcher ⇒ Object
readonly
Returns the value of attribute launcher.
Instance Method Summary collapse
-
#initialize(argv, events = Events.stdio) ⇒ CLI
constructor
Create a new CLI object using
argv
as the command line arguments. -
#run ⇒ Object
Parse the options, load the rackup, start the server and wait for it to finish.
Constructor Details
#initialize(argv, events = Events.stdio) ⇒ CLI
Create a new CLI object using argv
as the command line arguments.
stdout
and stderr
can be set to IO-like objects which this object will report status on.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/puma/cli.rb', line 33 def initialize(argv, events=Events.stdio) @debug = false @argv = argv.dup @events = events @conf = nil @stdout = nil @stderr = nil @append = false @control_url = nil @control_options = {} begin @parser.parse! @argv if file = @argv.shift @conf.configure do |user_config, file_config| file_config.rackup file end end rescue UnsupportedOption exit 1 end @conf.configure do |user_config, file_config| if @stdout || @stderr user_config.stdout_redirect @stdout, @stderr, @append end if @control_url user_config.activate_control_app @control_url, @control_options end end @launcher = Puma::Launcher.new(@conf, :events => @events, :argv => argv) end |
Instance Attribute Details
#launcher ⇒ Object (readonly)
Returns the value of attribute launcher.
75 76 77 |
# File 'lib/puma/cli.rb', line 75 def launcher @launcher end |
Instance Method Details
#run ⇒ Object
Parse the options, load the rackup, start the server and wait for it to finish.
80 81 82 |
# File 'lib/puma/cli.rb', line 80 def run @launcher.run end |