Module: Terradactyl::Commands
Overview
rubocop:disable Metrics/ModuleLength
Defined Under Namespace
Modules: Rev011, Rev012, Rev013, Rev014, Rev015, Rev1_00, Rev1_01, Rev1_02, Rev1_03, Rev1_04, Rev1_05, Rev1_06, Rev1_07
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.extend_by_revision(tf_version, object) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/terradactyl/commands.rb', line 59
def extend_by_revision(tf_version, object)
anon_module = revision_module
revision = revision_constant(tf_version)
anon_module.include(self)
anon_module.prepend(revision)
object.class.define_singleton_method(:revision) { revision }
object.define_singleton_method(:revision) { revision }
object.extend(anon_module)
end
|
Instance Method Details
#apply ⇒ Object
138
139
140
|
# File 'lib/terradactyl/commands.rb', line 138
def apply
Apply.execute(dir_or_plan: plan_file, options: command_options)
end
|
#clean ⇒ Object
rubocop:disable Metrics/AbcSize
166
167
168
169
170
171
172
173
174
|
# File 'lib/terradactyl/commands.rb', line 166
def clean
removals = config.cleanup.match.map { |p| Dir.glob("**/#{p}") }
removals << `find . -type d -empty`.split if config.cleanup.empty
removals = removals.flatten.sort.uniq.each do |trash|
print_dot("Removing: #{trash}", :light_yellow)
FileUtils.rm_rf(trash)
end
puts unless removals.empty?
end
|
#destroy ⇒ Object
147
148
149
150
|
# File 'lib/terradactyl/commands.rb', line 147
def destroy
options = command_options.tap { |dat| dat.state = state_file }
Destroy.execute(dir_or_plan: nil, options: options)
end
|
#fmt ⇒ Object
157
158
159
|
# File 'lib/terradactyl/commands.rb', line 157
def fmt
Fmt.execute(dir_or_plan: nil, options: command_options)
end
|
#init ⇒ Object
108
109
110
|
# File 'lib/terradactyl/commands.rb', line 108
def init
Init.execute(dir_or_plan: nil, options: command_options)
end
|
#lint ⇒ Object
152
153
154
155
|
# File 'lib/terradactyl/commands.rb', line 152
def lint
options = command_options.tap { |dat| dat.check = true }
Fmt.execute(dir_or_plan: nil, options: options)
end
|
#plan ⇒ Object
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/terradactyl/commands.rb', line 112
def plan
options = command_options.tap do |dat|
dat.state = state_file
dat.out = plan_file
dat.no_color = true
end
captured = Plan.execute(dir_or_plan: nil,
options: options,
capture: true)
@plan_file_obj = load_plan_file
case captured.exitstatus
when 0
'No changes. Infrastructure is up-to-date.'
when 1
@plan_file_obj.error_output = captured.stderr
when 2
@plan_file_obj.plan_output = captured.stdout
@plan_file_obj.save
end
captured.exitstatus
end
|
#refresh ⇒ Object
142
143
144
145
|
# File 'lib/terradactyl/commands.rb', line 142
def refresh
options = command_options.tap { |dat| dat.state = state_file }
Refresh.execute(dir_or_plan: nil, options: options)
end
|
#upgrade ⇒ Object
rubocop:enable Metrics/AbcSize
177
178
179
|
# File 'lib/terradactyl/commands.rb', line 177
def upgrade
perform_upgrade
end
|
#validate ⇒ Object
161
162
163
|
# File 'lib/terradactyl/commands.rb', line 161
def validate
Validate.execute(dir_or_plan: nil, options: command_options)
end
|