(PUP-2752) Fix for invalid semvers

Prior to this commit the module tool would fail to perform any actions if any
module found in the modulepath had an invalid semver.
This commit warns about invalid semvers in installed modules, sets the version to
0.0.0, and moves on. This allows the module tool to continue to work, even with the
invalid semver found in the path. This commit also adds some rudimentary tests
for the Puppet::ModuleTool::InstalledModules class.
(PUP-2732) Use less restrictive exec user validation

Without this patch Puppet agent validates the user attribute of exec resource that way, that it's fully unsupported if running without root user. Doing so, the following error message is printed and execution aborted:
"Only root can execute commands as other users". This patch ignores a given user to run the exec as if it's the same as the user actually running the Puppet agent process.
See https://tickets.puppetlabs.com/browse/PUP-2732 for more information.
(PUP-2918) Clarify missing Modulefile error

Prior to this commit, when building a module without a Modulefile or metadata.json,
the builder would blow up with a cryptic 'Unable to find module root at DIRECTORY'
It's not entirely clear what that means to an end user.
This commit clarifies that metadata.json or a Modulefile are what need to be found
at the module root. Also removes some duplicated logic for checking module root.
(PUP-1186) Ignore PAX header in tar unpacking

Prior to this commit if you installed a puppet module built on a platform with
a tar implementation that adds PAX headers and your platform didn't have a native
tar implementation (Windows), the module would contain junk PaxHeader directories.

This is due to the default POSIX behavior programmed in to minitar (the ruby tar
implementation used for platforms with out native tar) for an unknown typeflag,
such as those used in PAX headers, is to treat it as a regular file and extract it.

This commit adds a pre-scan step to our use of minitar for unpacking that finds
all the files with standard typeflags (0-7) and then only unpacks those, thus ignoring
any Pax typeflags like 'x' or 'g'.
(PUP-2757) Change Puppet::Resource default env to avoid duplicate
parsing.

When a Resource is used as a reference, it still needs to find its type
and will try to find it via known_resource_types in the environment.
Hence, if Puppet::Resource#environment produces the special environment
NONE when the resource is not contained in a catalog (as no references
by definition are) then, the NONE environment will need to be populated
and this triggers a duplicate initial_import).

This commit changes the default environment for a resource to be:

* the environment attribute if set
* the environment of the catalog it is contained in
* the current_environment if set
* the special environment NONE if the other two were not set

This also changes the '*root*' boot context to specify the manifest
to be NO_MANIFEST. This because the defaults otherwise may lead to
loading the entire source tree of puppet when running tests.
(maint) Always pass an arg to shared behavior block
(maint) Require rspec/mocks over deprecated spec/mocks
(maint) Never require rspec/mocks

We use mocha for stubbing and mocking; requiring the rspec mocks as well
will break things in RSpec 2.14.
(maint) Avoid rspec examples using variable behavior

Given an object with an attr_accessor and using an example shortcut like so:

    subject { metadata.to_hash }

    its(:keys) do
      subject.sort.should == %w[ name version author summary license source issues_url project_page dependencies ].sort
    end

The value of subject in the example varies between RSpec 2.11 and 2.13.
This commit removes the shortcut in favor of a slightly longer but more
compatible test that explicitly invokes the #keys method and does an
expectation on that.
(maint) Remove deprecated `.to_not raise_error(args)` calls

From RSpec:

    DEPRECATION: `expect { }.not_to raise_error(SpecificErrorClass, message)` is deprecated. Use `expect { }.not_to raise_error` (with no args) instead.

This commit removes all args from `.to_not raise_error` expectations.
(maint) Remove nonfunctional directoryservice test

It's not possible to test
Puppet::Provider::NameService::DirectoryService without stubbing out a
huge amount of code, which is done by a different test. The removed test
behaved almost identically like the following test so we can remove this
without losing test coverage.
(maint) Replace invocations of `subject` and `let` in `before(:all)`
(maint) Update rspec version to 2.14
(PUP-2919) Enable win32-taskscheduler Ruby2 specs

 - Previously removed in 76cde1ba547b6aed12e8de0b4ec3d7339789ce01 as
   part of https://github.com/puppetlabs/puppet/pull/2846
 - Win32-taskscheduler is Windows x64 / Ruby 2 compatible, and therefore
   these tests can be re-enabled
(PUP-2919) Enable win32-eventlog Ruby2 specs

 - Previously removed in 9449105658cf9789b94cdae096fd904b92828fb8 as
   part of https://github.com/puppetlabs/puppet/pull/2846
 - Win32-eventlog is Windows x64 / Ruby 2 compatible, and therefore
   these tests can be re-enabled
(PUP-2757) Force agent to use a remote 'reference' environment

Puppet application setup, shared by master, agent, apply and others,
would make use of a 'remote' environment (an environment object with nil
modulepath/manifest intended as a reference to the environment on a
master with content dictated by the master), but only when unable to
generate or locate the configured environment.

This commit rearranges the environment setup order slightly to better
ensure that an agent always initializes with a 'remote'
current_environment, unless the user has specifically overridden
--modulepath or --manifest for some painful and obscure reason.

During the Configurer run, we push the final remote environment onto the
context based on what the master has told us in the returned node.

The reason for all of these is so that an environment configured for a
local puppet apply does not taint what gets used during an agent/master
run.
(PUP-2824) Add errors for reserved parameter names

This adds validation of reserved parameter names; $name and $title
that, if they are used will cause problems later in the production
of a catalog.

The implementation performs the checks as part of validation of
the parsed puppet logic.
(maint) Remove unused index in iteration

This replaces a each_with_index with just each since the index
was not used in the logic of the internal_check_no_capture method
in the checker4.0.
Merge pull request #2873 from hlindberg/PUP-2757-avoid-loading-twice

(PUP-2757) Change Puppet::Resource default env to avoid duplicate
Merge pull request #2804 from hlindberg/PUP-2824_reserved-param-names

(PUP-2824) Add errors for reserved parameter names