(#17434) Revert "Merge pull request #29 from timurbatyrshin/puppet-style"

This reverts commit b48694063d890b821928cf578defff1d70084845, reversing
changes made to 422c386f36980d5e080666ec0d12137ad0bc7ba9.

This change caused top scoped lookups (eg "%{::var}") to be retrieved from a
local scope.

Conflicts:
	lib/hiera/backend.rb
(#18718) Load logger classes eagerly

The old behavior of autoloading the logger classes, as well as a few
other classes, isn't needed because those classes are always around and
there is no harm in loading them. By loading them eagerly things become
a bit more predictable.
(#18718) Create logger to handle fallback

Sometimes a logger has been configured, but is not suitable for being
used. An example of this is when the puppet logger has been configured,
but hiera is not being used inside puppet. This adds a FallbackLogger
that will choose among the provided loggers for one that is suitable.

The FallbackLogger assumes a new method on loggers called #suitable?.
This method, if present, returns true if the logger will work and false
if it won't work. If there is no #suitable? method, then the
FallbackLogger assumes that the logger is suitable, which is for
backwards compatiblity with existing loggers.
(#18718) Enable console fallback when logger not suitable

Given the current configuration system for hiera, there is only ever one
logger that is configured. If that logger ends up not being suitable,
then we will always fall back to console logging.
(#18718) Implement suitablity check for puppet logger

The puppet logger is only able to be used if Puppet is available. This
is done with a simple check for the existance of the Puppet constant.
(#17434) Add YARD for #parse_string
(#17434) Clarify tests for #parse_string
(#17434) Add tests to exclude unwanted lookups

The changes made in GH-29 (commit 3ec4165) caused a sequence of unwanted
lookups to occur. It was originally conceived as a way to get rid of
deprecation warnings that puppet was issuing (incorrectly issuing) when
looking up facts without preceeding the lookup with ::. The change,
however, also had the effect that if a variable contained :: and did not
exist, then hiera would end up in an infinite loop trying to resolve the
interpolation.

This adds tests to assert that we don't try to do that kind of "smart"
lookup by trying to clarify that the lookup is simply on exactly what is
contained inside the %{} inside the string.
(#17434) Stronger assertion about how keys are looked up

It turns out that the current behavior is that even whitespace is
significant when looking up a value for string interpolation. This adds
a test for that case.
(Maint) Describe desired behavior in backend specs

The names used for the previous tests of the Backend code were very
tightly tied to the implementation and did very little to describe the
desired behavior. This tries to reword them in a manner that makes the
behavior that is expected more clear. It also removes the constant use
of the word "should" in favor of more specific and active verbs.
(#17434) Simplify string interpolation

The previous implementation for string interpolation was hard to follow
and see what was being done. This replaces it with an implementation
that relies entirely on gsub.
(#17434) Simplify logic around looking up values

This inverts the if statement used for looking in the scope or the
extra_data. At the same time it uncovered a bug, and fixes it, whereby
if the extra_data contained boolean false, it would be ignored. The new
behavior is that a false value in the extra_data is used rather than
changed to nil.
Merge pull request #117 from zaphod42/issue/1.x/18718-hiera-puppet-logger-cli

(#18718) Fallback to Console if Puppet not available
(#16644) Add a generic file cache

Add a general file cacher in Hiera::Filecache based on the work that was
done in the YAML backend.

Adjust the YAML and JSON backends to use this cache and update tests

The YAML tests had a bunch of unneeded calls to YAML.load in them so
refactored those to have the already-parsed data in them like the JSON
backend has
Merge branch '1.x'

* 1.x:
  (#16644) Add a generic file cache
  (#18718) Implement suitablity check for puppet logger
  (#18718) Enable console fallback when logger not suitable
  (#18718) Create logger to handle fallback
  (#18718) Load logger classes eagerly

Conflicts:
	lib/hiera.rb
(#17434) Support recursive interpolation

The original code for interpolation had, hidden somewhere in its depths,
supported recursive expansion of interpolations. This adds that support
back in.
(#17434) Detect loops in recursive lookup

The recursive lookup functionality was vulnerable to infinite recursion
when the values ended up referring to each other. This keeps track of
the names that have been seen in order to stop a loop from occuring. The
behavior for this was extracted to a class so that it didn't clutter the
logic of variable interpolation. The extracted class also specifically
pushes and pops on an internal array in order to limit the amount of
garbage created during these operations. This modification should be
safe so long a new Hiera::RecursiveLookup is used for every parse that
is done and it doesn't get shared in any manner.
Add contributing document to Hiera

Without this patch the contributing guidelines are not clear.  This
patch addresses the problem by copying the same CONTRIBUTING document
used with Puppet, Facter and stdlib.

[ci skip]
Merge pull request #116 from zaphod42/issue/1.x/17434-parse-string-top-scope

(#17434) Do not fall back to different lookups
Merge branch '1.x'

Conflicts:
	lib/hiera/backend.rb