Class: Avm::Instances::Base

Inherits:
Object
  • Object
show all
Includes:
Entries::Base, With::ApplicationStereotype, With::ExtraSubcommands
Defined in:
lib/avm/instances/base.rb,
lib/avm/instances/base/web.rb,
lib/avm/instances/base/install.rb,
lib/avm/instances/base/processes.rb,
lib/avm/instances/base/entry_keys.rb,
lib/avm/instances/base/production.rb,
lib/avm/instances/base/auto_values.rb,
lib/avm/instances/base/dockerizable.rb,
lib/avm/instances/base/auto_values/data.rb,
lib/avm/instances/base/subcommand_parent.rb,
lib/avm/instances/base/auto_values/mailer.rb,
lib/avm/instances/base/auto_values/source.rb,
lib/avm/instances/base/auto_values/database.rb

Direct Known Subclasses

Self::Instance

Defined Under Namespace

Modules: AutoValues, Dockerizable, EntryKeys, Install, Processes, Production, Web Classes: SubcommandParent

Constant Summary collapse

ID_PATTERN =
/\A([a-z0-9]+(?:-[a-z0-9]+)*)_(.+)\z/.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from With::ApplicationStereotype

#stereotype_namespace_module

Methods included from With::ExtraSubcommands

#extra_available_subcommands, #extra_available_subcommands_from_runners_module

Methods included from Entries::Base

#entries_provider_id, #entries_provider_id!, #entry, #full_entry_path, #path_prefix, #read_entry, #read_entry_optional

Class Method Details

.by_id(id) ⇒ Object



27
28
29
30
31
# File 'lib/avm/instances/base.rb', line 27

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

Instance Method Details

#data_packageAvm::Instances::Data::Package



39
40
41
# File 'lib/avm/instances/base.rb', line 39

def data_package
  @data_package ||= data_package_create
end

#data_package_createAvm::Instances::Data::Package



44
45
46
# File 'lib/avm/instances/base.rb', line 44

def data_package_create
  ::Avm::Instances::Data::Package.new(self)
end

#host_env_uncachedObject



57
58
59
60
61
62
63
# File 'lib/avm/instances/base.rb', line 57

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

#idString

Returns:

  • (String)


49
50
51
# File 'lib/avm/instances/base.rb', line 49

def id
  ::Avm::Instances::Ids.build(application.id, suffix)
end

#local?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/avm/instances/base.rb', line 66

def local?
  suffix == ::Avm::Applications::Base::LocalInstance::LOCAL_INSTANCE_SUFFIX
end

#to_sObject



53
54
55
# File 'lib/avm/instances/base.rb', line 53

def to_s
  id
end