diff --git a/Library/Homebrew/dev-cmd/bump.rb b/Library/Homebrew/dev-cmd/bump.rb index 10dac55853226..b31f851f9cf48 100644 --- a/Library/Homebrew/dev-cmd/bump.rb +++ b/Library/Homebrew/dev-cmd/bump.rb @@ -35,6 +35,8 @@ def bump_args description: "Check only formulae." switch "--cask", "--casks", description: "Check only casks." + flag "--tap=", + description: "Check formulae and casks within the given tap, specified as `/`." switch "--installed", description: "Check formulae and casks that are currently installed." switch "--no-fork", @@ -49,6 +51,7 @@ def bump_args hidden: true conflicts "--cask", "--formula" + conflicts "--tap=", "--installed" conflicts "--no-pull-requests", "--open-pr" named_args [:formula, :cask], without_api: true @@ -68,7 +71,14 @@ def bump 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 + elsif args.installed? formulae = args.cask? ? [] : Formula.installed casks = args.formula? ? [] : Cask::Caskroom.casks formulae + casks diff --git a/Library/Homebrew/test/dev-cmd/bump_spec.rb b/Library/Homebrew/test/dev-cmd/bump_spec.rb index f576b23efb7e9..11b422088a2d2 100644 --- a/Library/Homebrew/test/dev-cmd/bump_spec.rb +++ b/Library/Homebrew/test/dev-cmd/bump_spec.rb @@ -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