Module: PangeaModule

Includes:
PangeaBase
Defined in:
lib/pangea-orchestrator/modules.rb

Constant Summary collapse

CACHE_DIR =
File.join(
  BASE_DIR,
  %(cache)
)
RUBIES_DIR =
File.join(
  BASE_DIR,
  %(rubies)
)

Constants included from PangeaBase

PangeaBase::BASE_DIR

Class Method Summary collapse

Class Method Details

.process(mod) ⇒ Object

entrypoint for module processing

Raises:

  • (ArgumentError)


115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/pangea-orchestrator/modules.rb', line 115

def process(mod)
  mod = symbolize(mod)

  name = mod.fetch(:name)
  data = mod.fetch(:data, {})

  raise ArgumentError, %(name cannot be nil) if name.nil?

  # understanding that module entrypoint loading
  # will work with #{context}-#{name}
  context       = mod.fetch(:context, %(pangea-component))
  require_name  = %(#{context}-#{name})

  require require_name
  render(data)
end

.symbolize(hash) ⇒ Object



106
107
108
# File 'lib/pangea-orchestrator/modules.rb', line 106

def symbolize(hash)
  JSON[JSON[hash], symbolize_names: true]
end

.terraform_synthObject



110
111
112
# File 'lib/pangea-orchestrator/modules.rb', line 110

def terraform_synth
  @terraform_synth ||= TerraformSynthesizer.new
end