class Aruba::Platforms::UnixWhich::ProgramWhich
Find path for command
Public Class Methods
Source
# File lib/aruba/platforms/unix_which.rb, line 37 def self.match?(program) Aruba.platform.command?(program) end
Public Instance Methods
Source
# File lib/aruba/platforms/unix_which.rb, line 41 def call(program, path) # Iterate over each path glob the dir + program. path.split(File::PATH_SEPARATOR).each do |dir| dir = Aruba.platform.expand_path(dir, Dir.getwd) next unless Aruba.platform.exist?(dir) # In case of bogus second argument found = Dir[File.join(dir, program)].first return found if found && Aruba.platform.executable?(found) end nil end