rubygems/rubygems — pull request #1045 by blackwinter (2014-10-10 10:02:36+00:00)
Title: Sort runtime dependencies before development dependencies.

In an attempt to (partially) solve #1009, I'd like to propose the following:

* Cyclic dependencies form strongly connected components in `TSort`.
* In the case of "pseudo-cyclic" dependencies, where those dependencies are of different types, one can split them into "soft" and "hard" dependencies.
* A simple circle can then be broken by ordering "hard" (runtime) dependencies before "soft" (development) dependencies.

Open issues/questions:

* The original case of a gem `b` being installed that has a runtime dependency on another gem `a` which in turn has a development dependency on `b`, cannot be solved this way. Since `b` is requested for installation it's not marked as `development?`. This needs further investigation. (Corresponding test cases `#test_sorted_requests_development_pseudo_cyclic_b` and `#test_sorted_requests_development_pseudo_cyclic_d` are skipped for now.)
* I'm not sure if an exception should be raised when there's a circle of hard dependencies (breaks backwards compatibility), and, if so, whether `Gem::DependencyError` is the right one to raise.
* A circle of soft dependencies is ignored; possible alternatives are printing a warning or also raising an exception.