class Aruba::Platforms::UnixWhich::ProgramWhich

Find path for command

def self.match?(program)

def self.match?(program)
  Aruba.platform.command?(program)
end

def call(program, path)

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