Implement `which(command)` for windows
@private
# File lib/aruba/platforms/windows_which.rb, line 76 def initialize @whiches = [] @whiches << AbsoluteOrRelativePathWhich @whiches << ProgramWhich @whiches << DefaultWhich end
Find fully quallified path for program
@param [String] program
Name of program
@param [String] path
ENV['PATH']
# File lib/aruba/platforms/windows_which.rb, line 90 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
# File lib/aruba/platforms/windows_which.rb, line 101 def windows_executable_extentions ENV['PATHEXT'] ? format('.{%s}', ENV['PATHEXT'].tr(';', ',').tr('.','')).downcase : '.{exe,com,bat}' end