(maint) Untie parser/files and module

The parser/files module was explicitly handling
Puppet::Module::InvalidName, forcing it to require puppet/module. These
errors are being handled by Puppet::Node::Environment at a lower layer,
and we no longer need to couple module and parser/files.

In addition, Pupper::Module#match_manifest ensures that init.pp is
always added if present, which means that explicitly searching for
init.pp would return an array with the init.pp file listed twice. Hence
the added uniq.
(PUP-3268) Remove use of templatedir setting from parser/files

The templatedir setting is deprecated and being removed for Puppet 4.
It was used only in Puppet::Parser::Files to provide an alternate path
location for templates, instead of looking them up in modules. This
commit removes the use of templatedir, allowing paths to be looked up
only from an absolute path or relative to a module.
(maint) Refactor parser/files find helpers

Puppet::Parser::Files#find_file and #find_template methods were
performing the same work to vet an absolute path and lookup a module
prior to calling an implementation specific method on that module. The
find_template method had a helper which this commit generalizes to work
for both find_file and find_template.
(PUP-3268) Remove --manifestdir reference from application/doc

The doc application used --manifestdir as a means of specifying the
directory of manifests to generate docs for in rdoc mode.  Since
manifestdir is being removed for Puppet 4, and the Puppet Strings module
is being used instead for all manifest documentation, this commit
removes references to manifestdir in the doc application.
(maint) Fix two loader issues

This fixes two existing bugs related to the loaders.  The first is that
the Puppet::Pops::Loaders was always looking up the 'production'
environment conf, rather than the environment.conf for the provided
environment.  The second was that the new environment_data_provider
setting was mssing from the Static environment conf class, breaking
Static environment loaders.
(PUP-3268) Use explicit environment references in specs

Specs which relied on legacy environment loaders implicitly generating
environments for unknown environment names need to be updated to use
explicitly created environments. This is because the directory environment
loaders will instead raise environment not found errors.  Since legacy
environments are going to be removed, this change needs to happen before
we add a default to the environmentpath setting and remove the legacy
code.

These specs have been adjusted to either directly supply a created
environment to the methods under test, or to set up a static environment
loader providing some explicitly set of environment(s) to the tests.

I also made some stylistic changes in specs that I was touching to avoid
mocking, replace use of instance variables with let statements, and to
prefer expect over should.
(PUP-3268) Set directory environments as default

Prior to this commit, environmentpath defaulted to the empty string,
which meant that legacy environment loaders would be used. As a first
step to removing the legacy environment code, environmentpath is now set
to "$confdir/environments", defaulting to directory loaders.

In addition, this commit completely removes the deprecated manifestdir
and templatedir settings. It also removes the defaults for manifest and
modulepath, which are only to be allowed in environment.conf and on the
commandline. Enforcement of that is still to be done, as noted by the
XXX_ENV comments. Manifest's default is changed to '/dev/null'.
(maint) Add inspect calls for debugging Settings value sets

These methods just make it a little easier to debug the Puppet::Settings
ChainedValues value sets, avoiding output of the default setting
instance themselves which contain reference to the settings object,
which has all the settings...and produces a lot of output.
(PUP-3268) Set manifest default to nil

The manifest setting can still be set on the commandline but has no
meaningful default.  It was changed to /dev/null as an interim fix,
because a FileSetting has difficulty with "" (its munge method expands
this to current working directory), and with nil (breaks in the Settings
catalog). In this patch, Settings#to_catalog is changed to ignore file
settings with a nil value.

The lack of a default manifest value has an impact on the specs because
many of them execute without a fully initialized settings layer, and
Settings.global_defaults_initialized? is still false. Previously this
was guarding whether or not we would read a directory environment
environment.conf, because we could not be sure of an environmentpath,
but now that this setting has a default, this guard is dropped from
Settings#value_sets_for
(PUP-3268) Remove legacy environment loaders

Removes the Puppet::Environments::Legacy loader now that directory
environments are enabled by default.  As a consequence, attempting to
start up puppet with environmentpath explicitly set to nothing will
raise a Puppet::Error during startup.

For example:

  $confdir/puppet.conf
    [main]
    environmentpath=

will fail.
(maint) Make Puppet::Module#== public

Puppet::Module's equality method was part of a private block for no
reason I could see in the history, and this was preventing specs from
checking that moduleone == sameasmoduleone.  This patch moves ==() up to
where it is public.
(PUP-3268) Remove legacy environment support

Removes the deprecated legacy environment construction and cacheing code
from Puppet::Node::Environment. Continues to use create() for instance
creation; new delegates to create() and is marked private now.
References to clear the legacy environment cache are removed from
Settings and TestHelper. Environment names are explicitly interned on
creation. This was being done already in the environment loaders, so
this change just makes the behavior consistent for manual use of
Puppet::Node::Environment.create().  The node/environment_spec was
overhauled as well to remove mocking and update for current rspec
practices.
(PUP-3268) Remove file watching from environment

File watching for files loaded through the environment was only being
done for legacy environments. Now that legacy environments have been
removed, the file watching code in Node::Environment,
Resource::TypeCollection, and the E4ParserAdapter goes away as well.

The Directories environment loader no longer needs to turn off file
watching for directory environments.

There is still an Environment#check_for_reparse method which tests if
the Puppet[:code] has changed or last parse of the environment failed.
It is called by the resource_type/parser indirector, the parser face and
the parser/compiler, and may no longer be necessary.
(PUP-3268) Remove Environment.current

PUP-1118 removed the global $environment available as
Environment.current, and then PUP-1735 re-added the method with a
deprecation warning, but as a lookup of the Puppet context
:current_environment instead. Now we can remove the method completely
for Puppet 4.
(PUP-3268) Do not lookup [legacy] puppet.conf sections

A named puppet.conf section other than main, master, agent, user was
taken to be an overriding block of environment specific settings prior
to this commit. This behavior provided manifest, modulepath,
config_version when working with a legacy environment, and would
override other settings if the code path looking up a particular setting
happened to submit environment (not all do). With legacy environment
removal, support for reading settings from environment puppet.conf
sections is also dropped. This allowed some additional cleanup of the
settings searchpath and value_sets_for code, in particular, abstracting
the type of the searchpath element so that we can cleanly separate
whether we are obtaining a puppet.conf section named 'main' or an
environment.conf for environment 'main' for instance.
(PUP-3268) Fail if environment settings encounted in puppet.conf

The manifest, modulepath, and config_version settings are environment
specific and were deprecated specifically when being set in puppet.conf,
as opposed to on the commandline or in an environment.conf file.  For
Puppet 4, we are now raising an error if these settings are found in
puppet.conf during initialization.
(PUP-3268) Raise an error for unknown puppet.conf sections

For Puppet 4, switch from deprecation warnings for [legacy] puppet.conf
sections to raising an error during configuration parsing. The only
accepted sections are 'main', 'master', 'agent', 'user'. Refactored how
allowed section names are specified when parsing. The environment.conf
files are handled by the same parser, but merely warn for unknown
settings/sections and ignore them.
(PUP-987) Do not look for ruby manifests in modules

There was additional code in Puppet::Module looking up *.rb manifests in
modules.  Since Puppet 4 no longer supports Ruby DSL, this needed cleanup
as well (in addition to the early work on done on PUP-987).
(maint) Refactor match_manifest

Now that we are only looking up init.pp, we can save a few Array
creation steps and just unshift it to the front of searched if it is not
already present.
(maint) Remove unnecessary Combined loader from module_tool_spec

No point in using the Combined loader wrapped around a single loader.