lib/puppet/util.rb in puppet-3.0.2 vs lib/puppet/util.rb in puppet-3.1.0.rc1

- old
+ new

@@ -183,10 +183,17 @@ else yield end end + # Resolve a path for an executable to the absolute path. This tries to behave + # in the same manner as the unix `which` command and uses the `PATH` + # environment variable. + # + # @api public + # @param bin [String] the name of the executable to find. + # @return [String] the absolute path to the found executable. def which(bin) if absolute_path?(bin) return bin if FileTest.file? bin and FileTest.executable? bin else ENV['PATH'].split(File::PATH_SEPARATOR).each do |dir| @@ -487,9 +494,10 @@ # Executes a block of code, wrapped with some special exception handling. Causes the ruby interpreter to # exit if the block throws an exception. # + # @api public # @param [String] message a message to log if the block fails # @param [Integer] code the exit code that the ruby interpreter should return if the block fails # @yield def exit_on_fail(message, code = 1) yield