Don’t reorder “basic” artifacts.
This commit is contained in:
parent
51a0de6368
commit
02362259a5
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user