diff options
| author | Markus Reiter | 2017-02-05 07:47:54 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-02-05 07:47:54 +0100 |
| commit | e1ea7bb721ec6d315058c0da285acd38cfc62b9f (patch) | |
| tree | f0f9b7588205ea4edb68f0f46c65e28e73f21911 /Library/Homebrew/cask/lib/hbc/installer.rb | |
| parent | 33fa80944ebff6b609e67712fb87ccc394cb327b (diff) | |
| download | brew-e1ea7bb721ec6d315058c0da285acd38cfc62b9f.tar.bz2 | |
Refactor Cask `Artifact`s.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/installer.rb')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/installer.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 465011735..28f67e5fd 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -140,15 +140,18 @@ module Hbc odebug "#{artifacts.length} artifact/s defined", artifacts artifacts.each do |artifact| + artifact = artifact.new(@cask, options) + next unless artifact.respond_to?(:install_phase) odebug "Installing artifact of class #{artifact}" - artifact.new(@cask, options).install_phase + artifact.install_phase already_installed_artifacts.unshift(artifact) end rescue StandardError => e begin already_installed_artifacts.each do |artifact| + next unless artifact.respond_to?(:uninstall_phase) odebug "Reverting installation of artifact of class #{artifact}" - artifact.new(@cask, options).uninstall_phase + artifact.uninstall_phase end ensure purge_versioned_files @@ -319,9 +322,11 @@ module Hbc artifacts = Artifact.for_cask(@cask) odebug "#{artifacts.length} artifact/s defined", artifacts artifacts.each do |artifact| - odebug "Un-installing artifact of class #{artifact}" options = { command: @command, force: force } - artifact.new(@cask, options).uninstall_phase + artifact = artifact.new(@cask, options) + next unless artifact.respond_to?(:uninstall_phase) + odebug "Un-installing artifact of class #{artifact}" + artifact.uninstall_phase end end @@ -330,7 +335,7 @@ module Hbc uninstall_artifacts if Artifact::Zap.me?(@cask) ohai "Dispatching zap stanza" - Artifact::Zap.new(@cask, command: @command).zap_phase + Artifact::Zap.new(@cask, command: @command).uninstall_phase else opoo "No zap stanza present for Cask '#{@cask}'" end |
