lib/tasks/test.thor
# `which` method to check that required binaries are available
#
`which` method to check that required binaries are available
` which ` method to check that required binaries are available
def which(cmd)
    exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
    ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
      exts.each { |ext|
        binary = File.join(path, format('%s%s', cmd, ext))
        return binary if File.executable?(binary) && !File.directory?(binary)
      }
    end
    nil
  end
def which ( cmd ) exts = ENV [ 'PATHEXT' ] ? ENV [ 'PATHEXT' ] . split ( ';' ) : [ '' ] ENV [ 'PATH' ] . split ( File :: PATH_SEPARATOR ) . each do | path | exts . each { | ext | binary = File . join ( path , format ( '%s%s' , cmd , ext ) ) return binary if File . executable? ( binary ) && ! File . directory? ( binary ) } end nil end
`which` method to check that required binaries are available
` which ` method to check that required binaries are available
cmd
<not_specific>