(#18636) Remove reference to non-existant token

There is no CLASSNAME token. By trying to create the acceptable? method
for it the code actually created the acceptable? method on nil.
(#18636) Change to friendlier way of specifying suitability

The previous way of setting the suitability of a token was very hard to
grasp for my feeble mind. It also caused RDoc to have problems parsing
the code unless developers were always aware that they had to enclose
the method definitions in stopdoc/startdoc.

This changes it to provide a proc that determines suitability rather
than trying to change the class after the fact. There may be a small
performance hit because it is now two method calls, but I think this is
much more maintainable.
(#16752) Add support for pkg.conf on openbsd

Previously only local file sources were supported for openbsd
packages. Pkg.conf is a mechanism that openbsd uses to download
packages from HTTP sources as well. This patch adds checking for
the presence of 'installpath' lines in pkg.conf and, if one
are found and if the last character of an installpath line is a
::File::SEPARATOR (aka `/` character on openbsd) then it will
become the value of the environment variable PKG_PATH previous to
pkgadd invocation, which tells pkgadd to use the URL.
(#16752) Add tests for reading installpath from /etc/pkg.conf

This commit adds tests for reading installpath from /etc/pkg.conf in the
case that a 'source' has not be specified for the package.
(#16752) Better installpath validation

Previously, if pkg.conf contained an invalid installpath, then the
openbsd package provider would accept it and set it as the package
source. For example, `installpath`, `installpath=`,
`installpath=/path`.

This commit adds better input validation, so that we only set the
package source if the regexp matches, otherwise we raise.
(#16752) Added additional tests and allow key=value

This commit adds tests to improve regexp detection. It also modifies the
regexp to accept `installpath=path`, as openbsd does not require spaces
around the equals sign.
(#16752) Refactor spec test

Previously, the spec test replicated logic for how pkgadd is invoked,
and did so inconsistently  -- whenever the resource's source ends in a
slash, the get_version method gets called which invokes `pkginfo -I
bash`, and the corresponding expectation was only sometimes set.

This commit moves to two types of install expectations to helper
methods, converts the test to use `let` blocks, and sets the parameters
on the resource directly, instead of needing to define a `package`
method. It also adds a test to ensure the source parameter is updated.
(#18755) Consider prerelease gems in the search path

Previously, if puppet 3.0.2 and 3.1.0.rc1 gems were installed using
rubygems version 1.8 or greater, then puppet's autoloader would load
code from both gems, giving precedence to the older gem.

Puppet's settings code was loading the `Puppet::Type::Group` class from
the 3.0.2 gem, but trying to call the `#exists?` method that was added
in 3.1.0rc1, resulting in the "undefined method 'exists?' for nil"
error.

The root cause was due to `Gem::Specification.latest_specs` ignoring
prerelease gems, by default, so it would report that the latest spec was
3.0.2. Yet, executing `require 'puppet'` would activate the prerelease
gem, 3.1.0.rc1, causing its lib dir to be appended to $LOAD_PATH.

And since Puppet's autoloader combines the rubygems directories and
$LOAD_PATH (roughly in that order), version 3.0.2 would take precedence.

Note this issue is specific to rubygems 1.8 and up, since when using
previous versions, puppet calls the deprecated method
`Gem.latest_load_paths`, which alread considers prerelease gems when
determining the latest installed gem.

This commit simply modifies the call to `Gem::Specification.latest_spec`
to consider prerelease gems when determining the latest installed
version.
(#18636) Create only one always acceptable Proc

The previous code would create a new Proc that returned true for every
instance of Token. This commit changes it so that only one is created.
Although there are a finite number of long lived tokens, extracting the
Proc out to a constant provides a name for it, which improves
readability, and reduces the number of objects in memory.
(#18636) Extract named constants for contextual acceptability

The various context checks used to be written inline. This caused a
small amount of duplication and provided no name for when the block
would determine that the token was acceptable. This extracts them all
into constants and places them inside an inner module in order to keep
track of them all. In addition the list of tokens that used to be
constructed for every invocation of several of the blocks are extracted
out and only created once during setup.
Merge pull request #1423 from joshcooper/ticket/master/18755-include-prerelease-gems

(#18755) Consider prerelease gems in the search path
Merge pull request #1379 from joshcooper/ticket/master/16752-openbsd-pkgconf

(#16752) support pkg.conf on openbsd
Merge branch 'issue/master/18636-rdoc-error-when-installing-gem' of git://github.com/zaphod42/puppet

* 'issue/master/18636-rdoc-error-when-installing-gem' of git://github.com/zaphod42/puppet:
  (#18636) Extract named constants for contextual acceptability
  (#18636) Create only one always acceptable Proc
  (#18636) Change to friendlier way of specifying suitability
  (#18636) Remove reference to non-existant token
(#16271) Implement restart action for launchd

Previously, the launchd service provider did not accommodate a restart
action. If a resource attempted the refresh the service, Puppet triggered
an alert but did not actually restart the service. This commit adds a
restart method that calls the stop and then start action on the service
(since launchd doesn't actually have a restart action). Puppet.debug
messages are also raised for debugging purposes.
(maint) Whitespace only cleanup of launchd provider

Just removing some trailing whitespace and ugly blank lines.
Merge branch 'glarizza-bug/master/16271_launchd_restart_action'

* glarizza-bug/master/16271_launchd_restart_action:
  (maint) Whitespace only cleanup of launchd provider
  (#16271) Implement restart action for launchd

closes #1197