Commit caching on YAML Backend

Previously, the YAML backend would read from disk every time it needed
to check a hierarchy. This commit introduces memoization through an
instance variable so a file is read only if the instance variable is
empty, and only if the file has not changed. To check if the file has
changed (or if the cache is stale), we stat the file and compare the
mtime, size, and inode. Tests have been added for this new
functionality.

Fix Bugs and Commit Tests
(#13641) Fix Hiera::Backend#parse_string to support :undefined in extra_data

The method #parse_string supports an extra field 'extra_data' which is used by
hiera-mysql. When combined with hiera-puppet, sometimes the symbol :undefined
is returned, to signify that the data is undefined in Puppet.

While we do have tests and code to capture this state, the method does not
support falling back to 'extra_data' in this situation.

This patch supports the proper fallback to extra_data if it sees the special
symbol :undefined, so that these backends can be properly combined.
Merge branch 'ticket/master/13641'

* ticket/master/13641:
  (#13641) Fix Hiera::Backend#parse_string to support :undefined in extra_data

Reviewed-by: Daniel Pittman <daniel@rimspace.net>
Reviewed-by: Ken Barber <ken@bob.sh>
(#14124) Load rake tasks directly to fix tests for Ruby 1.9.x

The way we loaded rake tasks was not compatible with Ruby 1.9.x, as it relied
on the fact that Ruby 1.8.x included . in its load path. This patch loads our
rake tasks directly instead.
(#14147) Handle lack of rubygems gracefully

Hiera previously expected rubygems to be available. When running from source or
a package, rubygems may not be available. This fix rescues the load error on
rubygem and silently ignores it so that if rubygems is present, it can be used,
but if it isn't present, hiera can still function.
(#14148) Add docs to Hiera packaging

Previously hiera packaging did not include CHANGES.txt, COPYING, or README.md.
This commit adds them to the gem spec and the tarball, so they can appear in
future releases.
(#14150) Use tar_gz instead of tar

This replaces tar with tar_gz so that the package task will produce tar.gz
instead of .tgz, which is more in line with other puppet products.
Merge pull request #40 from kbarber/ticket/master/14124_ruby19_broken_rake

(#14124) Load rake tasks directly to fix tests for Ruby 1.9.x
(maint) Fix failing spec test on Ruby 1.9.3

Without this patch the specs tests do no pass on Ruby 1.9. The output
for `Load Errors` has changed between Ruby 1.8.7 and 1.9.3. This causes
the `Hiera#logger` spec to fail on Ruby 1.9.3 as we are relying on the
output from 1.8.7.

Instead of relying on a string which is subject to change in the future,
we are now checking that the correct logger is being used.
Merge pull request #42 from haus/ticket/master/14148_add_docs_to_package_rake_task

(#14148) Add docs to Hiera packaging
Merge pull request #43 from haus/ticket/master/14150_use_tar_gz_for_packaging

(#14150) Use tar_gz instead of tar
Merge pull request #44 from kelseyhightower/maint/master/fix_failing_spec_on_19

(maint) Fix failing spec test on Ruby 1.9.3
Merge pull request #41 from haus/ticket/master/14147_handle_rubygems_gracefully

(#14147) Handle lack of rubygems gracefully
(maint) Make noop logger work on Ruby 1.9.x

With out this patch the noop logger does not load on Ruby 1.9.x when
running Hiera from the CLI. Instead we get the follow error:

    LoadError: cannot load such file -- hiera/noop_logger

This patch resolves this issue by moving the noop_logger definition from
`bin/hiera` to `lib/hiera/noop_logger.rb`
Merge pull request #45 from kelseyhightower/maint/master/make_noop_logger_work_on_ruby19

(maint) Make noop logger work on Ruby 1.9.x
Merge pull request #39 from glarizza/bug/master/13600_hiera_cache

Implement caching on YAML Backend
match data in puppet ${::fact} style to get rid of puppet deprecation warnings
(#13600) Monkey patch mktmpdir on ruby 1.8.5

The yaml_backend spec test uses mktmpdir in its tests, which is not available
on ruby 1.8.5. This fix defines mktmpdir using the 1.8.7 method if the method
is not available, as is the case in ruby 1.8.5. It defines the method if needed
in the spec_helper file, and the requires in the yaml_backend_spec are
reordered to ensure that spec_helper is required last, so that it will know if
mktmpdir needs to be defined.
Merge pull request #47 from haus/ticket/master/13600_fix_specs_on_ruby_1_8_5

(#13600) Monkey patch mktmpdir on ruby 1.8.5
Add hiera.spec for building hiera on redhat

This commit adds a specfile that can be used as a base for building rpms of
hiera on redhat based systems.