Class: PDK::CLI::ExecGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/pdk/cli/exec_group.rb

Direct Known Subclasses

ParallelExecGroup, SerialExecGroup

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_message, opts = {}) ⇒ ExecGroup

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Base class for an Exection Group

Parameters:

  • message (String)

    A name or message for this group. Provided for backwards compatibility during refactor

  • opts (Hash) (defaults to: {})

    A hash of options used to configure the execution group. Provided for backwards compatibility during refactor



31
32
33
# File 'lib/pdk/cli/exec_group.rb', line 31

def initialize(_message, opts = {})
  @options = opts
end

Class Method Details

.create(message, create_options = {}, group_opts = {}) ⇒ ExecGroup

Execution Group (ExecGroup) factory.

Parameters:

  • message (String)

    A name or message for this group. Provided for backwards compatibility during refactor

  • create_options (Hash) (defaults to: {})

    A hash options used during creation of the ExecGroup. This are not passed to the new object

  • group_opts (Hash) (defaults to: {})

    A hash of options used to configure the execution group. Provided for backwards compatibility during refactor

Options Hash (create_options):

  • :parallel (Boolean)

    Whether the group should be executed in Parallel (True) or Serial (False)

Returns:



16
17
18
19
20
21
22
# File 'lib/pdk/cli/exec_group.rb', line 16

def self.create(message, create_options = {}, group_opts = {})
  if create_options[:parallel]
    ParallelExecGroup.new(message, group_opts)
  else
    SerialExecGroup.new(message, group_opts)
  end
end

Instance Method Details

#exit_codeint

This method is abstract.

The return code of running all registered blocks

Returns:

  • (int)

    The highest exit code from the blocks



49
# File 'lib/pdk/cli/exec_group.rb', line 49

def exit_code; end

#register(&_block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Register something to execute as a group

Parameters:

  • block (Block)

    A block of ruby to execute

Raises:



40
41
42
# File 'lib/pdk/cli/exec_group.rb', line 40

def register(&_block)
  raise PDK::CLI::FatalError, _('No block registered') unless block_given?
end