(PUP-2924) Initialize resources from Type classes

This patch extends the signature of `Puppet::Resource#initialize` to accept
subclasses of `Puppet::Type` as arguments. This allows `resource_type` to be
set during initialzation for some cases and eliminates a later, costly, call to
`environment.known_resource_types`.
(PUP-2349) Treat mode strings as octal

Previously there was logic to convert incoming mode using to_i,
but if it were a String that would convert the string as decimal,
whereas mode is always specified as octal. I don't know why the
to_i conversion was in there and whether it ever worked in a
meaningful way.

So fix this to convert Strings as octal.
(PUP-2349) Specify mode as a string containing an octal mode

Previously, mode was specified in some places as a Fixnum, in others
as a String. Consistently specify mode as a string containing octal.
(PUP-2349) Add deprecation warning for non-string mode property values

The 'future' (4.x) parser treats literal numbers as actual numbers instead of
strings as the 3.x parser did. This makes file resources that use unquoted
mode values behave strangely (see PUP-2156) so we are deprecating non-String
values for mode.

So this change adds a deprecation warning for non-String values of mode
when running with --parser future.
Merge pull request #2964 from kylog/issue/pup-2349/deprecate-non-string-modes-on-file-type

Issue/pup 2349/deprecate non string modes on file type
Merge pull request #2979 from Sharpie/pup-2924-resource-new-types

(PUP-2924) Initialize resources from Type classes
(maint) Cleanup comment

The comment had trailing whitespace and a comma. It makes more sense
without either.
(maint) Extract language specification tools

The resource_expressions_spec contained a useful way of writing language
specification tests. This extracts those out so that they can be reused
in other places.
(PUP-3054) Ensure that inherits are absolute

PUP-121 was supposed to make all references to classes and resource
types absolute, but it looks like it missed a spot. The class referenced
in an inherits clause was not being looked up in an absolute manner,
which caused it to find the wrong parent class in certain cases. This
changes the future parser so that inherited classes are always absolute
names.
(maint) Express language tests in puppet language

This changes the tests of the puppet language, which should become part
of the language specification's example and test suite, to be entirely
expressed in the puppet language. This removes any dependency on ruby!
Well, any dependency on ruby for specifying the language tests.
(perf) Several small performance improvements

This removes some "dev mistake" error checking, which reduces the
overhead of some common calls. It also makes some calls less common,
most notably it caches the environment of a node when it wasn't
explicitly set and it falls back to using Puppet.lookup(:environments).
This can drastically reduce the number of environment lookups in some
situations. For the resource_expression_spec.rb tests, this resulted in
a 0.6 second improvement (~3 seconds to ~2.4 seconds).
(perf) Speed up setting lookup

One of the slowest thing for tests is setting values. They are reset and
changed often. This speeds up a few of the settings code paths by
removing unneeded method calls, either by introducing local variables,
or using delegators. In addition the ChainedValues objects are held on
to so that if the same environment and section is needed again it
doesn't need to be recreated.
(maint) Fix optimization that altered semantics for += production
(maint) Improve two test by checking they have no effect on catalog.

It is now possible by checking if the result of a "produce" had
no effect on the catalog by comparing against an empty array.
Merge branch 'zaphod42-issue/master/pup-3054-incorrect-lookup-in-inherits'
(maint) Use tlsv1 when curling the master from another agent

Various acceptance tests curl the puppet master, and rely on the
installed openssl lib.  With the inclusion of PUP-417, we began
installing the puppetmaster-passenger packages on debian, which
ultimately rely on updated openssl packages being installed on the
puppet master node.  If the agent platfrom was old enough to be using
openssl 0.9.8 (lucid for example), several curl tests began failing
because they were attempting to connect with sslv2 and being rejected.

This patch updates the five failing tests to be explicit about requiring
--tlsv1.
(maint) Use tlsv1 when curling in acceptance in general

For consistency, adjusts remaining curl calls in acceptance/tests to use
the --tlsv1 flag.  Exceptions are the AIX test, and the external ca test
(on rhel6) which are likely to have their own platform specific
requirements outside of testing puppetmaster-passenger on Debian based
distros.
Merge pull request #2988 from jpartlow/maint/master/acceptance-curls-with-tlsv1

Maint/master/acceptance curls with tlsv1
(maint) Require forwardable in puppet/settings.rb

Commit a8e9aa6 extended Puppet::Settings with Forwardable, but did not
require it.  This passed specs, but failed in acceptance when run with
system rubies (locally with rvm/rbenv, we're not seeing a problem).
Requiring forwardable, as we do in other files seems to fix the issue.
Merge pull request #2989 from jpartlow/maint/master/require-forwardable-in-settings

(maint) Require forwardable in puppet/settings.rb