class YleTf::Action::TfHooks

Public Class Methods

new(app) click to toggle source
# File lib/yle_tf/action/tf_hooks.rb, line 9
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/yle_tf/action/tf_hooks.rb, line 13
def call(env)
  @env = env

  hook_runner.run('pre')
  @app.call(env)
  hook_runner.run('post')
end
config() click to toggle source
# File lib/yle_tf/action/tf_hooks.rb, line 37
def config
  @env[:config]
end
hook_env() click to toggle source
# File lib/yle_tf/action/tf_hooks.rb, line 29
def hook_env
  {
    'TF_COMMAND'    => @env[:tf_command],
    'TF_ENV'        => @env[:tf_env],
    'TF_MODULE_DIR' => config.module_dir.to_s,
  }
end
hook_runner() click to toggle source
# File lib/yle_tf/action/tf_hooks.rb, line 21
def hook_runner
  if run_hooks?
    TfHook::Runner.new(config, hook_env)
  else
    NoRunner
  end
end
run_hooks?() click to toggle source
# File lib/yle_tf/action/tf_hooks.rb, line 41
def run_hooks?
  !@env[:tf_options][:no_hooks]
end