if MAKE or make are in the environment, use those instead of rbconfig's
make. necessary for those who built ruby with something other than
GNU make (gmake is required to build mkmf output)
Add a Gem::StubSpecification object to parse specification stublines
Write stubline out to gemspecs
Avoid loading all gemspecs

Parse out "stublines", where available, to retrieve the information
necessary to determine whether to activate a particular gemspec.

This requires sharing some code between Gem::Specification and
Gem::StubSpecification, so I created an abstract BasicSpecification
class to achieve this.
DRY up Specification._all/.stubs

Populate _all from stubs.
Memoize StubSpecification values

Prevents us parsing the stub line / building the objects on each call.
Cache Gem::Version instances for each version string

This prevents having numerous instances of the same value object. In
particular, the use of String#scan in Version#segments is a hot spot. We
could perform the caching there but it seems reasonable to cache the
entire object.
Implement Gem::Specification#to_ary

This is a perf fix. Array#flatten is called in places which contain
nested arrays of spec objects. (For example in
Gem::Specification.find_in_unresolved.) Due to Ruby's implementation of
Array#flatten, it will hit method_missing to try to dispatch the #to_ary
method, which is slow. Implementing a #to_ary like this prevents
method_missing getting called.
Encrypt Private Key before writing to disk.
Ask for passphrase when creating the key for a certificate.
Load encrypted private key using ENV['GEM_PRIVATE_KEY_PASSPHRASE'] as passphrase.
Sign built packages with encrypted key.
Use File.join instead of manual path creation.

This prevents issues, when File.join in #new_default_spec removes
superfluous slashes while they are kept in expected paths. E.g. the test
would fail if ruby configuration specifies --with-ruby-version=''.
Do not add last slash to Gem.user_dir if ruby_version string is empty.
Change private key cipher to AES 256 by default. Re-order arguments to
Gem::Security.write so cipher is last.
Write the private key to disk only when creating it.
Remove check for gem subdirectories.

This check is done later in Installer#pre_install_checks anyway.
Fix #461: Add --host option to owner command
Use the #concat as it is more efficient than push

This only helps on ruby 1.x, but it seems this method is also only ever
called with one argument in current RubyGems.
Extracted DependencyInstaller#available_set_for

Formerly this method existed in Gem::DependencyInstaller#install.

Due to #468 this part of the #install method needs to be changed, but
testing it as part of a complete install will be too clumsy and slow.

Instead we should test just the behavior of picking the initial set.