Browse files

test if local commands are present and log if not, helps to debug pro…

…blems with e.g. git not in $PATH
  • Loading branch information...
jweiss committed Sep 8, 2009
1 parent 336330d commit 7497ab033c060c9facdeb1390637e0d330aefcef
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/capistrano/recipes/deploy.rb
@@ -94,9 +94,18 @@ def with_env(name, value)
# returns the command output as a string
def run_locally(cmd)
logger.trace "executing locally: #{cmd.inspect}" if logger
+ command_present?(cmd)
+# tests if the given command is present on the local system
+def command_present?(cmd)
+ executable = cmd.to_s.split(" ").first
+ unless system("which #{executable}")
+ logger.important "executable '#{executable}' not present or not in $PATH on the local system!"
+ end
# If a command is given, this will try to execute the given command, as
# described below. Otherwise, it will return a string for use in embedding in
# another command, for executing that command as described below.

0 comments on commit 7497ab0

Please sign in to comment.