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}" }
|
.map { |(old_cask, new_cask)| "#{new_cask.full_name} #{old_cask.version} -> #{new_cask.version}" }
|
||||||
.join(", ")
|
.join(", ")
|
||||||
|
|
||||||
if dry_run?
|
return puts "Dry run: did not upgrade anything." if dry_run?
|
||||||
puts "Dry run: did not upgrade anything."
|
|
||||||
else
|
upgradable_casks.each do |(old_cask, new_cask)|
|
||||||
upgradable_casks.each do |(old_cask, new_cask)|
|
begin
|
||||||
begin
|
upgrade_cask(old_cask, new_cask)
|
||||||
upgrade_cask(old_cask, new_cask)
|
rescue CaskError => e
|
||||||
rescue CaskError => e
|
caught_exceptions << e
|
||||||
caught_exceptions << e
|
next
|
||||||
next
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -106,15 +106,13 @@ module Homebrew
|
|||||||
puts formulae_upgrades.join(", ")
|
puts formulae_upgrades.join(", ")
|
||||||
end
|
end
|
||||||
|
|
||||||
if args.dry_run?
|
return puts "Dry run: did not upgrade anything." if args.dry_run?
|
||||||
puts "Dry run: did not upgrade anything."
|
|
||||||
else
|
|
||||||
upgrade_formulae(formulae_to_install)
|
|
||||||
|
|
||||||
check_dependents(formulae_to_install)
|
upgrade_formulae(formulae_to_install)
|
||||||
|
|
||||||
Homebrew.messages.display_messages
|
check_dependents(formulae_to_install)
|
||||||
end
|
|
||||||
|
Homebrew.messages.display_messages
|
||||||
end
|
end
|
||||||
|
|
||||||
def upgrade_formulae(formulae_to_install)
|
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.1").to be_a_directory
|
||||||
expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist
|
expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user