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.
This commit is contained in:
parent
b1c0380b7b
commit
1eddc73472
@ -1,13 +1,11 @@
|
|||||||
require 'utils/json'
|
require "utils/json"
|
||||||
|
|
||||||
GitHub.open "https://api.github.com/legacy/repos/search/homebrew" do |f|
|
GitHub.open("https://api.github.com/search/repositories?q=homebrew+sort:stars&per_page=100") do |json|
|
||||||
Utils::JSON.load(f.read)["repositories"].each do |repo|
|
json["items"].each do |repo|
|
||||||
if repo['name'] =~ /^homebrew-(\S+)$/
|
if repo["name"] =~ /^homebrew-(\S+)$/
|
||||||
puts tap = if repo['username'] == "Homebrew"
|
user = repo["owner"]["login"]
|
||||||
"homebrew/#{$1}"
|
user = user.downcase if user == "Homebrew"
|
||||||
else
|
puts "#{user}/#{$1}"
|
||||||
repo['username']+"/"+$1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user