Sha256: ff44bee9c5a2a9b65e6abfe769b38eea30769d942b5802bf70e20fc90839d625
Contents?: true
Size: 1.51 KB
Versions: 65
Compression:
Stored size: 1.51 KB
Contents
# frozen_string_literal: true require 'avm/instances/ids' require 'avm/with/application_stereotype' require 'avm/with/extra_subcommands' require 'eac_ruby_utils/require_sub' require 'eac_ruby_utils/simple_cache' require 'avm/entries/base' module Avm module Instances class Base enable_abstract_methods enable_listable enable_simple_cache include ::Avm::Entries::Base require_sub __FILE__, include_modules: true include ::Avm::With::ExtraSubcommands include ::Avm::With::ApplicationStereotype lists.add_string :access, :local, :ssh ID_PATTERN = /\A([a-z0-9]+(?:\-[a-z0-9]+)*)_(.+)\z/.freeze class << self def by_id(id) parsed_id = ::Avm::Instances::Ids.parse!(id) require 'avm/applications/base' new(::Avm::Applications::Base.new(parsed_id.application_id), parsed_id.instance_suffix) end end common_constructor :application, :suffix do self.suffix = suffix.to_s end # @return [String] def id ::Avm::Instances::Ids.build(application.id, suffix) end def to_s id end def host_env_uncached case install_scheme when 'file' then ::EacRubyUtils::Envs.local when 'ssh' then ::EacRubyUtils::Envs.ssh(install_url) else raise("Unmapped access value: \"#{install_scheme}\"") end end private def source_instance_uncached ::Avm::Instances::Base.by_id(source_instance_id) end end end end
Version data entries
65 entries across 65 versions & 2 rubygems