diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/installer.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index df7554cc5..5176143d7 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -132,14 +132,29 @@ module Hbc end def install_artifacts + already_installed_artifacts = [] + options = { command: @command, force: force } + odebug "Installing artifacts" artifacts = Artifact.for_cask(@cask) odebug "#{artifacts.length} artifact/s defined", artifacts + artifacts.each do |artifact| odebug "Installing artifact of class #{artifact}" - options = { command: @command, force: force } + already_installed_artifacts.unshift(artifact) artifact.new(@cask, options).install_phase end + rescue StandardError => e + begin + ofail e.message + already_installed_artifacts.each do |artifact| + odebug "Reverting installation of artifact of class #{artifact}" + artifact.new(@cask, options).uninstall_phase + end + ensure + purge_versioned_files + raise e.class, "An error occured during installation of Cask #{@cask}: #{e.message}" + end end # TODO: move dependencies to a separate class |
