diff options
| author | Markus Reiter | 2017-10-04 17:46:29 +0200 |
|---|---|---|
| committer | Markus Reiter | 2017-10-04 18:47:55 +0200 |
| commit | 02362259a54c0b8d7399e7b19f0a56519cb1b9d1 (patch) | |
| tree | e9647b76cd0451b9c4eba4379082dea393571080 /Library | |
| parent | 51a0de6368974eb3476369b819c3823feebebdce (diff) | |
| download | brew-02362259a54c0b8d7399e7b19f0a56519cb1b9d1.tar.bz2 | |
Don’t reorder “basic” artifacts.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact.rb | 34 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb | 46 |
2 files changed, 27 insertions, 53 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact.rb b/Library/Homebrew/cask/lib/hbc/artifact.rb index 505f9ec13..1cbe49cf2 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact.rb @@ -25,39 +25,5 @@ require "hbc/artifact/zap" module Hbc module Artifact - # NOTE: Order is important here! - # - # The `uninstall` stanza should be run first, as it may - # depend on other artifacts still being installed. - # - # We want to extract nested containers before we - # handle any other artifacts. - # - CLASSES = [ - PreflightBlock, - Uninstall, - NestedContainer, - Installer, - App, - Suite, - Artifact, # generic 'artifact' stanza - Colorpicker, - Pkg, - Prefpane, - Qlplugin, - Dictionary, - Font, - Service, - StageOnly, - Binary, - InputMethod, - InternetPlugin, - AudioUnitPlugin, - VstPlugin, - Vst3Plugin, - ScreenSaver, - PostflightBlock, - Zap, - ].freeze end end diff --git a/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb b/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb index 331e098e0..17a778f66 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/abstract_artifact.rb @@ -21,34 +21,42 @@ module Hbc end def <=>(other) + return unless other.class < AbstractArtifact + return 0 if self.class == other.class + @@sort_order ||= [ # rubocop:disable Style/ClassVars PreflightBlock, + # The `uninstall` stanza should be run first, as it may + # depend on other artifacts still being installed. Uninstall, + # We want to extract nested containers before we + # handle any other artifacts. NestedContainer, Installer, - App, - Suite, - Artifact, # generic 'artifact' stanza - Colorpicker, - Pkg, - Prefpane, - Qlplugin, - Dictionary, - Font, - Service, - StageOnly, + [ + App, + Suite, + Artifact, + Colorpicker, + Prefpane, + Qlplugin, + Dictionary, + Font, + Service, + InputMethod, + InternetPlugin, + AudioUnitPlugin, + VstPlugin, + Vst3Plugin, + ScreenSaver, + ], Binary, - InputMethod, - InternetPlugin, - AudioUnitPlugin, - VstPlugin, - Vst3Plugin, - ScreenSaver, + Pkg, PostflightBlock, Zap, - ] + ].each_with_index.flat_map { |classes, i| [*classes].map { |c| [c, i] } }.to_h - (@@sort_order.index(self.class) <=> @@sort_order.index(other.class)).to_i + (@@sort_order[self.class] <=> @@sort_order[other.class]).to_i end # TODO: this sort of logic would make more sense in dsl.rb, or a |
