Class: Aruba::Platforms::UnixWhich::ProgramWhich
- Inherits:
-
Object
- Object
- Aruba::Platforms::UnixWhich::ProgramWhich
- Defined in:
- lib/aruba/platforms/unix_which.rb
Overview
Find path for command
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
Instance Method Details
#call(program, path) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/aruba/platforms/unix_which.rb', line 39 def call(program, path) # Iterate over each path glob the dir + program. path.split(File::PATH_SEPARATOR).each do |dir| dir = Aruba.platform.(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 |