Sha256: b600af09b4b42602c1199a96d70487ef9ef7dd719c76969062105a0edec239e3
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
module Capistrano module Deploy class LocalDependency attr_reader :configuration attr_reader :message def initialize(configuration) @configuration = configuration @success = true end def command(command) @message ||= "`#{command}' could not be found in the path on the local host" @success = find_in_path(command) self end def or(message) @message = message self end def pass? @success end private # Searches the path, looking for the given utility. If an executable # file is found that matches the parameter, this returns true. def find_in_path(utility) path = (ENV['PATH'] || "").split(File::PATH_SEPARATOR) suffixes = RUBY_PLATFORM =~ /mswin/ ? %w(.bat .exe .com .cmd) : [""] path.each do |dir| suffixes.each do |sfx| file = File.join(dir, utility + sfx) return true if File.executable?(file) end end false end end end end
Version data entries
4 entries across 4 versions & 1 rubygems