Class: Proteus::ContextManagement::Context

Inherits:
Object
  • Object
show all
Includes:
Helpers::PathHelpers
Defined in:
lib/proteus/context_management/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::PathHelpers

#config_dir, #config_path, #context_path, #context_temp_directory, #contexts_path, #environments_path, #module_config_path, #module_data_path, #module_hooks_path, #module_io_file, #module_path, #module_templates_path, #modules_path, #plan_file, #root_path, #state_file, #var_file

Constructor Details

#initialize(name:) ⇒ Context

Returns a new instance of Context.



10
11
12
13
14
# File 'lib/proteus/context_management/context.rb', line 10

def initialize(name:)
  @name = name

  ensure_temp_directory
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/proteus/context_management/context.rb', line 8

def name
  @name
end

Instance Method Details

#environmentsObject



16
17
18
19
20
# File 'lib/proteus/context_management/context.rb', line 16

def environments
  Dir.glob("#{File.expand_path(File.join(environments_path(@name)))}/*.tfvars").map do |vars_file|
    File.basename(vars_file).split('.')[1]
  end
end