/usr/lib/ruby/vendor_ruby/capistrano/recipes/deploy/local_dependency.rb is in capistrano 2.12.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 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 = self.class.on_windows? ? self.class.windows_executable_extensions : [""]
path.each do |dir|
suffixes.each do |sfx|
file = File.join(dir, utility + sfx)
return true if File.executable?(file)
end
end
false
end
def self.on_windows?
RUBY_PLATFORM =~ /mswin|mingw/
end
def self.windows_executable_extensions
%w(.exe .bat .com .cmd)
end
end
end
end
|