aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/cli
diff options
context:
space:
mode:
authorL. E. Segovia2017-11-16 10:40:32 -0300
committerL. E. Segovia2017-11-16 10:40:32 -0300
commit8ee6ac26130c74fd102d4e77e24f2c3b6aa86adc (patch)
tree1b036e7b0feb4f5ea9ad300a5c3ce543bce79c6a /Library/Homebrew/cask/lib/hbc/cli
parent36fe355159385669fbd5c294b901ed1df5bc745f (diff)
downloadbrew-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.rb10
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