Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

DRY-up rake task definitions.

Signed-off-by: Tobias Lütke <tobi@leetsoft.com>
  • Loading branch information...
commit 825ebcf0e97c3c559ec1242df51cd9e820b71603 1 parent c08971b
Dean Strelau authored tobi committed
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
Please sign in to comment.
Something went wrong with that request. Please try again.