Class: Omnibus::Builder::BuildCommand
- Inherits:
-
Object
- Object
- Omnibus::Builder::BuildCommand
- 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
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Public API collapse
-
#initialize(description, &block) ⇒ BuildCommand
constructor
Create a new BuildCommand object.
-
#run(builder) ⇒ Object
Execute the build command against the given object.
Constructor Details
#initialize(description, &block) ⇒ BuildCommand
Create a new BuildCommand object.
1086 1087 1088 |
# File 'lib/omnibus/builder.rb', line 1086 def initialize(description, &block) @description, @block = description, block end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
1075 1076 1077 |
# File 'lib/omnibus/builder.rb', line 1075 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.
1100 1101 1102 |
# File 'lib/omnibus/builder.rb', line 1100 def run(builder) builder.instance_eval(&@block) end |