Sha256: a005a7902cdc58563db0486a182a778c39660de0410042c3273e01e8768898b1
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module CobraCommander # Represents a component withing an Umbrella class Component attr_reader :name, :packages def initialize(umbrella, name) @umbrella = umbrella @name = name @dependency_names = [] @packages = [] end def add_package(package) @packages << package @dependency_names |= package.dependencies end def root_paths @packages.map(&:path).uniq end def inspect "#<CobraCommander::Component:#{object_id} #{name} dependencies=#{dependencies.map(&:name)} packages=#{packages}>" end def deep_dependents @deep_dependents ||= @umbrella.components.find_all do |dep| dep.deep_dependencies.include?(self) end end def deep_dependencies @deep_dependencies ||= dependencies.reduce(dependencies) do |deps, dep| deps | dep.deep_dependencies end end def dependents @dependents ||= @umbrella.components.find_all do |dep| dep.dependencies.include?(self) end end def dependencies @dependencies ||= @dependency_names.sort.filter_map { |name| @umbrella.find(name) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cobra_commander-1.0.1 | lib/cobra_commander/component.rb |
cobra_commander-1.0.0 | lib/cobra_commander/component.rb |