Sha256: a5f33da7e1d6e2a85c03ec27250f7dd9619da1d11dbace11a706d3d4861a36b3
Contents?: true
Size: 596 Bytes
Versions: 4
Compression:
Stored size: 596 Bytes
Contents
# frozen_string_literal: true module Guard # General utils for the gem module BustedUtils # Cross-platform way of finding an executable in the $PATH. # # which('ruby') #=> /usr/bin/ruby # https://stackoverflow.com/a/5471032/4983981 def which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each do |ext| exe = File.join(path, "#{cmd}#{ext}") return exe if File.executable?(exe) && !File.directory?(exe) end end nil end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
guard-busted-1.0.1 | lib/guard/busted/utils.rb |
guard-busted-1.0.0 | lib/guard/busted/utils.rb |
guard-busted-0.1.2 | lib/guard/busted/utils.rb |
guard-busted-0.1.1 | lib/guard/busted/utils.rb |