Class: Heroku::Forward::Backends::Thin
- Inherits:
-
Object
- Object
- Heroku::Forward::Backends::Thin
- Defined in:
- lib/heroku/forward/backends/thin.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#socket ⇒ Object
Returns the value of attribute socket.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
-
#ssl_cert_file ⇒ Object
Returns the value of attribute ssl_cert_file.
-
#ssl_key_file ⇒ Object
Returns the value of attribute ssl_key_file.
-
#ssl_verify ⇒ Object
Returns the value of attribute ssl_verify.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Thin
constructor
options: application: passed with -R, eg.
- #spawn! ⇒ Object
- #spawned? ⇒ Boolean
- #terminate! ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Thin
options:
application: passed with -R, eg. app.ru
socket: passed with --socket, eg. /tmp/thin.sock
env: passed with -e, defaults to 'development'
ssl: activated with --ssl
ssl_key_file: passed with ssl_key_file PATH
ssl_cert_file: passed with ssl_cert_file PATH
ssl_verify: activated with ssl_verify
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/heroku/forward/backends/thin.rb', line 23 def initialize( = {}) @application = [:application] @socket = [:socket] || new_socket @env = [:env] || :development @ssl = [:ssl] || false @ssl_key_file = [:ssl_key_file] || false @ssl_cert_file = [:ssl_cert_file] || false @ssl_verify = [:ssl_verify] || false end |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
5 6 7 |
# File 'lib/heroku/forward/backends/thin.rb', line 5 def application @application end |
#environment ⇒ Object
Returns the value of attribute environment.
7 8 9 |
# File 'lib/heroku/forward/backends/thin.rb', line 7 def environment @environment end |
#pid ⇒ Object
Returns the value of attribute pid.
8 9 10 |
# File 'lib/heroku/forward/backends/thin.rb', line 8 def pid @pid end |
#socket ⇒ Object
Returns the value of attribute socket.
6 7 8 |
# File 'lib/heroku/forward/backends/thin.rb', line 6 def socket @socket end |
#ssl ⇒ Object
Returns the value of attribute ssl.
10 11 12 |
# File 'lib/heroku/forward/backends/thin.rb', line 10 def ssl @ssl end |
#ssl_cert_file ⇒ Object
Returns the value of attribute ssl_cert_file.
12 13 14 |
# File 'lib/heroku/forward/backends/thin.rb', line 12 def ssl_cert_file @ssl_cert_file end |
#ssl_key_file ⇒ Object
Returns the value of attribute ssl_key_file.
11 12 13 |
# File 'lib/heroku/forward/backends/thin.rb', line 11 def ssl_key_file @ssl_key_file end |
#ssl_verify ⇒ Object
Returns the value of attribute ssl_verify.
13 14 15 |
# File 'lib/heroku/forward/backends/thin.rb', line 13 def ssl_verify @ssl_verify end |
Instance Method Details
#spawn! ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/heroku/forward/backends/thin.rb', line 34 def spawn! return false if spawned? check! spawn_with = [ "thin" ] spawn_with.push "start" spawn_with.push "-R", @application spawn_with.push "--socket", @socket spawn_with.push "-e", @env.to_s spawn_with.push "--ssl" if @ssl spawn_with.push "--ssl-key-file", @ssl_key_file if @ssl_key_file spawn_with.push "--ssl-cert-file", @ssl_cert_file if @ssl_cert_file spawn_with.push "--ssl-verify" if @ssl_verify @pid = Spoon.spawnp(* spawn_with) @spawned = true end |
#spawned? ⇒ Boolean
59 60 61 |
# File 'lib/heroku/forward/backends/thin.rb', line 59 def spawned? !! @spawned end |
#terminate! ⇒ Object
52 53 54 55 56 57 |
# File 'lib/heroku/forward/backends/thin.rb', line 52 def terminate! return false unless spawned? Process.kill 'QUIT', @pid @spawned = false true end |