Class: Barbeque::Runner::Hako

Inherits:
Object
  • Object
show all
Defined in:
lib/barbeque/runner/hako.rb

Instance Method Summary collapse

Constructor Details

#initialize(docker_image:, hako_dir:, hako_env: {}, yaml_dir:) ⇒ Hako

Returns a new instance of Hako.

Parameters:

  • docker_image (Barbeque::DockerImage)
  • hako_dir (String)
  • hako_env (Hash) (defaults to: {})
  • yaml_dir (String)


10
11
12
13
14
15
16
# File 'lib/barbeque/runner/hako.rb', line 10

def initialize(docker_image:, hako_dir:, hako_env: {}, yaml_dir:)
  @app_name = docker_image.repository
  @tag      = docker_image.tag
  @hako_dir = hako_dir
  @hako_env = hako_env
  @yaml_dir = yaml_dir
end

Instance Method Details

#run(command, envs) ⇒ String, Process::Status

Parameters:

  • command (Array<String>)
  • envs (Hash)

Returns:

  • (String)

    stdout

  • (String)

    stderr

  • (Process::Status)

    status



23
24
25
26
27
28
# File 'lib/barbeque/runner/hako.rb', line 23

def run(command, envs)
  cmd = build_hako_oneshot_command(command, envs)
  Bundler.with_clean_env do
    Open3.capture3(@hako_env, *cmd, chdir: @hako_dir)
  end
end