module Citrus::Master::Starter

Starter

Public Instance Methods

local_run(cmd, host, options) click to toggle source
# File lib/citrus/master/starter.rb, line 54
def local_run cmd, host, options
  spawn_process cmd, host, options
end
run_server(server, &block) click to toggle source

Run server

@param [Hash] server

# File lib/citrus/master/starter.rb, line 32
def run_server server, &block
  if local? server[:host]
    options = []
    options << sprintf('%s', $0)
    options << sprintf('env=%s', @app.env)
    server.each { |key, value|
      options << sprintf('%s=%s', key, value)
    }
    local_run 'ruby', nil, options
  else
  end
end
run_servers() click to toggle source

Run servers

# 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) click to toggle source
# File lib/citrus/master/starter.rb, line 61
def spawn_process cmd, host, options
  child = fork {
    exec cmd + options.inject('') { |res, str| res += ' ' + str }
  }
  EM.watch_process child, Module.new {
    define_method(:process_exited) {
      Process.wait child
    }
  }
end
ssh_run() click to toggle source
# File lib/citrus/master/starter.rb, line 48
def ssh_run
end