Skip to content

Commit

Permalink
added rake task, updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rkononov committed Sep 10, 2012
1 parent ef6e96f commit 87d1bf8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ This example show how to work with iron_worker under Rails environment
2. Q:How to upload workers? 2. Q:How to upload workers?


A:You could upload workers from many places: 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) * initializer - [iron_worker](https://github.com/iron-io/iron_worker_rails_example/blob/master/config/initializers/iron_worker.rb#L4)
* rake task * 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) * 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? 3. Q:How to use ActionMailer in worker?
Expand Down
9 changes: 9 additions & 0 deletions lib/tasks/iron_worker.rake
Original file line number Original file line Diff line number Diff line change
@@ -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

0 comments on commit 87d1bf8

Please sign in to comment.