diff options
| author | L. E. Segovia | 2017-11-16 10:40:32 -0300 |
|---|---|---|
| committer | L. E. Segovia | 2017-11-16 10:40:32 -0300 |
| commit | 8ee6ac26130c74fd102d4e77e24f2c3b6aa86adc (patch) | |
| tree | 1b036e7b0feb4f5ea9ad300a5c3ce543bce79c6a /Library/Homebrew/cask/lib/hbc/cli | |
| parent | 36fe355159385669fbd5c294b901ed1df5bc745f (diff) | |
| download | brew-8ee6ac26130c74fd102d4e77e24f2c3b6aa86adc.tar.bz2 | |
Implement @reitermarkus's comments
- Split move into a move_back (and clarify when it is used)
- Remove unused flags
- Raise error if installed Caskfile not found
- Error out if an upgrade fails
- Remove some defensive programming checks
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/upgrade.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb b/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb index 94fe56a47..993ec6ac6 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb @@ -4,7 +4,6 @@ module Hbc option "--greedy", :greedy, false option "--quiet", :quiet, false option "--force", :force, false - option "--force-update", :force_update, false option "--skip-cask-deps", :skip_cask_deps, false def initialize(*) @@ -24,10 +23,9 @@ module Hbc odebug "Started upgrade process for Cask #{old_cask}" raise CaskNotInstalledError, old_cask unless old_cask.installed? || force? - unless old_cask.installed_caskfile.nil? - # use the same cask file that was used for installation, if possible - old_cask = CaskLoader.load(old_cask.installed_caskfile) if old_cask.installed_caskfile.exist? - end + raise CaskUnavailableError.new(old_cask, "The Caskfile is missing!") if old_cask.installed_caskfile.nil? + + old_cask = CaskLoader.load(old_cask.installed_caskfile) old_cask_installer = Installer.new(old_cask, binaries: binaries?, verbose: verbose?, force: force?, upgrade: true) @@ -66,10 +64,10 @@ module Hbc # If successful, wipe the old Cask from staging old_cask_installer.finalize_upgrade rescue CaskError => e - opoo e.message new_cask_installer.uninstall_artifacts if new_artifacts_installed new_cask_installer.purge_versioned_files old_cask_installer.revert_upgrade if started_upgrade + raise e end end end |
