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

bundle: add upgrade switch and command. #1574

Merged
merged 1 commit into from
Jan 23, 2025
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
17 changes: 14 additions & 3 deletions cmd/bundle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class BundleCmd < AbstractCommand

You can skip the installation of dependencies by adding space-separated values to one or more of the following environment variables: `HOMEBREW_BUNDLE_BREW_SKIP`, `HOMEBREW_BUNDLE_CASK_SKIP`, `HOMEBREW_BUNDLE_MAS_SKIP`, `HOMEBREW_BUNDLE_WHALEBREW_SKIP`, `HOMEBREW_BUNDLE_TAP_SKIP`.

`brew bundle upgrade`:
Shorthand for `brew bundle install --upgrade`.

`brew bundle dump`:
Write all installed casks/formulae/images/taps into a `Brewfile` in the current directory.

Expand Down Expand Up @@ -66,7 +69,11 @@ class BundleCmd < AbstractCommand
env: :bundle_no_upgrade,
description: "`install` does not run `brew upgrade` on outdated dependencies. " \
"`check` does not check for outdated dependencies. " \
"Note they may still be upgraded by `brew install` if needed."
"Note they may still be upgraded by `brew install` if needed." \
"This is enabled by default if `HOMEBREW_BUNDLE_NO_UPGRADE` is set."
switch "--upgrade",
description: "`install` runs `brew upgrade` on outdated dependencies, " \
"even if `HOMEBREW_BUNDLE_NO_UPGRADE` is set. "
switch "-f", "--force",
description: "`install` runs with `--force`/`--overwrite`. " \
"`dump` overwrites an existing `Brewfile`. " \
Expand Down Expand Up @@ -126,15 +133,19 @@ def run
global = args.global?
file = args.file
args.zap?
no_upgrade = args.no_upgrade?
no_upgrade = if args.upgrade? || subcommand == "upgrade"
false
else
args.no_upgrade?
end
verbose = args.verbose?
force = args.force?
zap = args.zap?

no_type_args = !args.brews? && !args.casks? && !args.taps? && !args.mas? && !args.whalebrew? && !args.vscode?

case subcommand
when nil, "install"
when nil, "install", "upgrade"
Bundle::Commands::Install.run(
global:, file:, no_upgrade:, verbose:, force:,
no_lock: args.no_lock?,
Expand Down
3 changes: 3 additions & 0 deletions cmd/bundle.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class Homebrew::Cmd::BundleCmd::Args < Homebrew::CLI::Args
sig { returns(T::Boolean) }
def taps?; end

sig { returns(T::Boolean) }
def upgrade?; end

sig { returns(T::Boolean) }
def verbose?; end

Expand Down
Loading