Convert #resolve_for into an iterative algorithm (for profit)
Comments and warning fixes
Added multiple argument handling to gem list
Refactored to Gem Query
Finishing Query touches
fix Gem::Specification to always return files in a predictably sorted order
suppress list source header if only one type requested with --quiet
Fix host on gem push, when not passing a --host

After d3f91a011705020c4f1e601d8ddab1c924e5eb99 we start accepting the option --host on the push command
However when the --host is not provided, it is set as nil, and this was causing the following output

Enter your  credentials.
Dont have an account yet? Create one at https:///sign_up
Use metadata['allowed_push_host'] to restrict gem pushing to that host only . Defaults to nil, meaning any host is allowed. Includes tests.

Note that I had to change 2 tests in test_gem_commands_push_command.rb, namely test_execute and test_execute_host; they exploited the fact that gem push previously did not always attempt to load a gem's specification (it only loaded the gemspec if no host was specified). I used existing test helpers to fix those 2 tests.

I figure @rykov of @gemfury will appreciate this. Thanks to @drbrain for implementation suggestions.
Don't force the latest minitest through autotest

If minitest is loaded automatically by autotest the latest version is
used.  This leaves you with no ability to use a previous version.

Since RubyGems loads its preferred minitest through Gem::TestCase we can
let the RubyGems test files take care of it.
Initialize all instance variables in #initialize

Some instance variables were lazily initialized later, but I like to
have them all in #initialize so I know what I'm dealing with and to
avoid warnings.
Break line up to fit in 80 columns

I don't like lines that wrap.
Include platform in pretty print output

The index specification in the resolver didn't contain the platform
information.  This made it look like the same gem was used twice when
one of them had a different platform.
Remove TODO that the TODO author hasn't done
Include platform when sorting gems for resolution

When there are multiple possible gems to use for resolution RubyGems
would sort by source (name) and version and choose the latest spec.
This did not include the platform.

Omitting the platform could result in a gem with a C extension being
chosen over the platform-specific version.

Now the various specification classes (in the resolver) include the
platform and the resolver includes platform when sorting.  This causes
the resolver to try using a platform gem before using a gem with a C
extension.

Fixes #635
Merge pull request #622 from arthurnn/fix_push_host

Allow rubygems.org credential creation without --host

Fixes #622
Update history for #622
Use platform to load specs in DependencyResolver

Previously the platform was ignored when fetching specs inside the
dependency resolver.  This meant if gems with different platforms had
the same name and version, a spec with the incorrect platform could be
selected and installed.

Now the platform is included when fetching the spec which forces loading
of the correct specification.

Fixes #635 (again)
Fix metadata version reference

There was no RubyGems 1.9.0, only 2.0.
Fix installation of prerelease gems

When available_specs was introduced it didn't sort the :complete type
(which contains sources from two datasets).

Binary search was added to speed up extracting only the needed tuples
from the result of available_specs (see #595).  Binary search depends on
a sorted list.

The assumption that available_specs returns a sorted list was masked by
the tests which sorted the expected value.  The other available_specs
results are all sorted by default, so this was an easy one to miss on
review.

Fixes #636