我知道你可以使用IronWorker CLI工具从命令行完成它,但我想使用Rakefile来保持它更有条理,并从配置文件加载我的配置。
下面是一个加载本地 config.yml 文件的示例,您可以使用rake workers:upload
上传所有工作线程:
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