Class: TerraformWrapper::Tasks::Validate
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- TerraformWrapper::Tasks::Validate
- Includes:
- Shared::Logging
- Defined in:
- lib/terraform-wrapper/tasks/validate.rb
Instance Method Summary collapse
-
#initialize(binary:, code:) {|_self| ... } ⇒ Validate
constructor
A new instance of Validate.
- #validate_task ⇒ Object
Methods included from Shared::Logging
configure_logger_for, logger_for
Constructor Details
#initialize(binary:, code:) {|_self| ... } ⇒ Validate
Returns a new instance of Validate.
21 22 23 24 25 26 27 28 |
# File 'lib/terraform-wrapper/tasks/validate.rb', line 21 def initialize(binary:, code:) @binary = binary @code = code yield self if block_given? validate_task end |
Instance Method Details
#validate_task ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/terraform-wrapper/tasks/validate.rb', line 32 def validate_task desc 'Validates the Terraform code for an infrastructure component. Will also check formatting by default.' task :validate, [:fmt] => :binary do |_t, args| args.with_defaults(fmt: true) runner = TerraformWrapper::Shared::Runner.new(binary: @binary, code: @code) logger.info("Validating Terraform component: #{@code.name}...") runner.download runner.validate runner.fmt if args[:fmt].to_s.downcase == 'true' end end |