Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

livecheck: skip disabled formulae #9112

Merged
merged 1 commit into from
Nov 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions Library/Homebrew/livecheck/livecheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ def skip_conditions(formula, args:)
return
end

if formula.disabled? && !formula.livecheckable?
return status_hash(formula, "disabled", args: args) if args.json?

puts "#{Tty.red}#{formula_name(formula, args: args)}#{Tty.reset} : disabled" unless args.quiet?
return
end

if formula.versioned_formula? && !formula.livecheckable?
return status_hash(formula, "versioned", args: args) if args.json?

Expand Down
15 changes: 15 additions & 0 deletions Library/Homebrew/test/livecheck/livecheck_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
end
end

let(:f_disabled) do
formula("test_disabled") do
desc "Disabled test formula"
homepage "https://brew.sh"
url "https://brew.sh/test-0.0.1.tgz"
disable! because: :unmaintained
end
end

let(:f_gist) do
formula("test_gist") do
desc "Gist test formula"
Expand Down Expand Up @@ -100,6 +109,12 @@
.and not_to_output.to_stderr
end

it "skips a disabled formula without a livecheckable" do
expect { livecheck.skip_conditions(f_disabled, args: args) }
.to output("test_disabled : disabled\n").to_stdout
.and not_to_output.to_stderr
end

it "skips a versioned formula without a livecheckable" do
expect { livecheck.skip_conditions(f_versioned, args: args) }
.to output("test@0.0.1 : versioned\n").to_stdout
Expand Down