module Ungodly

Public Class Methods

create_tasks(options = {}) click to toggle source
# File lib/ungodly.rb, line 81
def self.create_tasks(options = {})

  god_manager = GodManager.new(options)

  desc "Launch god and the workers"
  task :launch do
    invoke god_manager.launch_cmd
  end

  desc "Terminate god and the workers"
  task :terminate do
    invoke god_manager.terminate_cmd
  end

  desc "Show the status of the god workers"
  task :status do
    invoke god_manager.status_cmd
  end

end
invoke(args) click to toggle source

Helper method for invoking god commands

# File lib/ungodly.rb, line 13
def self.invoke(args)
  pid = Process.spawn(*args)
  _, result = Process.wait2(pid)

  s = result.exitstatus
  if s != 0
    raise GodCommandFailure, "god command exited with status #{s}"
  end
end