adapt internal_stanza command to work with SortedSet of Artifacts
This commit is contained in:
parent
587c5b07b3
commit
d03720320a
@ -24,6 +24,9 @@ module Hbc
|
|||||||
ARTIFACTS =
|
ARTIFACTS =
|
||||||
DSL::ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key) +
|
DSL::ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key) +
|
||||||
DSL::ARTIFACT_BLOCK_CLASSES.map(&:dsl_key)
|
DSL::ARTIFACT_BLOCK_CLASSES.map(&:dsl_key)
|
||||||
|
ARTIFACTS_CLASSES =
|
||||||
|
DSL::ORDINARY_ARTIFACT_CLASSES +
|
||||||
|
DSL::ARTIFACT_BLOCK_CLASSES
|
||||||
|
|
||||||
option "--table", :table, false
|
option "--table", :table, false
|
||||||
option "--quiet", :quiet, false
|
option "--quiet", :quiet, false
|
||||||
@ -65,33 +68,29 @@ module Hbc
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
if value.nil? || (value.respond_to?(:to_a) && value.to_a.empty?) ||
|
if stanza == :artifacts
|
||||||
(value.respond_to?(:to_s) && value.to_s == "{}") ||
|
result = {}
|
||||||
(artifact_name && !value.include?(artifact_name))
|
value.each do |e|
|
||||||
|
result[e.class.dsl_key] = e.summarize
|
||||||
|
end
|
||||||
|
value = result
|
||||||
|
end
|
||||||
|
|
||||||
if artifact_name
|
if artifact_name
|
||||||
thing = artifact_name
|
result = nil
|
||||||
else
|
value.each do |k, v|
|
||||||
thing = stanza
|
if k == artifact_name
|
||||||
|
result = v
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
value = result
|
||||||
end
|
end
|
||||||
|
|
||||||
raise CaskError, "no such stanza '#{thing}' on Cask '#{cask}'"
|
if value.nil? || (value.respond_to?(:to_a) && value.to_a.empty?) ||
|
||||||
end
|
(value.respond_to?(:to_s) && value.to_s == "{}") # ||
|
||||||
|
|
||||||
if stanza == :artifacts
|
raise CaskError, "no such stanza '#{artifact_name ? artifact_name : stanza}' on Cask '#{cask}'"
|
||||||
value = Hash[
|
|
||||||
value.map do |k, v|
|
|
||||||
v = v.map do |a|
|
|
||||||
next a.to_a if a.respond_to?(:to_a)
|
|
||||||
next a.to_h if a.respond_to?(:to_h)
|
|
||||||
a
|
|
||||||
end
|
|
||||||
|
|
||||||
[k, v]
|
|
||||||
end
|
|
||||||
]
|
|
||||||
|
|
||||||
value = value.fetch(artifact_name) if artifact_name
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if format
|
if format
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user