Skip to content
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...
1 parent 336330d commit 7497ab033c060c9facdeb1390637e0d330aefcef @jweiss jweiss committed Sep 8, 2009
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/capistrano/recipes/deploy.rb
View
9 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)
`#{cmd}`
end
+# 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
+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.
Something went wrong with that request. Please try again.