File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Library/Homebrew/cask/artifact Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -54,12 +54,8 @@ def staged_path_join_executable(path)
5454 end
5555 end
5656
57- def <=>( other )
58- return unless other . class < AbstractArtifact
59- return 0 if instance_of? ( other . class )
60-
61- # TODO: Replace class var @@sort_order with a class instance var.
62- @@sort_order ||= [ # rubocop:disable Style/ClassVars
57+ def sort_order
58+ @sort_order ||= [
6359 PreflightBlock ,
6460 # The `uninstall` stanza should be run first, as it may
6561 # depend on other artifacts still being installed.
@@ -94,8 +90,13 @@ def <=>(other)
9490 PostflightBlock ,
9591 Zap ,
9692 ] . each_with_index . flat_map { |classes , i | Array ( classes ) . map { |c | [ c , i ] } } . to_h
93+ end
94+
95+ def <=>( other )
96+ return unless other . class < AbstractArtifact
97+ return 0 if instance_of? ( other . class )
9798
98- ( @@ sort_order[ self . class ] <=> @@ sort_order[ other . class ] ) . to_i
99+ ( sort_order [ self . class ] <=> sort_order [ other . class ] ) . to_i
99100 end
100101
101102 # TODO: this sort of logic would make more sense in dsl.rb, or a
@@ -148,6 +149,7 @@ def initialize(cask, *dsl_args)
148149 @dsl_key = nil
149150 @english_article = nil
150151 @english_name = nil
152+ @sort_order = nil
151153 end
152154
153155 def config
You can’t perform that action at this time.
0 commit comments