class YleTfPlugins::Landscape::Command
Public Instance Methods
execute(env)
click to toggle source
# File lib/yle_tf-landscape/command.rb, line 10 def execute(env) args = env[:tf_command_args].dup args << '-no-color' args << '-input=false' landscape_handler = landscape_handler(env) YleTf::Logger.info 'Running `terraform plan`' YleTf::System.cmd('terraform', 'plan', *args, stdin: :console, stdout: landscape_handler) end
landscape_handler(env)
click to toggle source
# File lib/yle_tf-landscape/command.rb, line 23 def landscape_handler(env) printer = landscape_printer(env) proc do |io| YleTf::Logger.debug 'Streaming to Landscape' Thread.new { printer.process_stream(io) } end end
landscape_output(env)
click to toggle source
# File lib/yle_tf-landscape/command.rb, line 37 def landscape_output(env) output = TerraformLandscape::Output.new(STDOUT) # Disable colors in Landscape if env[:tf_options][:no_color] String.disable_colorization = true output.color_enabled = false end output end
landscape_printer(env)
click to toggle source
# File lib/yle_tf-landscape/command.rb, line 32 def landscape_printer(env) output = landscape_output(env) TerraformLandscape::Printer.new(output) end