(maint) Refactor hpux_spec.rb to reduce test redundancy

Prior to this commit tests for IP facts had significant duplication making it difficult to maintain in the event fixtures change or version support is added or dropped.

This commit consolidates the common features of the tests, making it easier to identify where maintenance should occur as fixtures change.
21760/22005 update preflight to delete old lib dir

In order to install in the top-level site_ruby directory, we need to clean out
any installs in the old site_ruby/1.8 location. We're doing this by setting a
variable in the package:apple task. If it's set, we remove all files there as
well as files in the new location.

While I'm here:
* update erb to strip leading and trailing spaces
* validate critical variables so a script is never generated with dangerous paths
* only target top-level files/dirs in lib, since we're doing rm -RF anyway
Use Dir.glob(), don't require rubygems or rake, use Dir.chdir as a block
(#12116) Windows domain/fqdn error when no domain

This fixes an annoying issue that causes facter to throw errors when domain is
not properly configured or doesn't exist. With this fix, it will properly
return an empty domain and empty fqdn without errorring.

When moving up the chain to the less specific domain fact, added a
windows_hostname command and a check so that it also does not fail with path
not found errors.

Paired-with: Josh Cooper<josh@puppetlabs.com>
Merge remote-tracking branch 'rob/fix/stable/12116_domain_errors_windows' into stable

* rob/fix/stable/12116_domain_errors_windows:
  (#12116) Windows domain/fqdn error when no domain
Merge remote-tracking branch 'upstream/stable'

* upstream/stable:
  (#12116) Windows domain/fqdn error when no domain
(#12116) Don't break on the first interface

Previously, if there were multiple interfaces with IPEnabled on Windows,
we would always use the DNSDomain value from the first interface, even
if it was nil or empty.

This commit changes the domain fact to look for the first non-nil and
non-empty DNSDomain value.
Merge pull request #520 from joshcooper/ticket/stable/12116_first_non_nil_dnsdomain

(#12116) Don't break on the first interface
Merge remote-tracking branch 'upstream/stable'

* upstream/stable:
  (#12116) Don't break on the first interface
(Bug #22238) Remove EOL f17

We're removing support for Fedora 17, because it's gone End of Life.
use instance_variable_get instead of eval
(#15586) Use OptionParser for help

Ruby 1.9.3 dropped Rdoc.usage. The output of `facter --help` depended on
this command. The suggested change from the Rdoc maintainer is to use
the banner of the OptionParser instead. This changes it to use the
banner.
(#22233) Add facts from Google Compute Engine metadata service

Without this patch facter does not report fact values for the data
stored in the Google Compute Engine metadata service.  This is a problem
because the metadata service is a primary vehicle for end users to pass
in information about compute instances.  This information is often
necessary for automated configuration of the compute instances.

This patch addresses the problem by dynamically generating a list of
facts based on the data made available by the http://metadata service in
the GCE environment.  The behavior of these facts is to obtain a JSON
structured hash from the metadata service if the `virtual` fact has the
value of `gce`.
(#22233) Add license information for GCE facts

Without this patch there is no clear licensing information included in
the GCE facts.  This patch adds the license headers.
Merge branch 'erjohnso-gce' closes #523

* erjohnso-gce:
  (#22233) Add license information for GCE facts
  (#22233) Add facts from Google Compute Engine metadata service
(#22233) Guarded json require for gce fact

The gce fact was requiring json, creating a dependency in Facter where
non had existed (except on development/test instances).  This was
producing unwanted errors in Ruby 1.8.7 where the json gem was not
present, and no gce facts were available anyway.

This commit ensures that we only attempt to load json if we are in the
gce environment (as determined by a metadata url resolving) and actually
have gce data to parse.
Merge pull request #524 from jpartlow/issue/master/22233-fix-json-require

(#22233) Guarded json require for gce fact
(maint) Pins redcarpet to < 3.0.0 for Ruby 1.8.7

The redcarpet gem 3.0.0 version does not work in Ruby 1.8.7.

https://github.com/vmg/redcarpet/issues/280
(#22233) Catch json load error for gce when no json gem present

When the specs were run in an environment without the json gem, the
gce_spec.rb would fail, because it was now throwing a LoadError.

Splits the spec into two, guarded by Facter.json? for the expected cases
with and without json present.
Merge pull request #525 from jpartlow/issue/master/22233-fix-json-in-gce-spec

Issue/master/22233 fix json in gce spec