Class: Ungodly::GodManager

Inherits:
Object
  • Object
show all
Defined in:
lib/ungodly.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ GodManager

Returns a new instance of GodManager.



29
30
31
32
33
34
35
36
37
# File 'lib/ungodly.rb', line 29

def initialize(options = {})
  @env             = options[:env]

  @god_path        = options[:god_path]
  
  @port            = options[:port]
  @managed_pid_dir = options[:managed_pid_dir]
  @config_path     = options[:config_path]
end

Instance Attribute Details

#config_pathObject

Returns the value of attribute config_path.



27
28
29
# File 'lib/ungodly.rb', line 27

def config_path
  @config_path
end

#envObject

Returns the value of attribute env.



26
27
28
# File 'lib/ungodly.rb', line 26

def env
  @env
end

#god_pathObject

Returns the value of attribute god_path.



26
27
28
# File 'lib/ungodly.rb', line 26

def god_path
  @god_path
end

#managed_pid_dirObject

Returns the value of attribute managed_pid_dir.



27
28
29
# File 'lib/ungodly.rb', line 27

def managed_pid_dir
  @managed_pid_dir
end

#portObject

Returns the value of attribute port.



27
28
29
# File 'lib/ungodly.rb', line 27

def port
  @port
end

Instance Method Details

#config_path_paramObject



57
58
59
# File 'lib/ungodly.rb', line 57

def config_path_param
  (config_path) ? ["-c", config_path] : []
end

#env_paramObject

Helper methods for generating fragments of god commands



41
42
43
# File 'lib/ungodly.rb', line 41

def env_param
  (env) ? [env] : []
end

#god_exec_paramObject



45
46
47
# File 'lib/ungodly.rb', line 45

def god_exec_param
  [god_path || "god"]
end

#launch_cmdObject

Helper methods for generating god commands



64
65
66
# File 'lib/ungodly.rb', line 64

def launch_cmd
  env_param + god_exec_param + port_param + managed_pid_dir_param + config_path_param
end

#managed_pid_dir_paramObject



53
54
55
# File 'lib/ungodly.rb', line 53

def managed_pid_dir_param
  (managed_pid_dir) ? ["--managed-pid-dir", managed_pid_dir] : []
end

#port_paramObject



49
50
51
# File 'lib/ungodly.rb', line 49

def port_param
  (port) ? ["-p", port.to_s] : []
end

#status_cmdObject



72
73
74
# File 'lib/ungodly.rb', line 72

def status_cmd
  env_param + god_exec_param + port_param + ["status"]
end

#terminate_cmdObject



68
69
70
# File 'lib/ungodly.rb', line 68

def terminate_cmd
  env_param + god_exec_param + port_param + ["terminate"]
end