Class: EacLauncher::Context

Inherits:
Object show all
Includes:
EacRubyUtils::Console::Speaker, EacRubyUtils::SimpleCache
Defined in:
lib/eac_launcher/context.rb,
lib/eac_launcher/context/settings.rb,
lib/eac_launcher/context/instance_discovery.rb

Defined Under Namespace

Classes: InstanceDiscovery, Settings

Constant Summary collapse

DEFAULT_PROJECTS_ROOT =
'.'
DEFAULT_SETTINGS_FILE =
::File.join(ENV['HOME'], '.config', 'eac_launcher', 'settings.yml')
DEFAULT_CACHE_ROOT =
::File.join(ENV['HOME'], '.cache', 'eac_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.



36
37
38
39
40
41
42
43
44
# File 'lib/eac_launcher/context.rb', line 36

def initialize(options = {})
  @options = options.with_indifferent_access
  @root = ::EacLauncher::Paths::Logical.new(self, nil, build_option(:projects_root), '/')
  @settings = ::EacLauncher::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



24
25
26
# File 'lib/eac_launcher/context.rb', line 24

def current
  @current ||= default
end

Instance Attribute Details

#cache_rootObject (readonly)

Returns the value of attribute cache_root.



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

def cache_root
  @cache_root
end

#instance_managerObject

Returns the value of attribute instance_manager.



34
35
36
# File 'lib/eac_launcher/context.rb', line 34

def instance_manager
  @instance_manager
end

#publish_optionsObject

Returns the value of attribute publish_options.



34
35
36
# File 'lib/eac_launcher/context.rb', line 34

def publish_options
  @publish_options
end

#recacheObject

Returns the value of attribute recache.



34
35
36
# File 'lib/eac_launcher/context.rb', line 34

def recache
  @recache
end

#rootObject (readonly)

Returns the value of attribute root.



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

def root
  @root
end

#settingsObject (readonly)

Returns the value of attribute settings.



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

def settings
  @settings
end

Class Method Details

.defaultObject



28
29
30
# File 'lib/eac_launcher/context.rb', line 28

def default
  @default ||= Context.new
end

Instance Method Details

#instance(name) ⇒ Object



46
47
48
# File 'lib/eac_launcher/context.rb', line 46

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

#instancesObject



50
51
52
# File 'lib/eac_launcher/context.rb', line 50

def instances
  @instance_manager.instances
end

#pending_instancesObject



54
55
56
# File 'lib/eac_launcher/context.rb', line 54

def pending_instances
  @instance_manager.pending_instances
end