Module: Citrus::Master::Starter
Overview
Starter
Instance Method Summary collapse
- #local_run(cmd, host, options) ⇒ Object
-
#run_server(server, &block) ⇒ Object
Run server.
-
#run_servers ⇒ Object
Run servers.
- #spawn_process(cmd, host, options) ⇒ Object
- #ssh_run ⇒ Object
Methods included from Utils
Instance Method Details
#local_run(cmd, host, options) ⇒ Object
54 55 56 |
# File 'lib/citrus/master/starter.rb', line 54 def local_run cmd, host, spawn_process cmd, host, end |
#run_server(server, &block) ⇒ Object
Run server
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/citrus/master/starter.rb', line 32 def run_server server, &block if local? server[:host] = [] << sprintf('%s', $0) << sprintf('env=%s', @app.env) server.each { |key, value| << sprintf('%s=%s', key, value) } local_run 'ruby', nil, else end end |
#run_servers ⇒ Object
Run servers
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/citrus/master/starter.rb', line 17 def run_servers condition = @app.start_id || @app.type case condition when :master when :all @app.servers_map.each { |server_id, server| run_server server } else end end |
#spawn_process(cmd, host, options) ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/citrus/master/starter.rb', line 61 def spawn_process cmd, host, child = fork { exec cmd + .inject('') { |res, str| res += ' ' + str } } EM.watch_process child, Module.new { define_method(:process_exited) { Process.wait child } } end |
#ssh_run ⇒ Object
48 49 |
# File 'lib/citrus/master/starter.rb', line 48 def ssh_run end |