Commit ec164c8e

mo khan <mo@mokhan.ca>
2013-07-27 21:26:16
shrink the delayed_job recipe
1 parent cae82ea
Changed files (1)
config
config/recipes/delayed_job.rb
@@ -1,22 +1,10 @@
 namespace :delayed_job do 
-  desc "start the delayed_job process"
-  task :start, :roles => :app do
-    run "chmod +x #{current_path}/script/restart_delayed_job"
-    run "cd #{current_path}; RAILS_ENV=#{rails_env} script/delayed_job start"
+  %w[start stop restart].each do |command|
+    desc "#{command} delayed_job"
+    task command, :roles => :app do
+      #run "chmod +x #{current_path}/script/restart_delayed_job"
+      run "cd #{current_path}; RAILS_ENV=#{rails_env} script/delayed_job #{command}"
+    end
+    after "deploy:#{command}", "delayed_job:#{command}"
   end
-  after "deploy:start", "delayed_job:start"
-
-  desc "stop the delayed_job process"
-  task :stop, :roles => :app do
-    run "chmod +x #{current_path}/script/restart_delayed_job"
-    run "cd #{current_path}; RAILS_ENV=#{rails_env} script/delayed_job stop"
-  end
-  after "deploy:stop", "delayed_job:stop"
-
-  desc "Restart the delayed_job process"
-  task :restart, :roles => :app do
-    run "chmod +x #{current_path}/script/restart_delayed_job"
-    run "cd #{current_path}; RAILS_ENV=#{rails_env} script/delayed_job restart"
-  end
-  after "deploy:restart", "delayed_job:restart"
 end