adapt output to adjust for single-formula queries
This commit is contained in:
parent
b5414ab0de
commit
2822a7b0c3
@ -39,12 +39,19 @@ module Homebrew
|
|||||||
Repology.parse_api_response
|
Repology.parse_api_response
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if requested_formula && outdated_repology_packages.nil?
|
||||||
|
ohai "The requested formula, #{requested_formula}, is up-to-date."
|
||||||
|
puts "Current version: #{get_formula_details(requested_formula).version}"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
outdated_packages = validate_and_format_packages(outdated_repology_packages)
|
outdated_packages = validate_and_format_packages(outdated_repology_packages)
|
||||||
display(outdated_packages)
|
display(outdated_packages)
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_and_format_packages(outdated_repology_packages)
|
def validate_and_format_packages(outdated_repology_packages)
|
||||||
ohai "Verifying outdated repology packages as Homebrew formulae"
|
ohai "Verifying outdated repology #{"package".pluralize(outdated_repology_packages.size)} " \
|
||||||
|
"as Homebrew #{"formula".pluralize(outdated_repology_packages.size)}"
|
||||||
|
|
||||||
packages = {}
|
packages = {}
|
||||||
outdated_repology_packages.each do |_name, repositories|
|
outdated_repology_packages.each do |_name, repositories|
|
||||||
@ -118,7 +125,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def display(outdated_packages)
|
def display(outdated_packages)
|
||||||
ohai "Outdated formulae"
|
ohai "Outdated #{"formula".pluralize(outdated_packages.size)}"
|
||||||
puts
|
puts
|
||||||
outdated_packages.each do |formula, package_details|
|
outdated_packages.each do |formula, package_details|
|
||||||
ohai formula
|
ohai formula
|
||||||
|
|||||||
@ -19,7 +19,13 @@ module Repology
|
|||||||
url = "https://repology.org/api/v1/project/#{name}"
|
url = "https://repology.org/api/v1/project/#{name}"
|
||||||
|
|
||||||
output, _errors, _status = curl_output(url.to_s)
|
output, _errors, _status = curl_output(url.to_s)
|
||||||
{ name: JSON.parse(output) }
|
data = JSON.parse(output)
|
||||||
|
|
||||||
|
outdated_homebrew = data.select do |repo|
|
||||||
|
repo["repo"] == "homebrew" && repo["status"] == "outdated"
|
||||||
|
end
|
||||||
|
|
||||||
|
outdated_homebrew.empty? ? nil : { name: data }
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_api_response
|
def parse_api_response
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user