Permalink
Browse files

DRY-up rake task definitions.

Signed-off-by: Tobias Lütke <tobi@leetsoft.com>
  • Loading branch information...
1 parent c08971b commit 825ebcf0e97c3c559ec1242df51cd9e820b71603 Dean Strelau committed with tobi Dec 29, 2008
Showing with 9 additions and 15 deletions.
  1. +1 −1 delayed_job.gemspec
  2. +1 −1 lib/delayed_job.rb
  3. +1 −11 tasks/jobs.rake
  4. +6 −2 tasks/{merbtasks.rb → tasks.rb}
View
2 delayed_job.gemspec
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
lib/delayed/worker.rb
lib/delayed_job.rb
tasks/jobs.rake
- tasks/merbtasks.rb
+ tasks/tasks.rb
]
s.test_files = %w[
spec/database.rb
View
2 lib/delayed_job.rb
@@ -8,5 +8,5 @@
Object.send(:include, Delayed::MessageSending)
if defined?(Merb::Plugins)
- Merb::Plugins.add_rakefiles File.dirname(__FILE__) / '..' / 'tasks' / 'merbtasks'
+ Merb::Plugins.add_rakefiles File.dirname(__FILE__) / '..' / 'tasks' / 'tasks'
end
View
12 tasks/jobs.rake
@@ -1,11 +1 @@
-namespace :jobs do
- desc "Clear the delayed_job queue."
- task :clear => :environment do
- Delayed::Job.delete_all
- end
-
- desc "Start a delayed_job worker."
- task :work => :environment do
- Delayed::Worker.new(:min_priority => ENV['MIN_PRIORITY'], :max_priority => ENV['MAX_PRIORITY']).start
- end
-end
+load 'tasks'
View
8 tasks/merbtasks.rb → tasks/tasks.rb
@@ -1,11 +1,15 @@
+# Re-definitions are appended to existing tasks
+task :environment
+task :merb_env
+
namespace :jobs do
desc "Clear the delayed_job queue."
- task :clear => :merb_env do
+ task :clear => [:merb_env, :environment] do
Delayed::Job.delete_all
end
desc "Start a delayed_job worker."
- task :work => :merb_env do
+ task :work => [:merb_env, :environment] do
Delayed::Worker.new(:min_priority => ENV['MIN_PRIORITY'], :max_priority => ENV['MAX_PRIORITY']).start
end
end

0 comments on commit 825ebcf

Please sign in to comment.