(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
(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.
(21868) Move facter libary target to /Library/Ruby/Site

We currently drop the facter library files in /usr/lib/ruby/site_ruby/1.8
OSX, which is a symlink to /Library/Ruby/Site/1.8. As of OSX 10.9 Maverick
this will no longer work because it will be ruby 2.0.0. There are hard way
and easy ways to solve this problem. A hard way would be to somehow
introspect the target host at install time, and then dynamically copy the
payload into the correct ruby version specific path. Another hard way woul be
to create different OSX packages for different versions of OSX. Or, we could
pick the easy way, which is to just install into /Library/Ruby/Site (the
equivalent of /usr/lib/ruby/site_ruby). Since facter will work on all rubies
shipped with supported versions of OSX, this will "just work".

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
(#22233) Warn but do not fail if find gce facts without json lib

Previous patch to GCE would fail outright if there were GCE facts to
parse, but we had no JSON library.  It is better if Facter is allowed to
gather what facts it can rather than failing outright, so this change
just warns that we cannot load GCE facts due to missing JSON gem,
similar to how we warn if there is a problem parsing the GCE facts.

Also fixes up specs a little for consistency and to remove unused
references.
Merge pull request #467 from jhcarr/learning/master/noTicket-flayFacter

(maint) Refactor hpux_spec.rb to reduce test redundancy
Merge pull request #527 from MosesMendoza/ticket/master/21868_fix_apple_target

(21868) Move facter libary target to /Library/Ruby/Site
Merge pull request #512 from ccaviness/22005-install-to-top-level-site_ruby

21760/22005 update preflight to delete old lib dir
Merge pull request #522 from zaphod42/issue/stable/help-on-1.9.3

(#15586) Use OptionParser for help
Merge pull request #521 from melissaanne/maint/stable/re-141_rm-eol-f17

(Bug #22238) Remove EOL f17
Merge pull request #528 from jpartlow/issue/master/22233-gce-warns-but-does-not-fail-if-missing-json

(#22233) Warn but do not fail if find gce facts without json lib
(#22334) Use Facter's logging system for warn

Several points in facter would use ruby's built in warn method, which
always prints to stderr. This made unstoppable messages show up on the
stderr such as:

  [vagrant@localhost ~]$ facter virtual
  Could not retrieve virtual: Permission denied - /sys/firmware/dmi/entries/1-0/raw
  virtualbox

By using facter's normal logging system, the user has control of these
showing up and they won't end up in stderr (which might be going nowhere
in a daemonized process).
Merge pull request #529 from zaphod42/issue/stable/22334-logging-to-stderr

(#22334) Use Facter's logging system for warn
(maint) Cleanup whitespace errors
Clean up some trailing whitespace.
(#22233) Remove filters for the tests

Without this patch an example is excluded entirely if the `json` library
is not available.  If it is available then a related example is removed
instead.  This is a problem because it isn't clear why the examples are
being removed when the tests are run.

This patch addresses the problem by marking the first test as pending if
the json library is not available.  The second test always runs with
this patch applied because the patch mocks the behavior of JSON being
absent even if it is present during the test.
(#22233) Replace expect().to with .should

Without this patch we're seeing test failures on the Solaris 10 spec
system.  These failures are caused by the system not respecting the
dependencies specified in the Gemfile.  This patch addresses the problem
by changing the tests to use rspec 2.9 compatible syntax since this is a
faster route to a green build than changing the spec system itself.

This patch will be reverted once the Solaris 10 spec system has been
updated to respect the Gemfile.
Merge branch '22233_cleanup'

* 22233_cleanup:
  (#22233) Replace expect().to with .should
  (#22233) Remove filters for the tests
  (maint) Cleanup whitespace errors Clean up some trailing whitespace.