(maint) Add Travis CI Support

This patch enables Travis CI support using the travis configuration.
Email notifications are turned off to reduce inbox clutter.

This patch should coincide with enabling Travis CI support for pull requests.
A build status image is also included in the project README.
Merge branch 'feature/master/travis_ci'

* feature/master/travis_ci:
  (maint) Add Travis CI Support
16644 - should have 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 'ripienaar-feature/master/16644'

* ripienaar-feature/master/16644:
  16644 - should have a generic file cache
(maint) Add Travis CI support to active branches

Without this patch all active branches do not have proper Travis configuration
files.  This is a problem because Travis will exercise any branch pushed to the
puppetlabs organization repository on Github.  The default behavior is to email
notifications which is undesirable.

To address this problem Travis configuration settings are added to an active
branch.

Active branches are those that have recent activity when compared against the
following command:

    for k in `git branch -r |perl -pe s/^..//`
    do
      echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;
    done | sort -r | grep origin

Which should produce output like:

    2013-01-06 00:03:10 -0800 14 hours ago  origin/master
    2012-12-27 09:50:20 -0800 10 days ago   origin/1.x
Merge pull request #111 from jeffmccune/feature/1.x/travis_active_branches

(maint) Add Travis CI support to active branches
Merge branch '1.x'

* 1.x:
  (maint) Add Travis CI support to active branches

Conflicts:
	.gitignore
Add deep-merge feature to backend lookups

- Config option :merge_behavior => :native|:deep|:deeper
- Add optional requirement on deep_merge gem to support
  :deep and :deeper options
- Update Yaml backend to use Backend.merge_answer
- Update Json backend to use Backend.merge_answer
Allow both symbols and strings when deciding behavior of merge_answer
Fix undefined method `[]' for nil:NilClass error in yaml_backend_spec.rb

Fix configuration assumptions in yaml backend tests

Without this patch applied the following spec tests are failing.  This
patch fixes the problem by making sure the configuration is initialized
to the default values before running the example group.

    $ rake test
    ............FF.F..................................................................................

    Failures:

      1) Hiera::Backend::Yaml_backend#lookup should ignore empty hash of data sources for hash searches
         Failure/Error: @backend.lookup("key", {}, nil, :hash).should == {"a" => "answer"}
         NoMethodError:
           undefined method `[]' for nil:NilClass
         # ./lib/hiera/config.rb:51:in `[]'
         # ./lib/hiera/backend.rb:153:in `merge_answer'
         # ./lib/hiera/backend/yaml_backend.rb:55:in `block in lookup'
         # ./lib/hiera/backend/yaml_backend.rb:16:in `lookup'
         # ./spec/unit/backend/yaml_backend_spec.rb:74:in `block (3 levels) in <module:Backend>'

      2) Hiera::Backend::Yaml_backend#lookup should build a merged hash of data sources for hash searches
         Failure/Error: @backend.lookup("key", {}, nil, :hash).should == {"a" => "answer", "b" => "answer"}
         NoMethodError:
           undefined method `[]' for nil:NilClass
         # ./lib/hiera/config.rb:51:in `[]'
         # ./lib/hiera/backend.rb:153:in `merge_answer'
         # ./lib/hiera/backend/yaml_backend.rb:55:in `block in lookup'
         # ./lib/hiera/backend/yaml_backend.rb:16:in `lookup'
         # ./spec/unit/backend/yaml_backend_spec.rb:85:in `block (3 levels) in <module:Backend>'

      3) Hiera::Backend::Yaml_backend#lookup should fail when trying to merge an Array
         Failure/Error: lambda {@backend.lookup("key", {}, nil, :hash)}.should raise_error(Exception, "Hiera type mismatch: expected Hash and got Array")
           expected Exception with "Hiera type mismatch: expected Hash and got Array", got #<NoMethodError: undefined method `[]' for nil:NilClass> with backtrace:
             # ./lib/hiera/config.rb:51:in `[]'
             # ./lib/hiera/backend.rb:153:in `merge_answer'
             # ./lib/hiera/backend/yaml_backend.rb:55:in `block in lookup'
             # ./lib/hiera/backend/yaml_backend.rb:16:in `lookup'
             # ./spec/unit/backend/yaml_backend_spec.rb:107:in `block (4 levels) in <module:Backend>'
             # ./spec/unit/backend/yaml_backend_spec.rb:107:in `block (3 levels) in <module:Backend>'
         # ./spec/unit/backend/yaml_backend_spec.rb:107:in `block (3 levels) in <module:Backend>'

    Finished in 0.08651 seconds
    98 examples, 3 failures
Merge branch 'deep_merge_1.x' into 1.x

* deep_merge_1.x:
  Fix undefined method `[]' for nil:NilClass error in yaml_backend_spec.rb
  Allow both symbols and strings when deciding behavior of merge_answer
  Add deep-merge feature to backend lookups
Merge branch '1.x'

* 1.x:
  Fix undefined method `[]' for nil:NilClass error in yaml_backend_spec.rb
  Allow both symbols and strings when deciding behavior of merge_answer
  Add deep-merge feature to backend lookups
(#16089) Reduce scope lookups in parse_string

Slightly modified version of patch from Jeff Goldschrafe (see
https://projects.puppetlabs.com/issues/16089). This version only optimizes the
lookup to the main scope, since this appears to be the only used code path.
This version only optimizes the lookup to the main scope, since this appears
to be the only used code path. This version only optimizes the lookup to the
main scope, since this appears to be the only used code path. This version
only optimizes the lookup to the main scope, since this appears to be the only
used code path.
(#16089) Reduce scope lookups in parse_string

Slightly modified version of patch from Jeff Goldschrafe (see
https://projects.puppetlabs.com/issues/16089). This version only optimizes the
lookup to the main scope, since this appears to be the only used code path.
This version only optimizes the lookup to the main scope, since this appears
to be the only used code path. This version only optimizes the lookup to the
main scope, since this appears to be the only used code path. This version
only optimizes the lookup to the main scope, since this appears to be the only
used code path.
Merge branch '1.x'

* 1.x:
  (#16089) Reduce scope lookups in parse_string
(#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.