Sha256: 67e20cc1c85c03629679e870e3e59557f6d9c86854ae4ccd4e21969d9b002128

Contents?: true

Size: 1.25 KB

Versions: 9

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require 'avm/registry'
require 'avm/scms/null'
require 'avm/with_application_stereotype'
require 'avm/with_dynamic_runners'
require 'eac_git'
require 'eac_ruby_utils/core_ext'

module Avm
  module Sources
    class Base
      require_sub __FILE__, include_modules: true
      include ::Avm::WithApplicationStereotype
      include ::Avm::WithDynamicRunners
      compare_by :path
      enable_abstract_methods
      enable_simple_cache
      enable_listable
      lists.add_symbol :option, :parent
      common_constructor :path, :options, default: [{}] do
        self.path = path.to_pathname.expand_path
        self.options = ::Avm::Sources::Base.lists.option.hash_keys_validate!(options)
      end

      abstract_methods :update, :valid?

      # @return [EacRubyUtils::Envs::LocalEnv]
      def env
        ::EacRubyUtils::Envs::LocalEnv.new
      end

      # @return [Pathname]
      def relative_path
        return path if parent.blank?

        path.relative_path_from(parent.path)
      end

      def to_s
        "#{self.class}[#{path}]"
      end

      private

      # @return [Avm::Scms::Base]
      def scm_uncached
        ::Avm::Registry.scms.detect_optional(path) || ::Avm::Scms::Null.new(path)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
avm-0.30.0 lib/avm/sources/base.rb
eac_tools-0.12.0 sub/avm/lib/avm/sources/base.rb
eac_tools-0.11.1 sub/avm/lib/avm/sources/base.rb
avm-0.29.0 lib/avm/sources/base.rb
eac_tools-0.11.0 sub/avm/lib/avm/sources/base.rb
avm-0.28.0 lib/avm/sources/base.rb
eac_tools-0.10.0 sub/avm/lib/avm/sources/base.rb
avm-0.27.0 lib/avm/sources/base.rb
eac_tools-0.9.0 sub/avm/lib/avm/sources/base.rb