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

dev-cmd/bump: add --tap= flag #16830

Merged
merged 1 commit into from
Mar 6, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Library/Homebrew/dev-cmd/bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
description: "Check only formulae."
switch "--cask", "--casks",
description: "Check only casks."
flag "--tap=",
description: "Check formulae and casks within the given tap, specified as <user>`/`<repo>."
switch "--installed",
description: "Check formulae and casks that are currently installed."
switch "--no-fork",
Expand All @@ -49,6 +51,7 @@
hidden: true

conflicts "--cask", "--formula"
conflicts "--tap=", "--installed"
conflicts "--no-pull-requests", "--open-pr"

named_args [:formula, :cask], without_api: true
Expand All @@ -68,7 +71,14 @@
odisabled "brew bump --force" if args.force?

Homebrew.with_no_api_env do
formulae_and_casks = if args.installed?
formulae_and_casks = if args.tap
tap = Tap.fetch(args.tap)
raise UsageError, "`--tap` cannot be used with official taps." if tap.official?

formulae = args.cask? ? [] : tap.formula_files.map { |path| Formulary.factory(path) }
casks = args.formula? ? [] : tap.cask_files.map { |path| Cask::CaskLoader.load(path) }
formulae + casks

Check warning on line 80 in Library/Homebrew/dev-cmd/bump.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/bump.rb#L80

Added line #L80 was not covered by tests
elsif args.installed?
formulae = args.cask? ? [] : Formula.installed
casks = args.formula? ? [] : Cask::Caskroom.casks
formulae + casks
Expand Down
7 changes: 7 additions & 0 deletions Library/Homebrew/test/dev-cmd/bump_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@
.and be_a_success
end
end

it "gives an error for `--tap` with official taps", :integration_test do
expect { brew "bump", "--tap", "Homebrew/core" }
.to output(/Invalid usage/).to_stderr
.and not_to_output.to_stdout
.and be_a_failure
end
end
Loading