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
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/simp/command_utils.rb', line 8 def which(cmd, fail = false) @which_cache ||= {} if @which_cache.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 |