Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added rake task, updated readme

  • Loading branch information...
commit 87d1bf89612d09bd176be2083206b542faf05dd0 1 parent ef6e96f
Roman rkononov authored
Showing with 11 additions and 2 deletions.
  1. +2 −2 README.md
  2. +9 −0 lib/tasks/iron_worker.rake
4 README.md
View
@@ -18,8 +18,8 @@ This example show how to work with iron_worker under Rails environment
2. Q:How to upload workers?
A:You could upload workers from many places:
- * initializer [iron_worker](https://github.com/iron-io/iron_worker_rails_example/blob/master/config/initializers/iron_worker.rb#L4)
- * rake task
+ * initializer - [iron_worker](https://github.com/iron-io/iron_worker_rails_example/blob/master/config/initializers/iron_worker.rb#L4)
+ * rake task (rake iron_worker:upload) - [iron_worker.rake](https://github.com/iron-io/iron_worker_rails_example/blob/master/lib/tasks/iron_worker.rake)
* controller/model - [controller](https://github.com/iron-io/iron_worker_rails_example/blob/master/app/controllers/codes_controller.rb#L8)
3. Q:How to use ActionMailer in worker?
9 lib/tasks/iron_worker.rake
View
@@ -0,0 +1,9 @@
+namespace :iron_worker do
+ desc "Upload all workers"
+ task :upload => :environment do
+ Dir.glob('workers/*.worker').each do |file|
+ code_from_workerfile = IronWorkerNG::Code::Base.new(:workerfile => file)
+ IW_CLIENT.codes.create(code_from_workerfile)
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.