Sha256: 27e074a8ec272093ae5416491b56427f131814f266ffc2d4b049434e4a0a6e1a

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

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

module Avm
  module Sources
    class Base
      require_sub __FILE__, include_modules: true
      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

11 entries across 11 versions & 2 rubygems

Version Path
avm-0.26.0 lib/avm/sources/base.rb
eac_tools-0.8.0 sub/avm/lib/avm/sources/base.rb
eac_tools-0.7.0 sub/avm/lib/avm/sources/base.rb
avm-0.25.0 lib/avm/sources/base.rb
eac_tools-0.6.0 sub/avm/lib/avm/sources/base.rb
eac_tools-0.5.0 sub/avm/lib/avm/sources/base.rb
avm-0.24.0 lib/avm/sources/base.rb
eac_tools-0.4.0 sub/avm/lib/avm/sources/base.rb
eac_tools-0.3.0 sub/avm/lib/avm/sources/base.rb
eac_tools-0.2.2 sub/avm/lib/avm/sources/base.rb
avm-0.23.0 lib/avm/sources/base.rb