Reputation: 41133
I know you can use the IronWorker CLI tool to do it from the command line, but I'd like to use a Rakefile to keep it more organized and to load my configuration from a config file.
Upvotes: 2
Views: 199
Reputation: 41133
Here's an example that loads a local config.yml file and with rake workers:upload
you can upload all your workers:
require 'uber_config'
require 'iron_worker_ng'
@config = UberConfig.load
p @config
namespace :workers do
task :upload_email do
client = IronWorkerNG::Client.new(@config['iron'])
# Upload the code
code = IronWorkerNG::Code::Base.new('workers/email_worker')
client.codes.create(code)
end
task :upload_lead do
client = IronWorkerNG::Client.new(@config['iron'])
# Upload the code
code = IronWorkerNG::Code::Base.new('workers/lead_worker')
client.codes.create(code)
end
task :upload do
Rake::Task["workers:upload_email"].invoke
Rake::Task["workers:upload_lead"].invoke
end
end
Upvotes: 2