Class: InfraCommand
Overview
Constant Summary
collapse
- NAME =
:infra
Constants included
from Constants
Constants::ARTIFACT_FILE, Constants::CACHE_DIR, Constants::EXTENSIONS, Constants::PROJECT_SRC_DIRS, Constants::PROJECT_VERSION
Instance Method Summary
collapse
Instance Method Details
#common_run_checks ⇒ Object
67
68
69
|
# File 'lib/pangea/cli/subcommands/infra.rb', line 67
def common_run_checks
reject_empty_configurations
end
|
#config ⇒ Object
63
64
65
|
# File 'lib/pangea/cli/subcommands/infra.rb', line 63
def config
Say.terminal JSON.pretty_generate(cfg_synth)
end
|
#help ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/pangea/cli/subcommands/infra.rb', line 39
def help
<<~HELP
Usage: pangea infra command [OPTIONS] SUBCOMMAND
Arguments:
SUBCOMMAND subcommand for pangea infra
Subcommands:
plan plan infrastructure
apply apply infrastructure
config show run configuration
HELP
end
|
#plan(argv) ⇒ Object
57
58
59
60
61
|
# File 'lib/pangea/cli/subcommands/infra.rb', line 57
def plan(argv)
Say.terminal %(planning!)
parse(argv)
process_modules
end
|
#process_modules ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/pangea/cli/subcommands/infra.rb', line 71
def process_modules
namespaces = cfg_synth[:namespace].keys.map(&:to_sym)
namespaces.each do |namespace_name|
namespace = cfg_synth[:namespace][namespace_name]
context_names = namespace.keys.map(&:to_sym)
context_names.each do |cn|
context = namespace[cn]
modules = context[:modules]
modules.each_key do |mod_key|
mod = modules[mod_key]
PangeaModule.process(mod)
end
end
end
end
|
#reject_empty_configurations ⇒ Object
32
33
34
35
36
37
|
# File 'lib/pangea/cli/subcommands/infra.rb', line 32
def reject_empty_configurations
if cfg_synth.empty?
Say.terminal %(configuration empty, exiting...)
exit
end
end
|
#run(argv) ⇒ Object
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/pangea/cli/subcommands/infra.rb', line 89
def run(argv)
common_run_checks
if argv.length < 2
puts help
exit
end
config if argv[1].to_s.eql?(%(config))
plan(argv) if argv[1].to_s.eql?(%(plan))
apply(argv) if argv[1].to_s.eql?(%(apply))
end
|