Class: Pangea::CLI::Config

Inherits:
Object show all
Defined in:
lib/pangea/cli/config.rb

Overview

Resolves workspace configuration from pangea.yml files. Handles namespace resolution, state backend config, and workspace paths.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template_file, namespace: nil) ⇒ Config

Returns a new instance of Config.



14
15
16
17
18
19
20
21
# File 'lib/pangea/cli/config.rb', line 14

def initialize(template_file, namespace: nil)
  @template_file = File.expand_path(template_file)
  @template_dir = File.dirname(@template_file)
  @template_name = File.basename(@template_file, '.rb')
  @namespace = resolve_namespace(namespace)
  @workspace_dir = build_workspace_dir
  @backend_config = resolve_backend_config
end

Instance Attribute Details

#backend_configObject (readonly)

Returns the value of attribute backend_config.



11
12
13
# File 'lib/pangea/cli/config.rb', line 11

def backend_config
  @backend_config
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



11
12
13
# File 'lib/pangea/cli/config.rb', line 11

def namespace
  @namespace
end

#template_dirObject (readonly)

Returns the value of attribute template_dir.



11
12
13
# File 'lib/pangea/cli/config.rb', line 11

def template_dir
  @template_dir
end

#template_fileObject (readonly)

Returns the value of attribute template_file.



11
12
13
# File 'lib/pangea/cli/config.rb', line 11

def template_file
  @template_file
end

#template_nameObject (readonly)

Returns the value of attribute template_name.



11
12
13
# File 'lib/pangea/cli/config.rb', line 11

def template_name
  @template_name
end

#workspace_dirObject (readonly)

Returns the value of attribute workspace_dir.



11
12
13
# File 'lib/pangea/cli/config.rb', line 11

def workspace_dir
  @workspace_dir
end

Instance Method Details

#template_contentObject



23
24
25
# File 'lib/pangea/cli/config.rb', line 23

def template_content
  @template_content ||= File.read(@template_file)
end