Permalink
Browse files

Allow capistrano recipes to be loaded from the gem.

Add the following in your capistrano config to load the recipes:

  require 'delayed/recipes'
  • Loading branch information...
1 parent 94be113 commit f5871850dad913fe56252a7f0333affcfb9644eb @bkeepers bkeepers committed Sep 23, 2009
Showing with 28 additions and 26 deletions.
  1. +27 −0 lib/delayed/recipes.rb
  2. +1 −26 recipes/delayed_job.rb
View
@@ -0,0 +1,27 @@
+# Capistrano Recipes for managing delayed_job
+#
+# Add these callbacks to have the delayed_job process restart when the server
+# is restarted:
+#
+# after "deploy:stop", "delayed_job:stop"
+# after "deploy:start", "delayed_job:start"
+# after "deploy:restart", "delayed_job:restart"
+
+Capistrano::Configuration.instance.load do
+ namespace :delayed_job do
+ desc "Stop the delayed_job process"
+ task :stop, :roles => :app do
+ run "cd #{current_path}; script/delayed_job -e #{rails_env} stop"
+ end
+
+ desc "Start the delayed_job process"
+ task :start, :roles => :app do
+ run "cd #{current_path}; script/delayed_job -e #{rails_env} start"
+ end
+
+ desc "Restart the delayed_job process"
+ task :restart, :roles => :app do
+ run "cd #{current_path}; script/delayed_job -e #{rails_env} restart"
+ end
+ end
+end
View
@@ -1,26 +1 @@
-# Capistrano Recipes for managing delayed_job
-#
-# Add these callbacks to have the delayed_job process restart when the server
-# is restarted:
-#
-# after "deploy:stop", "delayed_job:stop"
-# after "deploy:start", "delayed_job:start"
-# after "deploy:restart", "delayed_job:restart"
-
-
-namespace :delayed_job do
- desc "Stop the delayed_job process"
- task :stop, :roles => :app do
- run "cd #{current_path}; script/delayed_job -e #{rails_env} stop"
- end
-
- desc "Start the delayed_job process"
- task :start, :roles => :app do
- run "cd #{current_path}; script/delayed_job -e #{rails_env} start"
- end
-
- desc "Restart the delayed_job process"
- task :restart, :roles => :app do
- run "cd #{current_path}; script/delayed_job -e #{rails_env} restart"
- end
-end
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'delayed', 'recipes'))

0 comments on commit f587185

Please sign in to comment.