Sha256: 1bca6926a84a4c41daba31822077c743b46e9381d5328919c64019aaae6203c5

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

require 'avm/with/application_stereotype'
require 'eac_ruby_utils/core_ext'

module Avm
  module Scms
    class Base
      require_sub __FILE__, include_modules: true
      enable_abstract_methods
      enable_simple_cache
      include ::Avm::With::ApplicationStereotype
      abstract_methods :update, :valid?
      common_constructor :path do
        self.path = path.to_pathname.expand_path
      end

      # @return [Avm::Scms::ChangedFile]
      def changed_files
        raise_abstract_method __method__
      end

      # @param options [Hash<Symbol, Object>]
      def completer(options = {}) # rubocop:disable Lint/UnusedMethodArgument
        raise_abstract_method __method__
      end

      # @return [Avm::Scms::Interval]
      def interval(_from, _to)
        raise_abstract_method __method__
      end

      def name
        self.class.name.demodulize
      end

      # @return [Pathname]
      def relative_path_from_parent_scm
        parent_scm.if_present(nil) do |v|
          path.relative_path_from(v.path)
        end
      end

      # @return [Enumerable<Avm::Scms::Base>]
      def subs
        raise_abstract_method __method__
      end

      def to_s
        name
      end

      private

      # @return [Avm::Scms::Base]
      def parent_scm_uncached
        ::Avm::Registry.scms.detect_by_path_optional(path.parent)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
avm-0.94.1 lib/avm/scms/base.rb
eac_tools-0.98.0 sub/avm/lib/avm/scms/base.rb
avm-0.94.0 lib/avm/scms/base.rb
eac_tools-0.94.0 sub/avm/lib/avm/scms/base.rb