Class: Cocaine::WorkerFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/cocaine/server/worker.rb

Class Method Summary collapse

Class Method Details

.createObject



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/cocaine/server/worker.rb', line 61

def self.create
  options = {}
  OptionParser.new do |opts|
    opts.banner = 'Usage: <your_worker.rb> --app NAME --locator ADDRESS --uuid UUID --endpoint ENDPOINT'

    opts.on('--app NAME', 'Worker name') { |a| options[:app] = a }
    opts.on('--locator ADDRESS', 'Locator address') { |a| options[:locator] = a }
    opts.on('--uuid UUID', 'Worker uuid') { |a| options[:uuid] = a }
    opts.on('--endpoint ENDPOINT', 'Worker endpoint') { |a| options[:endpoint] = a }
  end.parse!
  return Cocaine::Worker.new options
end