lib/bluepill/group.rb in bluepill-0.0.5 vs lib/bluepill/group.rb in bluepill-0.0.6

- old
+ new

@@ -13,36 +13,25 @@ process.logger = self.logger.prefix_with(process.name) self.processes << process end def tick - self.each_process do |process| + self.processes.each do |process| process.tick end end # proxied events - [:start, :unmonitor, :stop, :restart].each do |event| - eval <<-END + [:start, :unmonitor, :stop, :restart, :boot!].each do |event| + class_eval <<-END def #{event}(process_name = nil) - self.each_process do |process| - process.dispatch!("#{event}") if process_name.nil? || process.name == process_name + threads = [] + self.processes.each do |process| + next if process_name && process_name != process.name + threads << Thread.new { process.handle_user_command("#{event}") } end + threads.each { |t| t.join } end END - end - - def status - status = [] - self.each_process do |process| - status << [process.name, process.state] - end - status - end - - - protected - def each_process(&block) - self.processes.each(&block) end end end \ No newline at end of file