Class: Citrus::Master::Master
- Inherits:
-
Object
- Object
- Citrus::Master::Master
- Includes:
- Starter, Utils::ModuleUtil
- Defined in:
- lib/citrus/master/master.rb
Overview
Master
Instance Method Summary collapse
-
#initialize(app, args = {}) ⇒ Master
constructor
Create a new master.
-
#start(&block) ⇒ Object
Start master.
-
#stop(&block) ⇒ Object
Stop master.
Methods included from Utils::ModuleUtil
#load_modules, #register_default_modules, #start_module, #start_modules
Methods included from Starter
#local_run, #run_server, #run_servers, #spawn_process, #ssh_run
Methods included from Utils
Constructor Details
#initialize(app, args = {}) ⇒ Master
Create a new master
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/citrus/master/master.rb', line 24 def initialize app, args={} @app = app @master = true @master_info = app.master @modules = [] @close_watcher = args[:close_watcher] @console_service = CitrusAdmin::ConsoleService.create_master_console( args.merge({ :env => app.env, :port => @master_info[:port] }) ) end |
Instance Method Details
#start(&block) ⇒ Object
Start master
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/citrus/master/master.rb', line 39 def start &block register_default_modules load_modules @console_service.start { |err| exit if err start_modules { |err| if err block_given? and yield err return end run_servers block_given? and yield } } end |
#stop(&block) ⇒ Object
Stop master
56 57 |
# File 'lib/citrus/master/master.rb', line 56 def stop &block end |