Module: Simp::CommandUtils
- Included in:
- LocalGpgSigningKey, Rake, RpmSigner
- Defined in:
- lib/simp/command_utils.rb
Instance Method Summary collapse
Instance Method Details
#which(cmd, fail = false) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/simp/command_utils.rb', line 5 def which(cmd, fail=false) @which_cache ||= {} if @which_cache.has_key?(cmd) command = @which_cache[cmd] else command = Facter::Core::Execution.which(cmd) @which_cache[cmd] = command end msg = "Warning: Command #{cmd} not found on the system." ( fail ? raise(msg) : warn(msg) ) unless command command end |