Sha256: 5fb9cd0528735f4ad425c3cef8bb79806a1c9679582432e39b6d16f78572dcd1
Contents?: true
Size: 534 Bytes
Versions: 3
Compression:
Stored size: 534 Bytes
Contents
module Jetel module Helper class << self # Cross-platform way of finding an executable in the $PATH. # # which('ruby') #=> /usr/bin/ruby def which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each { |ext| exe = File.join(path, "#{cmd}#{ext}") return exe if File.executable?(exe) && !File.directory?(exe) } end return nil end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jetel-0.0.15 | lib/jetel/helpers/os_helper.rb |
jetel-0.0.14 | lib/jetel/helpers/os_helper.rb |
jetel-0.0.12 | lib/jetel/helpers/os_helper.rb |