class Aruba::Platforms::WindowsWhich
Implement ‘which(command)` for windows
@private
Attributes
Public Class Methods
Source
# File lib/aruba/platforms/windows_which.rb, line 75 def initialize @whiches = [] @whiches << AbsoluteOrRelativePathWhich @whiches << ProgramWhich @whiches << DefaultWhich end
Public Instance Methods
Source
# File lib/aruba/platforms/windows_which.rb, line 89 def call(program, path = ENV['PATH']) raise ArgumentError, "ENV['PATH'] cannot be empty" if path.nil? || path.empty? program = program.to_s program += windows_executable_extentions if File.extname(program).empty? whiches.find { |w| w.match? program }.new.call(program, path) end
Find fully quallified path for program
@param [String] program
Name of program
@param [String] path
ENV['PATH']
Private Instance Methods
Source
# File lib/aruba/platforms/windows_which.rb, line 100 def windows_executable_extentions if ENV['PATHEXT'] format('.{%s}', ENV['PATHEXT'].tr(';', ',').tr('.', '')).downcase else '.{exe,com,bat}' end end