vendor/avm/lib/avm/sources/base.rb in avm-tools-0.108.0 vs vendor/avm/lib/avm/sources/base.rb in avm-tools-0.109.0

- old
+ new

@@ -1,21 +1,24 @@ # frozen_string_literal: true +require 'avm/registry' require 'eac_git' require 'eac_ruby_utils/core_ext' module Avm module Sources class Base + require_sub __FILE__ enable_simple_cache enable_listable lists.add_symbol :option, :parent common_constructor :path, :options, default: [{}] do self.path = path.to_pathname self.options = self.class.lists.option.hash_keys_validate!(options) end + delegate :locale, to: :configuration delegate :to_s, to: :path # @return [Avm::Sources::Base] def parent options[OPTION_PARENT] @@ -32,14 +35,33 @@ def subs git_repo.subrepos .map { |subrepo| self.class.new(subrepo.subpath.expand_path(path), parent: self) } end + def update + stereotype.update_source(self) + end + private + # @return [Avm::Sources::Configuration] + def configuration_uncached + ::Avm::Sources::Configuration.find_in_path(path) || ::Avm::Sources::Configuration.new + end + # @return [EacGit::Local] def git_repo_uncached ::EacGit::Local.new(path) + end + + # @return [Avm::Scms::Base] + def scm_uncached + ::Avm::Registry.scms.detect(path) + end + + # @return [Avm::SourceStereotypes::Base] + def stereotype_uncached + ::Avm::Registry.source_stereotypes.detect(self) end end end end