Fix for #1966, use the preferred-install from the rootPackage config to install the dependencies.
Refactored the code with the switch statement.
Always use rootPackage config
Remove old comment
Fail over from source to dist and vice versa when downloads fail

Any RuntimeException descendent will be caught and cause another
download attempt using either source or dist depending on what was
attempted first.
Download failover means we can now always try github zip urls for dist
Make the github driver behave like git if "no-api" is specified.
Correct the tests for dist urls for github
Rethrow download exceptions when no options left & clean up code
Merge pull request #2751 from sndpl/issue/1966

Fix for #1966, use the preferred-install from the rootPackage
Merge pull request #2754 from naderman/github-no-api

Make the github driver behave like git if "no-api" is specified.
Merge remote-tracking branch 'naderman/download-failover'
Tweak error message and make TransportException extend from RuntimeException, refs #2753
When using the github driver with no-api don't reset to an ssh url
Don't hardcode the URL to an https one either
Merge branch 'master' of github.com:composer/composer into tls-config