Class: YleTfPlugins::CommandDefault::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/yle_tf_plugins/commands/__default/command.rb

Instance Method Summary collapse

Instance Method Details

#color?(env) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/yle_tf_plugins/commands/__default/command.rb', line 19

def color?(env)
  !env[:tf_options][:no_color]
end

#execute(env) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/yle_tf_plugins/commands/__default/command.rb', line 9

def execute(env)
  command = env[:tf_command]

  args = env[:tf_command_args].dup
  args << '-no-color' if !color?(env)

  YleTf::Logger.info "Running `terraform #{command}`"
  YleTf::System.console_cmd('terraform', command, *args)
end