cmd/upgrade: add --dry-run option.
This commit is contained in:
parent
6db1c7383f
commit
9e0e012a56
@ -46,6 +46,8 @@ module Homebrew
|
||||
description: "Print the verification and postinstall steps."
|
||||
switch "--display-times",
|
||||
description: "Print install times for each formula at the end of the run."
|
||||
switch "--dry-run",
|
||||
description: "Show what would be upgraded, but do not actually upgrade anything."
|
||||
conflicts "--build-from-source", "--force-bottle"
|
||||
formula_options
|
||||
end
|
||||
@ -104,11 +106,15 @@ module Homebrew
|
||||
puts formulae_upgrades.join(", ")
|
||||
end
|
||||
|
||||
upgrade_formulae(formulae_to_install)
|
||||
if args.dry_run?
|
||||
puts "Dry run: did not upgrade anything."
|
||||
else
|
||||
upgrade_formulae(formulae_to_install)
|
||||
|
||||
check_dependents(formulae_to_install)
|
||||
check_dependents(formulae_to_install)
|
||||
|
||||
Homebrew.messages.display_messages
|
||||
Homebrew.messages.display_messages
|
||||
end
|
||||
end
|
||||
|
||||
def upgrade_formulae(formulae_to_install)
|
||||
|
||||
@ -16,4 +16,17 @@ describe "brew upgrade", :integration_test do
|
||||
expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory
|
||||
expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist
|
||||
end
|
||||
|
||||
it "can do a dry run upgrade" do
|
||||
setup_test_formula "testball"
|
||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||
|
||||
expect { brew "upgrade", "--dry-run" }
|
||||
.to output(/Dry run: did not upgrade anything/).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
|
||||
expect(HOMEBREW_CELLAR/"testball/0.1").not_to exist
|
||||
expect(HOMEBREW_CELLAR/"testball/0.0.1").to be_a_directory
|
||||
end
|
||||
end
|
||||
|
||||
@ -557,6 +557,8 @@ upgraded formulae or, every 30 days, for all formulae.
|
||||
Don't delete the temporary files created during installation.
|
||||
* `--display-times`:
|
||||
Print install times for each formula at the end of the run.
|
||||
* `--dry-run`:
|
||||
Show what would be upgraded, but do not actually upgrade anything.
|
||||
|
||||
### `uses` [*`options`*] *`formula`*
|
||||
|
||||
|
||||
@ -690,6 +690,10 @@ Don\'t delete the temporary files created during installation\.
|
||||
\fB\-\-display\-times\fR
|
||||
Print install times for each formula at the end of the run\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-dry\-run\fR
|
||||
Show what would be upgraded, but do not actually upgrade anything\.
|
||||
.
|
||||
.SS "\fBuses\fR [\fIoptions\fR] \fIformula\fR"
|
||||
Show the formulae that specify \fIformula\fR as a dependency\. When given multiple formula arguments, show the intersection of formulae that use \fIformula\fR\.
|
||||
.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user