class RepoMgr::Tools
Holds various tools
Public Class Methods
error(msg)
click to toggle source
# File lib/repo_mgr/tools.rb, line 21 def self.error(msg) warn "-- Error: #{msg}".red Kernel.exit 1 end
which(cmd)
click to toggle source
# File lib/repo_mgr/tools.rb, line 8 def self.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