Address PR comments: remove test and use return ... if
This commit is contained in:
parent
ac0ff9ae46
commit
7f6ef77d0e
@ -42,16 +42,14 @@ module Cask
|
||||
.map { |(old_cask, new_cask)| "#{new_cask.full_name} #{old_cask.version} -> #{new_cask.version}" }
|
||||
.join(", ")
|
||||
|
||||
if dry_run?
|
||||
puts "Dry run: did not upgrade anything."
|
||||
else
|
||||
upgradable_casks.each do |(old_cask, new_cask)|
|
||||
begin
|
||||
upgrade_cask(old_cask, new_cask)
|
||||
rescue CaskError => e
|
||||
caught_exceptions << e
|
||||
next
|
||||
end
|
||||
return puts "Dry run: did not upgrade anything." if dry_run?
|
||||
|
||||
upgradable_casks.each do |(old_cask, new_cask)|
|
||||
begin
|
||||
upgrade_cask(old_cask, new_cask)
|
||||
rescue CaskError => e
|
||||
caught_exceptions << e
|
||||
next
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -106,15 +106,13 @@ module Homebrew
|
||||
puts formulae_upgrades.join(", ")
|
||||
end
|
||||
|
||||
if args.dry_run?
|
||||
puts "Dry run: did not upgrade anything."
|
||||
else
|
||||
upgrade_formulae(formulae_to_install)
|
||||
return puts "Dry run: did not upgrade anything." if args.dry_run?
|
||||
|
||||
check_dependents(formulae_to_install)
|
||||
upgrade_formulae(formulae_to_install)
|
||||
|
||||
Homebrew.messages.display_messages
|
||||
end
|
||||
check_dependents(formulae_to_install)
|
||||
|
||||
Homebrew.messages.display_messages
|
||||
end
|
||||
|
||||
def upgrade_formulae(formulae_to_install)
|
||||
|
||||
@ -16,17 +16,4 @@ 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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user