Sha256: d79d0c35ab4c862c9e3d77a7c0dc7638a59781155310103f2a2949a13bdca988

Contents?: true

Size: 1.42 KB

Versions: 11

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

require 'avm/entries/base'
require 'avm/instances/ids'
require 'avm/registry'
require 'eac_ruby_utils/core_ext'

module Avm
  module Applications
    class Base
      enable_simple_cache
      require_sub __FILE__, include_modules: true
      include ::Avm::Entries::Base

      AVM_TYPE = 'Application'
      LOCAL_INSTANCE_SUFFIX = 'dev'

      common_constructor :id do
        self.id = id.to_s
      end

      def to_s
        id
      end

      def instance(suffix)
        stereotype.instance_class.new(self, suffix)
      end

      def name
        entry(::Avm::Instances::EntryKeys::NAME).read
      end

      # @return [String]
      def local_instance_id
        ::Avm::Instances::Ids.build(id, local_instance_suffix)
      end

      # @return [Pathname]
      def local_source_path
        local_source_path_entry.value!.to_pathname
      end

      # @return [EacConfig::Entry]
      def local_source_path_entry
        ::EacConfig::Node.context.current.entry([local_instance_id, 'install', 'path'])
      end

      # @return [String]
      def local_instance_suffix
        LOCAL_INSTANCE_SUFFIX
      end

      private

      # @return [Avm::Instances::Base]
      def local_instance_uncached
        instance(local_instance_suffix)
      end

      # @return [Avm::Sources::Base]
      def local_source_uncached
        ::Avm::Registry.sources.detect(local_source_path)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
eac_tools-0.77.1 sub/avm/lib/avm/applications/base.rb
eac_tools-0.77.0 sub/avm/lib/avm/applications/base.rb
eac_tools-0.76.1 sub/avm/lib/avm/applications/base.rb
eac_tools-0.76.0 sub/avm/lib/avm/applications/base.rb
eac_tools-0.75.2 sub/avm/lib/avm/applications/base.rb
eac_tools-0.75.1 sub/avm/lib/avm/applications/base.rb
eac_tools-0.75.0 sub/avm/lib/avm/applications/base.rb
eac_tools-0.74.1 sub/avm/lib/avm/applications/base.rb
eac_tools-0.74.0 sub/avm/lib/avm/applications/base.rb
avm-0.79.0 lib/avm/applications/base.rb
eac_tools-0.73.0 sub/avm/lib/avm/applications/base.rb