diff options
| author | Jack Nagel | 2014-02-08 20:41:11 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2014-02-08 20:41:11 -0500 | 
| commit | e57894e0d8d4e6df65617c540183d92959e5c74c (patch) | |
| tree | 474bba588bd6ac8d949f78dc0bbef5c36352b6e0 /Library/Homebrew/utils.rb | |
| parent | d01c671d74ddafcbc0c8dc8eaa805d971e7169fc (diff) | |
| download | brew-e57894e0d8d4e6df65617c540183d92959e5c74c.tar.bz2 | |
Switch to v3 search API
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 14 | 
1 files changed, 8 insertions, 6 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 087831153..fbeaf8ec0 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -249,7 +249,7 @@ def paths  end  module GitHub extend self -  ISSUES_URI = URI.parse("https://api.github.com/legacy/issues/search/Homebrew/homebrew/open/") +  ISSUES_URI = URI.parse("https://api.github.com/search/issues")    Error = Class.new(StandardError)    RateLimitExceededError = Class.new(Error) @@ -282,8 +282,9 @@ module GitHub extend self    end    def issues_matching(query) -    uri = ISSUES_URI + uri_escape(query) -    open(uri) { |json| json["issues"] } +    uri = ISSUES_URI.dup +    uri.query = "q=#{uri_escape(query)}+repo:Homebrew/homebrew&per_page=100" +    open(uri) { |json| json["items"] }    end    def uri_escape(query) @@ -313,9 +314,10 @@ module GitHub extend self      query = rx.source.delete('.*').gsub('\\', '')      open_or_closed_prs = issues_matching(query).select do |issue| -      rx === issue['title'] && issue.has_key?('pull_request_url') +      rx === issue["title"] && issue["pull_request"]["html_url"]      end -    open_prs = open_or_closed_prs.select {|i| i['state'] != 'closed' } + +    open_prs = open_or_closed_prs.select {|i| i["state"] == "open" }      if open_prs.any?        puts "Open pull requests:"        prs = open_prs @@ -326,6 +328,6 @@ module GitHub extend self        return      end -    prs.each {|i| yield "#{i['title']} (#{i['pull_request_url']})" } +    prs.each {|i| yield "#{i["title"]} (#{i["pull_request"]["html_url"]})" }    end  end  | 
