Class: Rays::Worker::BaseWorker

Inherits:
Object
  • Object
show all
Defined in:
lib/rays/workers/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.register(type, name) ⇒ Object



47
48
49
# File 'lib/rays/workers/base.rb', line 47

def self.register(type, name)
  Manager.instance.register(type, name, self)
end

Instance Method Details

#execute(process, app_module) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/rays/workers/base.rb', line 51

def execute(process, app_module)
  if app_module.nil? or !Dir.exist?(app_module.path)
    raise RaysException.new("Do not know how to #{process} <!#{app_module.inspect}!>")
  end

  in_directory(app_module.path) do
    task("#{process} <!#{app_module.type} #{app_module.name}!>", "done", "failed") do
      yield
    end
  end
end