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.


854
855
856
# File 'lib/omnibus/builder.rb', line 854

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

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description


843
844
845
# File 'lib/omnibus/builder.rb', line 843

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.


868
869
870
# File 'lib/omnibus/builder.rb', line 868

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