Sha256: 383c4fecad3fb7b26826cfa9651e524b1ab0477d61dc737a4a64ccdeef0850f9

Contents?: true

Size: 761 Bytes

Versions: 1

Compression:

Stored size: 761 Bytes

Contents

# Utility methods for handling system binaries

module Pkg::Util::Tool

  #   Set up utility methods for handling system binaries
  #
  class << self
    def check_tool(tool)
      find_tool(tool, :required => true)
    end

    def find_tool(tool, args={:required => false})
      ENV['PATH'].split(File::PATH_SEPARATOR).each do |root|
        location = File.join(root, tool)
        return location if FileTest.executable? location
      end
      fail "#{tool} tool not found...exiting" if args[:required]
      return nil
    end

    alias :has_tool :find_tool

  end

  #   Set up paths to system tools we use in the packaging repo
  #   no matter what distribution we're packaging for.

  GIT = Pkg::Util::Tool.find_tool('git', :required => :true)

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-2.7.26 ext/packaging/lib/packaging/util/tool.rb