Module: Packer::Binary::Command

Defined in:
lib/packer/binary/command.rb

Overview

This module handles running the actual CLI commands

Defined Under Namespace

Classes: CommandFailure

Class Method Summary collapse

Class Method Details

.binaryString

Downloads, extracts and returns the path to the binary

Returns:

  • (String)

    absolute path of the binary



20
21
22
23
24
25
# File 'lib/packer/binary/command.rb', line 20

def binary
  e = Executable.new
  e.download
  e.extract
  e.binary
end

.run(command) ⇒ String

Runs the given command with Core::Kernel.system Example run('sub-command -var "key=value" -machine-readable')

Parameters:

  • command (String)

    the full sub-command to run (including cli arguments)

Returns:



14
15
16
# File 'lib/packer/binary/command.rb', line 14

def run(command)
  system("#{binary} #{command}") || (raise CommandFailure)
end