Class: Pronto::TerraformFormat::Wrapper
- Inherits:
-
Object
- Object
- Pronto::TerraformFormat::Wrapper
- Defined in:
- lib/pronto/terraform_format/wrapper.rb
Instance Method Summary collapse
-
#initialize ⇒ Wrapper
constructor
A new instance of Wrapper.
- #run(file_path) ⇒ Object
Constructor Details
#initialize ⇒ Wrapper
Returns a new instance of Wrapper.
9 10 11 |
# File 'lib/pronto/terraform_format/wrapper.rb', line 9 def initialize @terraform_path = ENV['PRONTO_TERRAFORM_PATH'] || 'terraform' end |
Instance Method Details
#run(file_path) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pronto/terraform_format/wrapper.rb', line 13 def run(file_path) stdout, stderr, = Open3.capture3("#{@terraform_path} "\ 'fmt '\ '-write=false '\ '-list=false '\ '-diff=true '\ '-check=false '\ "#{file_path}") if stderr && !stderr.empty? puts "WARN: pronto-terraform_format: #{file_path}: #{stderr}" end return [] if stdout.nil? || stdout == 0 OutputParser.new.parse(file_path, stdout) end |