aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorDaniel Lee Harple2013-05-07 14:07:25 -0400
committerJack Nagel2013-05-22 19:53:01 -0500
commit222f96d37b3c41b0538e96245ab37c6f01b872c2 (patch)
tree030dec328301b16090bd5486328b90fac6ad1ffc /Library/Homebrew/cmd
parent0bf35a05a9140cf5da59f236927a07cd689fd123 (diff)
downloadbrew-222f96d37b3c41b0538e96245ab37c6f01b872c2.tar.bz2
Pass a User-Agent when fetching data from the GitHub API
See <http://developer.github.com/v3/#user-agent-required>. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/search.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index f64bb5405..4ae2f314a 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -1,5 +1,6 @@
require "formula"
require "blacklist"
+require "utils"
module Homebrew extend self
def search
@@ -59,12 +60,10 @@ module Homebrew extend self
def search_tap user, repo, rx
return [] if (HOMEBREW_LIBRARY/"Taps/#{user.downcase}-#{repo.downcase}").directory?
-
- require 'open-uri'
require 'vendor/multi_json'
results = []
- open "https://api.github.com/repos/#{user}/homebrew-#{repo}/git/trees/HEAD?recursive=1" do |f|
+ GitHub.open "https://api.github.com/repos/#{user}/homebrew-#{repo}/git/trees/HEAD?recursive=1" do |f|
user.downcase! if user == "Homebrew" # special handling for the Homebrew organization
MultiJson.decode(f.read)["tree"].map{ |hash| hash['path'] }.compact.each do |file|
name = File.basename(file, '.rb')