Allow users to enable profiling via a setting

Prior to this commit, there is no way for an end user to enable
the new profiling features other than by patching their source
code or passing an extra query parameter to a web request,
which requires them to know the precise URL / query params / POST
body of the request that they want to profile, as well as passing
all of the necessary SSL-related flags to `curl` (et al) so that
their request can be authenticated.

This commit simply adds a boolean setting called 'enable_profiling'
which can be used to turn on this functionality for all requests.

We should provide more precise ways for users to control this, but
this at least gives them a simple option until we have something
better.
Add support for enabling profiling via HTTP header

This commit changes the new setting for enabling profiling from
"enable_profiling" to simply "profile", so that it's easy to
use it from the command line.

It also changes the mechanism for enabling profiling in an HTTP
request; previously, profiling would be enabled via a special
query parameter; now it is enabled via a header (X-Puppet-Profiling).

This allows it to work easily for any type of HTTP request
(GET/POST/HEAD/etc.) without having to worry about the means for
adding a query parameter.

The commit also adds a check for the `profile` setting during
outgoing indirector REST requests, and adds the header if the setting
is enabled.  This means that the profiling flag will work from
the client as well as on the server.
(maint) Readd execute permission to bin/puppet

While doing testing around GH-1582 I wound up using a shared filesystem
with Windows, which casually stomped the execute permission for
bin/puppet. This commit readds the execute bit.
Merge branch 'maint-execute_permission_bin_puppet'
(maint) Update rake spec code loading to match rspec

A shared behavior file located in spec/unit was getting loaded multiple
times if rake spec was invoked. The rspec default behavior loads all
files named *_spec.rb but the rake spec pattern was loading all ruby
files. This commit matches the rake spec behavior to match the rspec
behavior.
Merge branch 'maint-rake_spec_code_loading'
(#19128) Make PSON handle unicode characters

This is mostly copied code from json_pure 1.7.7

And a test that this works (only effective on Ruby 1.9+)
Merge pull request #1589 from dalen/19128_pson_unicode

(#19128) Make PSON handle unicode characters
Revert "Merge pull request #1543 from hlindberg/vendor-rgen"

This reverts commit 493e9208b77feb2d2b3931a694c39c98dfef8b00, reversing
changes made to 8391248c198982e668128368bcd2adfe4bed1890.

We've decided that it will be better in the long run to depend on a
packaged rgen instead of trying to have a copy of it shipped inside
puppet.
Revert "Merge pull request #1542 from hlindberg/vendor"

This reverts commit 8391248c198982e668128368bcd2adfe4bed1890, reversing
changes made to 45ded7da5846e02d24fafddd58d05685de039d88.

Remove the vendoring code. The decision has been made to be much more
restrictive in what we will vendor. Until we actually have something to
put in the code in this manner, we should't keep this vendoring system
floating around.

Conflicts:

	lib/puppet/vendor.rb
(Maint) Depend on rgen for development

With the removal of rgen in the codebase, we need to depend on it using
bundler for development and the packaging system in other cases.

Later changes will add the correct dependencies for the packages.
Merge pull request #1590 from zaphod42/maint/master/remove-rgen-and-vendoring

(Maint) Remove vendoring and rgen
(Maint) Update Gemfile to allow excluding extra gems

We normally have a concept of "basic" and "extra features", but the
Gemfile didn't contain this difference. This updates it to work with
that distinction and also cleans up the handling of the specific git
branches for our (bad) mixture of having a gemspec and not.
(maint) Enable logging for all `puppet doc` commands

Without this commit the --debug and --verbose flags can only be used
with the rdoc mode and doesn't interact with the other documentation
types. This commit extracts the logging configuration to apply to all
documentation modes.

In addition this defaults the log level to :warning. Since warning and
above messages will be emitted on stderr this will not affect the normal
operation of the `puppet doc` command. Using --debug or --verbose will
emit messages on stdout, so they should not be used while
programmatically generating docs.
Merge branch 'adrienthebo-maint-enable_logging_for_all_docs'

* adrienthebo-maint-enable_logging_for_all_docs:
  (maint) Enable logging for all `puppet doc` commands

closes #1580
(Maint) Ensure that 'hiera-puppet' is loaded correctly

The test for the hiera_* functions showed an interesting error. If the
hiera_hash or hiera_array tests were run in isolation they would
complain that Hiera was not defined and then fail. If the hiera_include
tests were run beforehand, then the tests for hash and array worked as
expected. The issues seems to have been that the require that brought in
hiera was being delayed until too late. By making sure that hiera-puppet
is loaded as soon as the function is defined, rather than called, we are
certain that hiera will be around when we need it.
(Maint) Ensure that activerecord tests are isolated

The activerecord based tests would setup activerecord and rails in a
manner that included stubbing. This made some things behave as you might
want, but caused some manner of getting them to behave the wrong way. By
removing the stubbing, the test cases all work from a clean database.

Another issue occured when one of the tests assumed that no other code
that used its indirection had been run prior to it. The test itself was
very questionable and ended up breaking when the tests were run in a
particular order. The test in question tried to assert that the code
would setup activerecord when it was initialized. Since all of the other
tests relied on this, and that particular behavior did not appear to be
important to the external contract of the class, the test has been
removed.
(Maint) Lazily load the activerecord code

Turns out that if you try to load activerecord when it isn't available,
things don't work. One of our test configurations tests without
activerecord and so the loading of this code needs to be delayed until
we know that we really want to run these tests.
(Maint) Provide JUnit output for jenkins

Without JUnit style output we don't have a good way of seeing test
failures within jenkins. This adds a new rake task ci:spec that will
run with junit output, descriptive output and spec order logging.

It turns out that some of the tests would call safe_posix_fork which
ended up closing all open file handles. This ended up also closing the
file handle that rspec would hold open for the junit output formatter.
Those tests have been modified to ensure that the file descripters are
not actually closed.
Provide a high level description of testing within puppet