Class: PackRb::SubCommands

Inherits:
Object
  • Object
show all
Includes:
Build, Inspect, Validate
Defined in:
lib/pack_rb/sub_commands.rb,
lib/pack_rb/sub_commands/build.rb,
lib/pack_rb/sub_commands/inspect.rb,
lib/pack_rb/sub_commands/validate.rb,
lib/pack_rb/sub_commands/error/errors.rb

Defined Under Namespace

Modules: Build, Error, Inspect, Validate

Instance Method Summary collapse

Methods included from Validate

#validate

Methods included from Inspect

#inspect_tpl

Methods included from Build

#build, #parse_options

Constructor Details

#initialize(opts = {}) ⇒ SubCommands

Returns a new instance of SubCommands.



12
13
14
15
16
17
# File 'lib/pack_rb/sub_commands.rb', line 12

def initialize(opts = {})
  if opts[:stream_output]
    STDOUT.sync = true
    STDERR.sync = true
  end
end

Instance Method Details

#execute(opts) ⇒ Array

Execute a Packer command via Executor.run_cmd_stream_output

Parameters:

  • opts (Hash)

    options passed to the Packer class

Returns:

  • (Array)
    • stdout [String], stderr [String], exit code [Fixnum]



24
25
26
27
28
29
# File 'lib/pack_rb/sub_commands.rb', line 24

def execute(opts)
  cmd = opts[:cmd]
  tpl = opts[:tpl]

  PackRb::Executor.run_cmd_stream_output("#{cmd} -", tpl)
end