Homebrew/homebrew — pull request #30294 by jacknagel (2014-06-20 02:55:28+00:00)
Title: Decouple formula object construction from ARGV

Construction of formula objects is no longer tied to the contents of `ARGV`.

To get a formula object with a specific active spec, call `Formula.factory(name, spec)` where spec is `:stable`, `:devel`, or `:head`. The spec parameter defaults to `:stable` (though it is effective ignored if the formula has no stable spec).

Formula objects returned by `ARGV.formulae` will continue to have the spec specified on the command line, e.g. if you say `brew install --HEAD git`, then `ARGV.formulae.first` will be the git formula with the head spec active. Because most formula objects that the code interacts with directly originate in this method, very little code has to change.

This means we can finally get rid of `ARGV.filter_for_dependencies`, which has been a huge obstacle to making further improvements to the dependency code.

The behavior here can be improved further, for example, `Formula.factory(name, spec)` could raise if the spec doesn't exist, but the rest of the codebase isn't prepared for that at this point.