(#16376) Fix rails compatibility layer for activerecord < 3.0

Previously an alias was attempted between scope and named_scope to allow older
activerecord versions (< 3.0) to work with the inventory service while also
supporting modern activerecord. The scope alias failed because
Puppet::Rails::InventoryNode inherits from ActiveRecord::Base, which has a
scope method already. So activerecord's scope method is found instead of the
intended alias target. This commit removes the alias and simply switches on
activerecord version to use the correct scope (AR >= 3.0) or named_scope (AR <
3.0) method.
fail better in package repo rake tasks

This commit modifies the top level Rakefile to only
load the packaging repo yaml file if it exists, as
well as provide some error handling for other unwanted
conditions that may arise as a result of trying to
set up the packaging repo.

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
Merge pull request #1171 from MosesMendoza/maint/2.7.x/cleanup_package_repo_rake_tasks

fail better in package repo rake tasks
(#16585) Remove dead ldapnodes setting

This setting has been dead code since 0.24.0, and its value is never read.
This commit removes it.
Revert "Revert "Merge branch 'fix/3.x/7316_load_faces_from_modulepath_try3' into 3.x""

This reverts commit ef3fe695fd0be5ff2b5aeb563f34f62a0f503831.
(#7316) Add spec coverage for Puppet::Application::Master#app_defaults

Without this patch we don't have any spec test coverage for the
app_defaults instance method of the Puppet::Application::Master class.
This lack of coverage is problem because cherry picking the confdir and
vardir patch from PR-882 in commit b064ee63 appears to work just fine
after resolving the merge conflicts.  Things were not fine, however,
because the app_defaults method makes a call that raises an exception
and none of our spec tests caught this issue.

The acceptance tests did, however, by exercising the command `puppet
master --configprint pidfile`
(#7316) Do not set default values for confdir and vardir in the master

Without this patch applied `puppet master` will explicitly set the value
for confdir and vardir inside of
Puppet::Application::Master#app_defaults.  This is a problem because
it calls a method that does not exist while trying to do so.

This patch fixes the problem by implementing the intended behavior
documented in #15337, and specifically in commit 38cba0a.  This intended
behavior is:

  1: If provided, use explicit puppet.conf in `--confdir`
  2: If root, use system puppet.conf
  3: Otherwise, use ~/.puppet/puppet.conf
(maint) Add .yardopts file

This patch makes it easy to generate documentation, including private
methods.  The assumption is that code will be marked up in markdown
style yard comments.  YARD tags are documented at: [YARD Tags
Overview](http://rubydoc.info/docs/yard/file/docs/Tags.md)

The YARD documentation is currently intended for Puppet developers and
community contributors.  While useful for end users, YARD documentation
is not intended for new users or end users who are not developing on
Puppet.
(maint) Add yard generated documentation to git ignore

This patch simply adds the yard generated documentation to the gitignore
list.
(#16637) Add spec test for non-root puppet master confdir and vardir

This patch simply adds test coverage to catch regressions in
[16637](http://projects.puppetlabs.com/issues/16637)
(#16637) Fix default confdir and vardir with puppet master as normal user

Without this patch `puppet master` will select the wrong default confdir
and vardir values when running as a non root user.  This is a problem
because permission denied errors result trying to create the system
directories when running as a non-system user.

This patch fixes the problem by removing the explicit check for the
master run mode in Puppet::Util::RunMode#which_dir
Merge pull request #1136 from haus/ticket/2.7.x/16376_update_rails_compatibility_layer

(#16376) Fix rails compatibility layer for activerecord < 3.0
Merge pull request #1194 from jeffmccune/fix/3.0.x/16637_default_confdir_and_vardir

(#16637) Fix default confdir and vardir with puppet master as normal user
Merge pull request #1190 from jeffmccune/fix/master/7316_load_faces_from_modulepath_try4

(#7316) Do not set default values for confdir and vardir in the master

Conflicts:
	lib/puppet/settings.rb

Merge conflict config file parsing related to a disallowed section replicated
in the config_file.rb parser.
(Maint) Clean up config file parsing

The main loop of parsing the config file has a lot of error handling
directly in it. This makes it harder to follow the main flow and less
obvious what it is doing. This pulls out some of that checking and
removes duplication around creating a new section.
(#15717) Require puppet/run in the agent

Commit 81c73fd0d0d0a9ad4a7f2cb5386d5956739a89aa had accidentally removed
any requires of the `puppet/run` file and so the code needed for kick
was not being loaded. This adds loading of that file back into the agent
application.
(#15717) Allow pluginsync as an option to Puppet::Run

Commit 62420c6ff02133e7bf6254cff83ddb3511a1ea41 changed the way that
agents decided to perform a pluginsync to have a flag passed in. The
initialize method of Puppet::Run tries to validate the options passed in
and failed when it recieved the new option. This makes the new option
validate and restores the ability to use puppet kick.
(#16757) Only load rubygems in bin/puppet

Under some setups it is necessary that we don't load rubygems ourselves (such
as running bundler in stand-alone mode). This change gives the user control
over loading rubygems, at the cost that they are now required to load rubygems
if loading puppet with rack.
(#16757) Don't load rubygems if bundler is running

If bundler is handling gems we don't want to load rubygems ourselves, as it
can conflict and cause loading of system gems beyond what bundler has set up.
Fix up dependencies for Hiera and Facter in RubyGems.

Since Puppet 3.0 promises to follow semver, the dependencies should take
this into account. This means now that only patch releases of Facter and
Hiera will be pulled in for patch releases of 3.0, and the version
dependency must be bumped for any minor or major release appropriately.

This also fixes a bug in the Hiera dependency due to the segment
comparisons in the RubyGems version resolver. Because there was no `.`
before the `rc` in the current dependency (`1.0.0rc`) this resulted in
the comparator looking at `1.0` and selecting the first version `>=`
than it, in this case `1.1.0.rc`. I assume this is unintended and that
the target was meant to resolve to Hiera `1.0.0`.