Skip to content

Commit

Permalink
test if local commands are present and log if not, helps to debug pro…
Browse files Browse the repository at this point in the history
…blems with e.g. git not in $PATH
  • Loading branch information
jweiss committed Sep 8, 2009
1 parent 336330d commit 7497ab0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/capistrano/recipes/deploy.rb
Expand Up @@ -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.
Expand Down

0 comments on commit 7497ab0

Please sign in to comment.