Skip to content

Instantly share code, notes, and snippets.

@dsturnbull
Created February 7, 2010 23:50
Show Gist options
  • Save dsturnbull/297764 to your computer and use it in GitHub Desktop.
Save dsturnbull/297764 to your computer and use it in GitHub Desktop.
diff --git a/config/initializers/craken.rb b/config/initializers/craken.rb
new file mode 100644
index 0000000..44f6ff9
--- /dev/null
+++ b/config/initializers/craken.rb
@@ -0,0 +1,19 @@
+CRAKEN_PATH = "/opt/ruby-enterprise/bin:/bin:/usr/bin:/usr/local/bin"
+
+module Craken
+ def append_tasks_with_path(*args, &block)
+ crontab = append_tasks_without_path(*args, &block)
+ crontab = crontab.split("\n").map { |line|
+ if line =~ /#{Regexp.escape("cd #{DEPLOY_PATH} && #{RAKE_EXE}")}/
+ head, tail = line.split(' && ')
+ "#{head} PATH=#{CRAKEN_PATH} #{tail}"
+ else
+ line
+ end
+ }.join("\n")
+ crontab
+ end
+ alias_method_chain :append_tasks, :path
+end
+
+# vim: ft=ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment