Sha256: d229587e16d01c3ed9575f567ec5f2ad81a72592f3cfc9080229cb17ccf0586c
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true module CobraCommander # An umbrella application class Umbrella attr_reader :name, :path def initialize(name, path) @root_component = Component.new(self, name) @path = path @components = {} end def find(name) @components[name] end def root @root_component end def resolve(component_root_path) return root if root.root_paths.include?(component_root_path) components.find do |component| component.root_paths.include?(component_root_path) end end def add_source(key, source) @root_component.add_source key, source.path, source.dependencies source.components.each do |component| @components[component[:name]] ||= Component.new(self, component[:name]) @components[component[:name]].add_source key, component[:path], component[:dependencies] end end def components @components.values end def dependents_of(component) find(component)&.deep_dependents &.sort_by(&:name) end def dependencies_of(name) find(name)&.deep_dependencies &.sort_by(&:name) end end end
Version data entries
4 entries across 4 versions & 1 rubygems