diff options
| author | Jack Nagel | 2014-02-10 11:26:55 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-02-10 11:27:54 -0500 |
| commit | 1eddc73472c2d39f698da2089889b3b7325010a8 (patch) | |
| tree | 3ba523c271d904dc44832fbbf57afcf5c3b05930 /Library | |
| parent | b1c0380b7be99b4e81b26e6d5b9ad2ae088e0a50 (diff) | |
| download | brew-1eddc73472c2d39f698da2089889b3b7325010a8.tar.bz2 | |
Fix ls-taps for v3 API
This doesn't handle paginated results, but it fetches the 100 most
starred results so that's probably good enough for now.
Fixes Homebrew/homebrew#26566.
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/cmd/brew-ls-taps.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Library/Contributions/cmd/brew-ls-taps.rb b/Library/Contributions/cmd/brew-ls-taps.rb index 40cf0cafe..cc46cd326 100755 --- a/Library/Contributions/cmd/brew-ls-taps.rb +++ b/Library/Contributions/cmd/brew-ls-taps.rb @@ -1,13 +1,11 @@ -require 'utils/json' +require "utils/json" -GitHub.open "https://api.github.com/legacy/repos/search/homebrew" do |f| - Utils::JSON.load(f.read)["repositories"].each do |repo| - if repo['name'] =~ /^homebrew-(\S+)$/ - puts tap = if repo['username'] == "Homebrew" - "homebrew/#{$1}" - else - repo['username']+"/"+$1 - end +GitHub.open("https://api.github.com/search/repositories?q=homebrew+sort:stars&per_page=100") do |json| + json["items"].each do |repo| + if repo["name"] =~ /^homebrew-(\S+)$/ + user = repo["owner"]["login"] + user = user.downcase if user == "Homebrew" + puts "#{user}/#{$1}" end end end |
