Class: Rscons::ThreadedCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/rscons/threaded_command.rb

Overview

If a builder returns an instance of this class from its #run method, then Rscons will execute the command specified in a thread and allow other builders to continue executing in parallel.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, options = {}) ⇒ ThreadedCommand

Create a ThreadedCommand object.

Parameters:

  • command (Array<String>)

    The command to execute.

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

    Optional parameters.

Options Hash (options):

  • :builder_info (Object)

    Arbitrary object to store builder-specific info. This object value will be passed back into the builder's #finalize method.

  • :short_description (String)

    Short description of the command. This will be printed to standard output if the Environment's echo mode is :short.

  • :system_env (Hash)

    Environment Hash to pass to Kernel#system.

  • :system_options (Hash)

    Options Hash to pass to Kernel#system.


54
55
56
57
58
59
60
# File 'lib/rscons/threaded_command.rb', line 54

def initialize(command, options = {})
  @command = command
  @builder_info = options[:builder_info]
  @short_description = options[:short_description]
  @system_env = options[:system_env]
  @system_options = options[:system_options]
end

Instance Attribute Details

#build_operationHash

Returns Field for Rscons to store the build operation while this threaded command is executing.

Returns:

  • (Hash)

    Field for Rscons to store the build operation while this threaded command is executing.


32
33
34
# File 'lib/rscons/threaded_command.rb', line 32

def build_operation
  @build_operation
end

#builder_infoObject (readonly)

Returns Arbitrary object to store builder-specific info. This object value will be passed back into the builder's #finalize method.

Returns:

  • (Object)

    Arbitrary object to store builder-specific info. This object value will be passed back into the builder's #finalize method.


14
15
16
# File 'lib/rscons/threaded_command.rb', line 14

def builder_info
  @builder_info
end

#commandArray<String> (readonly)

Returns The command to execute.

Returns:

  • (Array<String>)

    The command to execute.


9
10
11
# File 'lib/rscons/threaded_command.rb', line 9

def command
  @command
end

#short_descriptionString (readonly)

Returns Short description of the command. This will be printed to standard output if the Environment's echo mode is :short.

Returns:

  • (String)

    Short description of the command. This will be printed to standard output if the Environment's echo mode is :short.


19
20
21
# File 'lib/rscons/threaded_command.rb', line 19

def short_description
  @short_description
end

#system_envHash (readonly)

Returns Environment Hash to pass to Kernel#system.

Returns:

  • (Hash)

    Environment Hash to pass to Kernel#system.


23
24
25
# File 'lib/rscons/threaded_command.rb', line 23

def system_env
  @system_env
end

#system_optionsHash (readonly)

Returns Options Hash to pass to Kernel#system.

Returns:

  • (Hash)

    Options Hash to pass to Kernel#system.


27
28
29
# File 'lib/rscons/threaded_command.rb', line 27

def system_options
  @system_options
end

#threadThread

Returns The thread waiting on this command to terminate.

Returns:

  • (Thread)

    The thread waiting on this command to terminate.


36
37
38
# File 'lib/rscons/threaded_command.rb', line 36

def thread
  @thread
end