Class: Spawngebob::Runner
- Inherits:
-
Object
- Object
- Spawngebob::Runner
show all
- Includes:
- Constants
- Defined in:
- lib/spawngebob/runner.rb
Constant Summary
Constants included
from Constants
Constants::BASE_CONFIG_PATH, Constants::CONFIG_FILE, Constants::NGINX_CONF, Constants::NGINX_CONFD_PATH, Constants::NGINX_CONF_PATH, Constants::NGINX_DEFAULTS, Constants::NGINX_DIRS, Constants::NGINX_HTTP_LOCATION_TEMPLATE, Constants::NGINX_PATH, Constants::NGINX_PID, Constants::NGINX_SERVER_TEMPLATE, Constants::NGINX_SSL_LOCATION_TEMPLATE, Constants::NGINX_SSL_SERVER_TEMPLATE, Constants::NGINX_UPSTREAM_TEMPLATE, Constants::SCRIPT_DIR
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Runner
Returns a new instance of Runner.
43
44
45
46
47
48
49
|
# File 'lib/spawngebob/runner.rb', line 43
def initialize(options)
@options = options
@args = ARGV.dup
@command = ARGV.shift
self.run(options)
end
|
Class Method Details
.boot(options) ⇒ Object
7
8
9
10
11
12
|
# File 'lib/spawngebob/runner.rb', line 7
def self.boot(options)
Spawngebob::Constants.const_set('NGINX_BIN', `which nginx 2>/dev/null`.strip)
Spawngebob::Constants.const_set('KILL_BIN', `which kill 2>/dev/null`.strip)
self.new(options) if has_requirements?
end
|
.has_requirements? ⇒ Boolean
Instance Method Details
#run(options) ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/spawngebob/runner.rb', line 51
def run(options)
case @args.shift
when 'start'
system "#{SCRIPT_DIR} start"
when 'stop'
system "#{SCRIPT_DIR} stop"
when 'restart'
system "#{SCRIPT_DIR} restart"
when 'check'
system "#{SCRIPT_DIR} status"
when 'reload'
system "#{SCRIPT_DIR} reload"
when 'configure'
Compilers::Nginx.new.prepare
else
puts "Unknown command! Available commands: {start|stop|restart|check|reload|configure}"
end
end
|