diff options
| author | Jack Nagel | 2012-06-12 11:51:05 -0500 |
|---|---|---|
| committer | Jack Nagel | 2012-06-12 11:51:05 -0500 |
| commit | af9a376f8f72aa889cb5274523bcb70edd4a89e6 (patch) | |
| tree | 2cae57ed433156971159d7d3d9b7ece758fc5b57 /Library | |
| parent | faab02f82b246a564d531e21596ed56cdbae0b7b (diff) | |
| download | homebrew-af9a376f8f72aa889cb5274523bcb70edd4a89e6.tar.bz2 | |
Switch to "legacy" GitHub search API
GitHub's v2 API entry point is gone, but search as been ported to API v3
as a "legacy" feature.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/utils.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index ee45dd0f9..1ee4232ec 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -523,17 +523,16 @@ module GitHub extend self name = f.name if Formula === name require 'open-uri' - require 'yaml' + require 'vendor/multi_json' issues = [] - open "http://github.com/api/v2/yaml/issues/search/mxcl/homebrew/open/#{name}" do |f| - yaml = YAML::load(f.read); - yaml['issues'].each do |issue| + uri = URI.parse("https://api.github.com/legacy/issues/search/mxcl/homebrew/open/#{name}") + + open uri do |f| + MultiJson.decode(f.read)['issues'].each do |issue| # don't include issues that just refer to the tool in their body - if issue['title'].include? name - issues << issue['html_url'] - end + issues << issue['html_url'] if issue['title'].include? name end end @@ -547,11 +546,11 @@ module GitHub extend self require 'vendor/multi_json' query = rx.source.delete('.*').gsub('\\', '') - uri = URI.parse("http://github.com/api/v2/json/issues/search/mxcl/homebrew/open/#{query}") + uri = URI.parse("https://api.github.com/legacy/issues/search/mxcl/homebrew/open/#{query}") open uri do |f| - MultiJson.decode(f.read)["issues"].each do |pull| - yield pull['pull_request_url'] if rx.match pull['title'] and pull["pull_request_url"] + MultiJson.decode(f.read)['issues'].each do |pull| + yield pull['pull_request_url'] if rx.match pull['title'] and pull['pull_request_url'] end end rescue |
