Class: Avm::Instances::Base

Inherits:
Object show all
Includes:
Entries
Defined in:
lib/avm/instances/base.rb,
lib/avm/instances/base/entry_keys.rb,
lib/avm/instances/base/auto_values.rb,
lib/avm/instances/base/dockerizable.rb,
lib/avm/instances/base/auto_values/web.rb,
lib/avm/instances/base/auto_values/data.rb,
lib/avm/instances/base/auto_values/ruby.rb,
lib/avm/instances/base/auto_values/admin.rb,
lib/avm/instances/base/auto_values/access.rb,
lib/avm/instances/base/auto_values/mailer.rb,
lib/avm/instances/base/auto_values/source.rb,
lib/avm/instances/base/auto_values/system.rb,
lib/avm/instances/base/auto_values/database.rb,
lib/avm/instances/base/auto_values/filesystem.rb

Direct Known Subclasses

Self::Instance

Defined Under Namespace

Modules: AutoValues, Dockerizable, EntryKeys

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 Entries

#entry, #full_entry_path, #inherited_entry_value, #other_entry_value, #path_prefix, #read_entry, #read_entry_optional

Class Method Details

.by_id(id) ⇒ Object



20
21
22
23
24
# File 'lib/avm/instances/base.rb', line 20

def by_id(id)
  application_id, suffix = parse_id(id)
  require 'avm/instances/application'
  new(::Avm::Instances::Application.new(application_id), suffix)
end

Instance Method Details

#host_env_uncachedObject



48
49
50
51
52
53
54
55
# File 'lib/avm/instances/base.rb', line 48

def host_env_uncached
  access = read_entry(:access, list: ::Avm::Instances::Base.lists.access.values)
  case access
  when 'local' then ::EacRubyUtils::Envs.local
  when 'ssh' then ::EacRubyUtils::Envs.ssh(read_entry('ssh.url'))
  else raise("Unmapped access value: \"#{access}\"")
  end
end

#idObject



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

def id
  "#{application.id}_#{suffix}"
end

#to_sObject



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

def to_s
  id
end