Class: Textus::Action::Rdeps

Inherits:
Base
  • Object
show all
Defined in:
lib/textus/action/rdeps.rb

Class Method Summary collapse

Methods inherited from Base

inherited, proposal_from

Methods included from Contract::DSL

#arg, #cli, #cli_stdin, #contract, #contract?, #summary, #surfaces, #verb, #view

Class Method Details

.call(container:, key:) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/textus/action/rdeps.rb', line 12

def self.call(container:, key:, **)
  manifest = container.manifest
  rdeps = manifest.data.entries.each_with_object([]) do |entry, acc|
    next unless entry.external?

    sources = Array(entry.source&.sources).compact
    acc << entry.key if sources.any? { |source| source == key || key.start_with?("#{source}.") }
  end
  Success({ "key" => key, "rdeps" => rdeps })
end