Permalink
Browse files

Fixes #127 (I hope) by using smarter use of the built-in syntax, this…

… removes the need for a dependency on mkmf, and implements this feature in a way inspired by the example on modifying Kernel.` usage from the second edition pickaxe.
  • Loading branch information...
1 parent 5a676ba commit ab5704a447d4d3c9d1ac53bb11c4c4e86ff7d5d7 Lee Hambley committed Dec 2, 2009
Showing with 13 additions and 19 deletions.
  1. +1 −1 lib/capistrano.rb
  2. +11 −7 lib/capistrano/errors.rb
  3. +1 −11 lib/capistrano/recipes/deploy.rb
View
@@ -1,2 +1,2 @@
require 'capistrano/configuration'
-require 'capistrano/extensions'
+require 'capistrano/extensions'
View
@@ -1,15 +1,19 @@
module Capistrano
- class Error < RuntimeError; end
+
+ Error = Class.new(RuntimeError)
- class CaptureError < Error; end
- class NoSuchTaskError < Error; end
- class NoMatchingServersError < Error; end
+ CaptureError = Class.new(Capistrano::Error)
+ NoSuchTaskError = Class.new(Capistrano::Error)
+ NoMatchingServersError = Class.new(Capistrano::Error)
class RemoteError < Error
attr_accessor :hosts
end
- class ConnectionError < RemoteError; end
- class TransferError < RemoteError; end
- class CommandError < RemoteError; end
+ ConnectionError = Class.new(Capistrano::RemoteError)
+ TransferError = Class.new(Capistrano::RemoteError)
+ CommandError = Class.new(Capistrano::RemoteError)
+
+ LocalArgumentError = Class.new(Capistrano::Error)
+
end
@@ -1,5 +1,4 @@
require 'yaml'
-require 'mkmf'
require 'capistrano/recipes/deploy/scm'
require 'capistrano/recipes/deploy/strategy'
@@ -95,16 +94,7 @@ 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 find_executable0(executable)
- logger.important "executable '#{executable}' not present or not in $PATH on the local system!"
- end
+ `#{cmd}` and (raise LocalArgumentError("#{cmd} returned status #{$?.to_i}") if ($?.to_i > 0))
end
# If a command is given, this will try to execute the given command, as

0 comments on commit ab5704a

Please sign in to comment.