Support processing of gems that have already been loaded into an IO object.

In particular, this feature is used by rubygems.org to extract metadata
from uploaded gems that have not yet been written to storage.
Use the last redirected URL to create the Gem::Resolver::APISet

In the case that `bundler_api_url` redirects to another URL, this
prevents unnecessary 302s every time the API Resolver requests
dependencies for a gem.

This shaves about 3.5 seconds off the time it takes for me to run
`gem install sinatra`. Even more time is saved when installing gems
with more dependencies.
delegate prefetch to @remote_set in Gem::Resolver::InstallerSet

APISet has a #prefetch method that can request multiple specs at once,
but it was never called, meaning each dependency required a separate
request to the Bundler API.
gem update of multiple gems should identify those already up to date
adding tests for basic auth for gem download
fix typo at https://github.com/ruby/ruby/pull/506
Merge pull request #793 from hsbt/fix-typo

backport ruby/ruby#506
Merge ruby/ruby@dff0aa5 upstream
Remove useless local variables
Have InstallerSet fetch always_install

This allows us to stop using code in DependencyInstaller that duplicates
code in the resolver.  It should also speed up RubyGems as
DependencyInstaller doesn't use BestSet for the first lookup.
Use minitest 4 failed results Regexp
Raise when add_always_install can't find specs

This gives a better error if the user gives a gem that can't be found.
Add RequestSet#always_install=

This allows InstallerSet to set these gems which is opposite of what
DependencyInstaller currenly does
Add InstallerSet#add_local and #local?

Now the InstallerSet knows about locally discovered and loaded gems and
tracks which dependency name was used to load them.  This will allow
DependencyInstaller to add proper dependencies for file names.
Fix pretty-print output for Source::Installed
Fix SpecificFile pretty print title
Relax dependency error string

I don't see where (b =1) came from as it isn't anywhere in the test.  I
find (b >=0) equally acceptable.
Find latest gem in add_always_install

The results of find_all are not ordered, so pick the highest version
because that's what we're installing on behalf of the user.
Reject all installed gems matching always_install

The sort order of sources prevent us from installing the latest version
when requested, installed gems will be preferred over .gem files.
Changing the preference order of sources is infeasible as it changes
other behavior.

Instead we reject all gems matching a name on the always_install list.
This means the resolver will only see .gem files and remote gems.
Fetch complete specs for IndexSet

Fetching only released specs means prerelease versions cannot be
installed.

IndexSet should be improved to only fetch prereleases when they are
needed, but it will eventually be removed so maybe this is not
worthwhile.