Module: Bozo::Runner
Overview
Module mixed into the all Bozo executors that provides functionality for command execution and logging.
Instance Attribute Summary collapse
-
#build_configuration ⇒ Object
Returns the build configuration.
-
#env ⇒ Object
Returns the environment variables.
-
#global_params ⇒ Object
Returns the global parameters.
-
#params ⇒ Object
Returns the command parameters.
Instance Method Summary collapse
-
#build_server? ⇒ Boolean
Returns whether the build is being run on a build server.
-
#environment ⇒ Object
Returns the environment the build is being execute in.
-
#execute_command(tool, args) ⇒ Object
Executes a command line tool.
-
#pre_release? ⇒ Boolean
Returns whether a pre release should be created.
-
#version ⇒ Object
Returns the build version.
Methods included from Logging
#log_debug, #log_fatal, #log_info, #log_warn
Instance Attribute Details
#build_configuration ⇒ Object
Returns the build configuration.
19 20 21 |
# File 'lib/bozo/runner.rb', line 19 def build_configuration @build_configuration end |
#env ⇒ Object
Returns the environment variables.
16 17 18 |
# File 'lib/bozo/runner.rb', line 16 def env @env end |
#global_params ⇒ Object
Returns the global parameters.
10 11 12 |
# File 'lib/bozo/runner.rb', line 10 def global_params @global_params end |
#params ⇒ Object
Returns the command parameters.
13 14 15 |
# File 'lib/bozo/runner.rb', line 13 def params @params end |
Instance Method Details
#build_server? ⇒ Boolean
Returns whether the build is being run on a build server.
22 23 24 |
# File 'lib/bozo/runner.rb', line 22 def build_server? global_params[:build_server] end |
#environment ⇒ Object
Returns the environment the build is being execute in.
32 33 34 |
# File 'lib/bozo/runner.rb', line 32 def environment global_params[:environment] end |
#execute_command(tool, args) ⇒ Object
Executes a command line tool.
Raises a ‘Bozo::ExecutionError` if the command responds with a non-zero exit code.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/bozo/runner.rb', line 45 def execute_command(tool, args) args.flatten! executable = File.basename(args.first) arguments = args[1..-1].join(' ') log_info " #{tool} - #{executable} #{arguments}" raise Bozo::ExecutionError.new(tool, args, $?.exitstatus) unless system args.join ' ' end |
#pre_release? ⇒ Boolean
Returns whether a pre release should be created.
27 28 29 |
# File 'lib/bozo/runner.rb', line 27 def pre_release? global_params[:pre_release] end |
#version ⇒ Object
Returns the build version.
57 58 59 |
# File 'lib/bozo/runner.rb', line 57 def version build_configuration.version end |