diff options
| author | Misty De Meo | 2012-01-13 18:30:40 -0600 |
|---|---|---|
| committer | Misty De Meo | 2012-01-13 20:55:18 -0600 |
| commit | 9056c49f9dfc1fb343a0afd718c7957095bea400 (patch) | |
| tree | efec94ff73f3889b3b311094d85a1185babd9474 /Library/Homebrew/utils.rb | |
| parent | ea40b1b87a6e03533ae922aba7cc636d7ac9299c (diff) | |
| download | homebrew-9056c49f9dfc1fb343a0afd718c7957095bea400.tar.bz2 | |
search: use v2 API
The v3 API currently lacks a search feature. Use the v2 API instead for
much faster pull request filtering.
Closes #9592.
Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 71417e61a..644023a0c 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -433,20 +433,14 @@ module GitHub extend self require 'vendor/multi_json' pulls = [] - uri = URI.parse("https://api.github.com/repos/mxcl/homebrew/pulls") - uri.query = "per_page=100" + 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)).each do |pull| - pulls << pull['html_url'] if rx.match pull['title'] + MultiJson.decode(f.read)["issues"].each do |pull| + pulls << pull['pull_request_url'] if rx.match pull['title'] and pull["pull_request_url"] end - - uri = if f.meta['link'] =~ /rel="next"/ - f.meta['link'].slice(URI.regexp) - else - nil - end - end while uri + end pulls rescue [] |
