(maint) Don't setup puppet.conf for facter acceptance setup
(maint) Remove monkey patch

Prior to this patch, running spec tests with ruby 2.x
would result in deprecation warnings like so:

/Users/kylo/.rbenv/versions/2.1.0/lib/ruby/2.1.0/delegate.rb:343: warning: IO#lines is deprecated; use #each_line instead

This patch removes the monkey patching that led to those
warnings, and simply changes the code to use each_line rather
than lines, which is apparently supported in all the ruby versions
from 1.8.5 to 2.x.
(FACT-186) Express windows specific gem dependencies

Previously, if a ruby module on windows tried to use facter as a
library, the calling module had to know about facter's platform specific
dependencies. This comes up when trying to develop and test puppet
modules on windows.

This commit adds the windows specific gems (which mirror the Gemfile) to
project_data.yaml. The build pipeline will automatically create an
x86-mingw32 gem in addition to the generic one.
Revert "(maint) Workaround travis/rubygems failures with ruby 1.8.7"

This reverts commit 6ab0a03b53994dd7dd4a0243c31a4d81613dfccf.
Merge pull request #587 from adrienthebo/maint/stable/acceptance-remove-puppet.conf-setup

(maint) Don't setup puppet.conf for facter acceptance setup
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
use instance_variable_get instead of eval
(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>
Merge pull request #593 from MosesMendoza/21868/stable/cherry_pick_mavericks_pkging

21868/stable/cherry pick mavericks pkging
(FACT-186) Consolidate gem runtime dependencies

Previously, the Gemfile and ext/project_data.yaml both described gem runtime
dependencies, the former requiring an exact match, the latter a pessimistic
match.

This commit makes project_data.yaml be the single source of truth, and it
specifies exact versions.

Rubygems and bundler have different ideas about what constitutes a platform.
Rubygems requires an arch and os, e.g. x86-mingw32, while bundler has a
hard-coded list, see Bundler::Dependency::PLATFORM_MAP. As result, we need
to use the rubygems platform when building the facter gem, but use the
bundler platform when expressing gem dependencies.
Merge pull request #589 from kylog/maint/remove-monkey-patch-and-eliminate-spec-warnings-with-mri-2_x

(maint) Remove monkey patch
(FACT-134) Add module for normalizing fact values

This commits adds a module for normalizing fact values to UTF-8, and validating
that the string is properly encoded, e.g. a string may claim to be UTF-8
encoded, but actually contain binary data.
(FACT-134) Normalize and validate fact values

This commit normalizes fact values to UTF-8 and verifies that the resulting
encoding is valid.

On Windows, the default string encoding depends on the active code page. When
adding an environment based fact, e.g. FACTER_one=bar, the value is frozen
and cannot be encoded in place. So we dup fact values that come from the
environment.
Merge branch 'facter-2-output-validation' into facter-2

* facter-2-output-validation:
  (FACT-134) Normalize and validate fact values
  (FACT-134) Add module for normalizing fact values
(FACT-134) Normalize copies of fact string values

Previously, facter would fail to normalize a frozen, non-UTF8 encoded
string, such as the value returned by the `rubyversion` fact.

This commit changes the normalization module to make a copy of the
resolved value, and perform string encoding on that. It also undoes the
change to Factet::Util::Loader that dup'ed environment variables of the
form `FACTER_*`.

Paired-with: Andy Parker <andy@puppetlabs.com>
Merge branch 'issue/facter-2/encoding-frozen-strings' into facter-2

* issue/facter-2/encoding-frozen-strings:
  (FACT-134) Normalize copies of fact string values
(FACT-134) Redo tests so the work on ruby 1.8.x

No String#encode or Encoding in ruby 1.8.x, update tests accordingly.
Merge branch 'stable' into facter-2
Extract Facter execution methods to mixin

The command execution methods in Facter::Util::Resolution were
cluttering up the class and breaking the single responsbility principle.
Leaving them around increases the complexity of refactoring the
Resolution class.

This commit extracts methods related to command execution to a mixin and
extends the Resolution class with the mixin to maintain compatibility.
In the long term we should deprecate the compatibility methods.