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.
move common installer setup stuff to a
helper method
Added --abort-on-dependent which prevents uninstalling gems that are depended on.
Offer a solution in credentials permission error
Don't fsync every file when installing gems

d84090b introduced "similar sync behavior from old tar code". It looks
like the old code was fsyncing directories, but the commit was fsyncing
every single file.
Revert "! gem search now defaults to --remote and is anchored like gem list.  Fixes #166"

This reverts commit cefe716e5431dcae8011759847612a215569e93e.
make `gem search` default to remote
fixed typo
Initial support for installing default gems.

The logic here is pulled from MRI's rbinstall.rb default gem logic
and the actual logic for installing gems. The combined logic works
as follows:

* The normal dependency chain is followed, unlike the rbinstall
  logic.
* The gem's full specification (with complete file list) is dumped
  to GEM_HOME/specifications/default/GEM_NAME.gemspec. This covers
  the bulk of the rbinstall logic.
* Only the bin files from the gem are extracted to the normal gem
  install location. This allows a stub binscript to boot from a
  combination of gem's bin and stdlib's libraries, as in the
  rbinstall logic.

Remaining work to do:

* Unpack gem lib and ext contents into appropriate location for
  the stdlib. This will overwrite existing files, and is generally
  intended to do a dev-time update of a given default gem's
  contents in stdlib.
* Install a binstub that works with both stdlib (default gem)
  libraries and installed gems, as in Ruby 2.0's rake, rdoc, ri
  commands. Primarily, this binstub needs to fallback to just a
  simple require when gem loading fails.
Additional fixes for default gems:

* Use :install_as_default to be less ambiguous in options
* Add logic to ensure specification/default dir is created
Add a simple test for default gem installation.
Modify default gemspec registration to support unmodified specs.

MRI 2.0 shipped with its own default spec generator that rewrites
the gemspec file to contain a list of bare require names in
spec.files. This required extra logic in rbinstall.rb and makes
it impossible to simply copy a gemspec from a gem into the default
directory to register that gem as a default gem.

PR #566 adds --default functionality to `gem install` that copies
the gem's unmodified gemspec to the default directory, but since
unmodified gemspec contains a list of gem-relative filenames, it
could not use the old default specification logic.

This commit modifies default spec registration to support both
formats. In the "old" style, specifications are registered with
their raw filenames; we detect old style by checking the first
file to see if it is prefixed with any spec.require_paths. In the
"new" style, spec.require_paths are stripped off the spec's
filenames before registration, and only files that start with a
require_path are registered.

Both the old format and the new format continue to work with this
change, and we can migrate toward default specs being the
unmodified originals rather than custom-built as in MRI 2.0.
cache Gem::Specification.load
whoops fix tests for ruby < 1.9.3
clear load cache between tests
Merge pull request #563 from oooooooo/patch-1

fixed typo
Add #563 to History.
Run on ruby 2.0.0, not the outdated ruby-head
Switch to Minitest 5