Class: EacLauncher::Context

Inherits:
Object
  • Object
show all
Includes:
Eac::SimpleCache
Defined in:
lib/eac_launcher/context.rb,
lib/eac_launcher/context/settings.rb

Defined Under Namespace

Classes: Settings

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(projects_root, settings_file) ⇒ Context

Returns a new instance of Context.



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

def initialize(projects_root, settings_file)
  @root = ::EacLauncher::Instances::Base.new(projects_root, nil)
  @settings = ::EacLauncher::Context::Settings.new(settings_file)
  @publish_options = { new: false, confirm: false, stereotype: nil }
end

Instance Attribute Details

#publish_optionsObject

Returns the value of attribute publish_options.



20
21
22
# File 'lib/eac_launcher/context.rb', line 20

def publish_options
  @publish_options
end

#rootObject (readonly)

Returns the value of attribute root.



19
20
21
# File 'lib/eac_launcher/context.rb', line 19

def root
  @root
end

#settingsObject (readonly)

Returns the value of attribute settings.



19
20
21
# File 'lib/eac_launcher/context.rb', line 19

def settings
  @settings
end

Class Method Details

.currentObject



6
7
8
# File 'lib/eac_launcher/context.rb', line 6

def current
  default
end

.defaultObject



10
11
12
13
14
15
16
# File 'lib/eac_launcher/context.rb', line 10

def default
  @default ||= Context.new(
    ENV['EAC_LAUNCHER_PROJECTS_ROOT'] || '.',
    ENV['EAC_LAUNCHER_SETTINGS_FILE'] ||
      ::File.join(ENV['HOME'], '.config', 'eac_launcher', 'settings.yml')
  )
end

Instance Method Details

#cache_rootObject



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

def cache_root
  File.join(ENV['HOME'], '.cache', 'cli-utils', 'dev')
end