class Puppet::Vendor

Simple module to manage vendored code.

To vendor a library:

At runtime, the load_vendored method should be called. It will ensure all vendored libraries are added to the global `$:` path, and will then call execute the up-front loading specified in `vendor/require_vendored.rb`.

The intention is to not change vendored libraries and to eventually make adding them in optional so that distros can simply adjust their packaging to exclude this directory and the various load_xxx.rb scripts if they wish to install these gems as native packages.

Public Class Methods

load_entry(entry) click to toggle source

@api private

# File lib/puppet/vendor.rb, line 33
def load_entry(entry)
  Puppet.debug("Loading vendored #{$1}")
  load "#{vendor_dir}/#{entry}"
end
load_vendored() click to toggle source

Configures the path for all vendored libraries and loads required libraries. (This is the entry point for loading vendored libraries).

# File lib/puppet/vendor.rb, line 46
def load_vendored
  Dir.entries(vendor_dir).each do |entry|
    if entry.match(/load_(\w+?)\.rb$/)
      load_entry entry
    end
  end

  require_libs
end
require_libs() click to toggle source

@api private

# File lib/puppet/vendor.rb, line 39
def require_libs
  require 'puppet/vendor/require_vendored'
end
vendor_dir() click to toggle source

@api private

# File lib/puppet/vendor.rb, line 28
def vendor_dir
  File.join([File.dirname(File.expand_path(__FILE__)), "vendor"])
end