class EacLauncher::Context

Constants

DEFAULT_CACHE_ROOT
DEFAULT_PROJECTS_ROOT
DEFAULT_SETTINGS_FILE

Attributes

current[W]
cache_root[R]
instance_manager[RW]
publish_options[RW]
recache[RW]
root[R]
settings[R]

Public Class Methods

current() click to toggle source
# File lib/eac_launcher/context.rb, line 24
def current
  @current ||= default
end
default() click to toggle source
# File lib/eac_launcher/context.rb, line 28
def default
  @default ||= Context.new
end
new(options = {}) click to toggle source
# 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 = ::EacLauncher::Context::InstanceManager.new(self)
  @recache = false
end

Public Instance Methods

instance(name) click to toggle source
# File lib/eac_launcher/context.rb, line 46
def instance(name)
  instances.find { |i| i.name == name }
end
instances() click to toggle source
# File lib/eac_launcher/context.rb, line 50
def instances
  @instance_manager.instances
end
pending_instances() click to toggle source
# File lib/eac_launcher/context.rb, line 54
def pending_instances
  @instance_manager.pending_instances
end

Private Instance Methods

build_option(key) click to toggle source
# File lib/eac_launcher/context.rb, line 60
def build_option(key)
  @options[key] || env_option(key) || default_option(key)
end
default_option(key) click to toggle source
# File lib/eac_launcher/context.rb, line 68
def default_option(key)
  self.class.const_get("DEFAULT_#{key}".underscore.upcase)
end
env_option(key) click to toggle source
# File lib/eac_launcher/context.rb, line 64
def env_option(key)
  ENV["EAC_LAUNCHER_#{key}".underscore.upcase]
end
projects_uncached() click to toggle source
# File lib/eac_launcher/context.rb, line 72
def projects_uncached
  r = {}
  instances.each do |i|
    r[i.project_name] ||= []
    r[i.project_name] << i
  end
  r.map { |name, instances| ::EacLauncher::Project.new(name, instances) }
end