Sha256: 1dda84fc90374a6fb3f234fee99f9f9c69b6c4721dbf6e793549bc653a93aa8c
Contents?: true
Size: 1.29 KB
Versions: 4
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true module CobraCommander # Represents a component withing an Umbrella class Component attr_reader :name, :dependencies, :sources def initialize(umbrella, name) @umbrella = umbrella @name = name @dependency_names = [] @sources = {} end def add_source(key, path, dependency_names) @sources[key] = path @dependency_names |= dependency_names end def root_paths @sources.values.map(&File.method(:dirname)).uniq end def inspect "#<CobraCommander::Component:#{object_id} #{name} dependencies=#{dependencies.map(&:name)} packages=#{sources}>" 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 .map(&@umbrella.method(:find)) .compact end end end
Version data entries
4 entries across 4 versions & 1 rubygems