Class: SinatraGod

Inherits:
GodProcess show all
Defined in:
utils/god/sinatra_god.rb

Constant Summary collapse

CONFIG_DEFAULTS =
{
  :port           => 12000,
  :app_dirname    => File.dirname(__FILE__)+'/../../app/edamame_san',
  :monitor_group  => 'sinatras',
  :server_exe     => '/usr/local/bin/shotgun',
}

Instance Attribute Summary

Attributes inherited from GodProcess

#config

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GodProcess

#config_watcher, create, #handle, #mkdirs!, #process_log_file, #restart_command, #setup, #setup_lifecycle, #setup_restart, #setup_start, #stop_command

Constructor Details

#initialize(*args) ⇒ SinatraGod

Returns a new instance of SinatraGod.



8
9
10
11
# File 'utils/god/sinatra_god.rb', line 8

def initialize *args
  super *args
  self.config = SinatraGod::CONFIG_DEFAULTS.compact.merge(self.config)
end

Class Method Details

.are_you_there_god_its_me_sinatra(*args) ⇒ Object

w.start = “thin start -C #file -o #number” w.stop = “thin stop -C #file -o #number” w.restart = “thin restart -C #file -o #number”



33
34
35
# File 'utils/god/sinatra_god.rb', line 33

def self.are_you_there_god_its_me_sinatra *args
  create *args
end

.kindObject



13
14
15
# File 'utils/god/sinatra_god.rb', line 13

def self.kind
  :sinatra
end

Instance Method Details

#app_runnerObject



17
18
19
# File 'utils/god/sinatra_god.rb', line 17

def app_runner
  File.join(config[:app_dirname], config[:app_name] || 'config.ru')
end

#start_commandObject



21
22
23
24
25
26
27
28
# File 'utils/god/sinatra_god.rb', line 21

def start_command
  [
    config[:server_exe],
    "--server=thin",
    "--port=#{config[:port]}",
    app_runner
  ].flatten.compact.join(" ")
end