diff options
| author | Misty De Meo | 2012-01-12 21:10:03 -0600 |
|---|---|---|
| committer | Misty De Meo | 2012-01-13 22:31:55 -0600 |
| commit | 8d100a0508f201417784553b4738262ccad448cb (patch) | |
| tree | a3b20ea68bf75bae88937205f0188c7f8e8bd213 /Library/Homebrew/utils.rb | |
| parent | 9a774ac0a67c81c6e84084dce2c908eafcd521d9 (diff) | |
| download | brew-8d100a0508f201417784553b4738262ccad448cb.tar.bz2 | |
search: return results while parsing
Instead of returning a full list of results after parsing, yield and
print each result as it's found for a snappier user experience.
Closes Homebrew/homebrew#9576.
Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 644023a0c..4de58cc36 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -432,17 +432,15 @@ module GitHub extend self require 'open-uri' require 'vendor/multi_json' - pulls = [] query = rx.source.delete '.*' uri = URI.parse("http://github.com/api/v2/json/issues/search/mxcl/homebrew/open/#{query}") open uri do |f| MultiJson.decode(f.read)["issues"].each do |pull| - pulls << pull['pull_request_url'] if rx.match pull['title'] and pull["pull_request_url"] + yield pull['pull_request_url'] if rx.match pull['title'] and pull["pull_request_url"] end end - pulls rescue - [] + nil end end |
