Class: Styoe::Launcher

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_resolver, process_launcher) ⇒ Launcher

Returns a new instance of Launcher.



10
11
12
13
# File 'lib/styoe.rb', line 10

def initialize(config_resolver, process_launcher)
  @config_resolver  = config_resolver
  @process_launcher = process_launcher
end

Class Method Details

.build(dot_file, pid_file) ⇒ Object



15
16
17
18
19
20
# File 'lib/styoe.rb', line 15

def self.build(dot_file, pid_file)
  config_resolver = Styoe::ConfigurationResolver.new(dot_file, pid_file, Styoe::DotFileManager.new)
  process_launcher = Styoe::ProcessLauncher.new

  self.new(config_resolver, process_launcher)
end

Instance Method Details

#startObject



22
23
24
25
# File 'lib/styoe.rb', line 22

def start
  running_processes = run_processes!
  @config_resolver.dump_processes(running_processes)
end

#stopObject



27
28
29
30
31
# File 'lib/styoe.rb', line 27

def stop
  @config_resolver.active_processes.each do |pid|
    @process_launcher.stop(pid)
  end
end