Class: Heroku::Forward::Backends::Puma
- Defined in:
- lib/heroku/forward/backends/puma.rb
Instance Attribute Summary collapse
-
#config_file ⇒ Object
Returns the value of attribute config_file.
Attributes inherited from Base
#application, #environment, #pid, #socket
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Puma
constructor
A new instance of Puma.
- #spawn! ⇒ Object
- #spawned? ⇒ Boolean
- #terminate! ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Puma
Returns a new instance of Puma.
9 10 11 12 13 14 |
# File 'lib/heroku/forward/backends/puma.rb', line 9 def initialize( = {}) @application = [:application] @socket = [:socket] || Heroku::Forward::Utils::Dir.tmp_filename('puma-', '.sock') @env = [:env] || 'development' @config_file = [:config_file] end |
Instance Attribute Details
#config_file ⇒ Object
Returns the value of attribute config_file.
7 8 9 |
# File 'lib/heroku/forward/backends/puma.rb', line 7 def config_file @config_file end |
Instance Method Details
#spawn! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/heroku/forward/backends/puma.rb', line 16 def spawn! return false if spawned? check! args = ['puma'] args.push '--environment', @env args.push '--config', @config_file if @config_file args.push '--bind', "unix://#{@socket}" args.push @application @pid = Spoon.spawnp(*args) @spawned = true end |
#spawned? ⇒ Boolean
37 38 39 |
# File 'lib/heroku/forward/backends/puma.rb', line 37 def spawned? !!@spawned end |
#terminate! ⇒ Object
30 31 32 33 34 35 |
# File 'lib/heroku/forward/backends/puma.rb', line 30 def terminate! return false unless spawned? Process.kill 'QUIT', @pid @spawned = false true end |