update repology for changes to GitHub module
This commit is contained in:
parent
05d03a3909
commit
ed23eb1fab
@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
require "cmd/shared_examples/args_parse"
|
require "cmd/shared_examples/args_parse"
|
||||||
|
|
||||||
describe "Homebrew.bump_args" do
|
describe "brew bump" do
|
||||||
it_behaves_like "parseable arguments"
|
describe "Homebrew.bump_args" do
|
||||||
|
it_behaves_like "parseable arguments"
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "formula", :integration_test do
|
||||||
|
it "returns data for valid specified formula" do
|
||||||
|
install_test_formula "testball"
|
||||||
|
|
||||||
|
expect { brew "bump", "--formula=testball" }
|
||||||
|
.to output.to_stdout
|
||||||
|
.and not_to_output.to_stderr
|
||||||
|
.and be_a_success
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,15 +3,10 @@
|
|||||||
require "utils/repology"
|
require "utils/repology"
|
||||||
|
|
||||||
describe Repology do
|
describe Repology do
|
||||||
describe "formula_data", :integration_test do
|
describe "formula_data" do
|
||||||
it "returns nil for invalid Homebrew Formula" do
|
it "returns nil for invalid Homebrew Formula" do
|
||||||
expect(described_class.formula_data("invalidName")).to be_nil
|
expect(described_class.formula_data("invalidName")).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it "validates Homebrew Formula by name" do
|
|
||||||
install_test_formula "testball"
|
|
||||||
expect(described_class.formula_data("testball")).not_to be_nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "query_api" do
|
describe "query_api" do
|
||||||
@ -49,25 +44,4 @@ describe Repology do
|
|||||||
expect(response).to be_a(Hash)
|
expect(response).to be_a(Hash)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "format_package", :integration_test do
|
|
||||||
it "returns nil if package is not a valid formula" do
|
|
||||||
invalid_formula_response = described_class.format_package("invalidName", "5.5.5")
|
|
||||||
|
|
||||||
expect(invalid_formula_response).to be_nil
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns hash with data for valid formula" do
|
|
||||||
install_test_formula "testball"
|
|
||||||
formatted_data = described_class.format_package("testball", "0.1")
|
|
||||||
|
|
||||||
expect(formatted_data).not_to be_nil
|
|
||||||
expect(formatted_data).to be_a(Hash)
|
|
||||||
expect(formatted_data[:repology_latest_version]).not_to be_nil
|
|
||||||
expect(formatted_data[:current_formula_version]).not_to be_nil
|
|
||||||
expect(formatted_data[:current_formula_version]).to eq("0.1")
|
|
||||||
expect(formatted_data).to include(:livecheck_latest_version)
|
|
||||||
expect(formatted_data).to include(:open_pull_requests)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -63,7 +63,11 @@ module Repology
|
|||||||
|
|
||||||
next if repology_homebrew_repo.blank?
|
next if repology_homebrew_repo.blank?
|
||||||
|
|
||||||
latest_version = repositories.find { |repo| repo["status"] == "newest" }["version"]
|
latest_version = repositories.find { |repo| repo["status"] == "newest" }
|
||||||
|
|
||||||
|
next if latest_version.blank?
|
||||||
|
|
||||||
|
latest_version = latest_version["version"]
|
||||||
srcname = repology_homebrew_repo["srcname"]
|
srcname = repology_homebrew_repo["srcname"]
|
||||||
package_details = format_package(srcname, latest_version)
|
package_details = format_package(srcname, latest_version)
|
||||||
packages[srcname] = package_details unless package_details.nil?
|
packages[srcname] = package_details unless package_details.nil?
|
||||||
@ -79,15 +83,18 @@ module Repology
|
|||||||
|
|
||||||
return if formula.blank?
|
return if formula.blank?
|
||||||
|
|
||||||
|
formula_name = formula.to_s
|
||||||
tap_full_name = formula.tap&.full_name
|
tap_full_name = formula.tap&.full_name
|
||||||
current_version = formula.version.to_s
|
current_version = formula.version.to_s
|
||||||
livecheck_response = LivecheckFormula.init(package_name)
|
livecheck_response = LivecheckFormula.init(package_name)
|
||||||
pull_requests = GitHub.check_for_duplicate_pull_requests(formula, tap_full_name, latest_version)
|
pull_requests = GitHub.fetch_pull_requests(formula_name, tap_full_name, state: "open")
|
||||||
|
|
||||||
if pull_requests.try(:any?)
|
if pull_requests.try(:any?)
|
||||||
pull_requests = pull_requests.map { |pr| "#{pr[:title]} (#{Formatter.url(pr[:url])})" }.join(", ")
|
pull_requests = pull_requests.map { |pr| "#{pr["title"]} (#{Formatter.url(pr["url"])})" }.join(", ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pull_requests = "None" if pull_requests.empty?
|
||||||
|
|
||||||
{
|
{
|
||||||
repology_latest_version: latest_version,
|
repology_latest_version: latest_version,
|
||||||
current_formula_version: current_version.to_s,
|
current_formula_version: current_version.to_s,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user