aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorJack Nagel2012-06-12 11:51:05 -0500
committerJack Nagel2012-06-12 11:51:05 -0500
commitde5f0a8e9b7887ac37eb5e3b3ca266531728b890 (patch)
treed8015b633b11257df4db2a03c3a6d0cefdc7698c /Library/Homebrew/utils.rb
parent9e2fc82ad66f8efc280df4b303ed5c8d4e890301 (diff)
downloadbrew-de5f0a8e9b7887ac37eb5e3b3ca266531728b890.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/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb19
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