Class: Omnibus::Builder::BuildCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/omnibus/builder.rb

Overview

This is an internal wrapper around a command executed on the system. The block could contain a Ruby command (such as FileUtils.rm_rf('/')), or it could contain a call to shell out to the system.

Public API collapse

Public API collapse

Constructor Details

#initialize(description, &block) ⇒ BuildCommand

Create a new BuildCommand object.

Parameters:

  • description (String)

    a unique identifier for this build command - it will be used for logging and timing labels

  • block (Proc)

    the block to capture


955
956
957
# File 'lib/omnibus/builder.rb', line 955

def initialize(description, &block)
  @description, @block = description, block
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description


944
945
946
# File 'lib/omnibus/builder.rb', line 944

def description
  @description
end

Instance Method Details

#run(builder) ⇒ Object

Execute the build command against the given object. Because BuildCommand objects could reference internal DSL methods, this method requires you pass in an object against which to instance_eval the block. Otherwise, you would be severly restricted in the commands avaiable to you via the DSL.

Parameters:

  • builder (Builder)

    the builder to instance_eval against


969
970
971
# File 'lib/omnibus/builder.rb', line 969

def run(builder)
  builder.instance_eval(&@block)
end