Class: Avm::Launcher::Context

Inherits:
Object
  • Object
show all
Includes:
EacRubyUtils::SimpleCache
Defined in:
lib/avm/launcher/context.rb,
lib/avm/launcher/context/settings.rb,
lib/avm/launcher/context/instance_manager.rb,
lib/avm/launcher/context/instance_collector.rb,
lib/avm/launcher/context/instance_discovery.rb,
lib/avm/launcher/context/instance_manager/cached_instance.rb,
lib/avm/launcher/context/instance_manager/cached_instances.rb

Defined Under Namespace

Classes: InstanceCollector, InstanceDiscovery, InstanceManager, Settings

Constant Summary collapse

CONFIG_PATH_PREFIX =
'launcher'

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Context

Returns a new instance of Context.



37
38
39
40
41
42
43
44
45
# File 'lib/avm/launcher/context.rb', line 37

def initialize(options = {})
  @options = options.with_indifferent_access
  @root = ::Avm::Launcher::Paths::Logical.new(self, nil, build_option(:projects_root), '/')
  @settings = ::Avm::Launcher::Context::Settings.new(build_option(:settings_file))
  @cache_root = build_option(:cache_root)
  @publish_options = { new: false, confirm: false, stereotype: nil }
  @instance_manager = ::Avm::Launcher::Context::InstanceManager.new(self)
  @recache = false
end

Class Attribute Details

.currentObject



23
24
25
# File 'lib/avm/launcher/context.rb', line 23

def current
  @current ||= default
end

Instance Attribute Details

#cache_rootObject (readonly)

Returns the value of attribute cache_root.



32
33
34
# File 'lib/avm/launcher/context.rb', line 32

def cache_root
  @cache_root
end

#instance_managerObject

Returns the value of attribute instance_manager.



33
34
35
# File 'lib/avm/launcher/context.rb', line 33

def instance_manager
  @instance_manager
end

#publish_optionsObject

Returns the value of attribute publish_options.



33
34
35
# File 'lib/avm/launcher/context.rb', line 33

def publish_options
  @publish_options
end

#recacheObject

Returns the value of attribute recache.



33
34
35
# File 'lib/avm/launcher/context.rb', line 33

def recache
  @recache
end

#rootObject (readonly)

Returns the value of attribute root.



32
33
34
# File 'lib/avm/launcher/context.rb', line 32

def root
  @root
end

#settingsObject (readonly)

Returns the value of attribute settings.



32
33
34
# File 'lib/avm/launcher/context.rb', line 32

def settings
  @settings
end

Class Method Details

.defaultObject



27
28
29
# File 'lib/avm/launcher/context.rb', line 27

def default
  @default ||= Context.new
end

Instance Method Details

#fs_object_idObject



47
48
49
# File 'lib/avm/launcher/context.rb', line 47

def fs_object_id
  root.real.variableize
end

#instance(name) ⇒ Object



51
52
53
# File 'lib/avm/launcher/context.rb', line 51

def instance(name)
  instances.find { |i| i.name == name }
end

#instancesObject



55
56
57
# File 'lib/avm/launcher/context.rb', line 55

def instances
  @instance_manager.instances
end

#pending_instancesObject



59
60
61
# File 'lib/avm/launcher/context.rb', line 59

def pending_instances
  @instance_manager.pending_instances
end