diff options
| author | L. E. Segovia | 2017-11-11 17:21:13 -0300 |
|---|---|---|
| committer | L. E. Segovia | 2017-11-11 17:21:13 -0300 |
| commit | 8cc1aea5f07d1fdfb9cf8ae9a5687c571a856312 (patch) | |
| tree | a6debfb97bff61349a29c1d68989ef31d1b97211 /Library | |
| parent | 72e673afaeec817c38465dcb9c652ef7556d0b52 (diff) | |
| download | brew-8cc1aea5f07d1fdfb9cf8ae9a5687c571a856312.tar.bz2 | |
Implement @reitermarkus's upgrade flow
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/upgrade.rb | 20 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/installer.rb | 2 |
2 files changed, 16 insertions, 6 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb b/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb index 1165ce6fc..90da6f325 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb @@ -21,8 +21,7 @@ module Hbc puts outdated_casks.map { |f| "#{f.full_name} #{f.version}" } * ", " outdated_casks.each do |old_cask| - odebug "Uninstalling Cask #{old_cask}" - + odebug "Started upgrade process for Cask #{old_cask}" raise CaskNotInstalledError, old_cask unless old_cask.installed? || force? unless old_cask.installed_caskfile.nil? @@ -43,17 +42,26 @@ module Hbc upgrade: true) begin - # purge artifacts BUT keep metadata aside + # Start new Cask's installation steps + new_cask_installer.check_conflicts + + new_cask_installer.fetch + + new_cask_installer.stage + + # Move the old Cask's artifacts back to staging old_cask_installer.start_upgrade - # install BUT do not yet save metadata + # Install the new Cask + new_cask_installer.install_artifacts - new_cask_installer.install + new_cask_installer.enable_accessibility_access - # if successful, remove old metadata and install new + # If successful, wipe the old Cask from staging old_cask_installer.finalize_upgrade rescue CaskError => e opoo e.message + new_cask_installer.uninstall old_cask_installer.revert_upgrade end end diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 03f2c6570..aa6f04dbe 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -391,6 +391,8 @@ module Hbc def finalize_upgrade return unless upgrade? purge_versioned_files + + puts summary end def uninstall_artifacts(clear: false) |
