Class: Bob::Builder
Overview
A Builder will take care of building a buildable (wow, you didn’t see that coming, right?).
Instance Attribute Summary collapse
-
#buildable ⇒ Object
readonly
Returns the value of attribute buildable.
Instance Method Summary collapse
-
#build ⇒ Object
This is where the magic happens:.
-
#initialize(buildable) ⇒ Builder
constructor
Instantiate the Builder, passing an object that understands the
Buildable
interface.
Constructor Details
#initialize(buildable) ⇒ Builder
Instantiate the Builder, passing an object that understands the Buildable
interface.
11 12 13 |
# File 'lib/bob/builder.rb', line 11 def initialize(buildable) @buildable = buildable end |
Instance Attribute Details
#buildable ⇒ Object (readonly)
Returns the value of attribute buildable.
5 6 7 |
# File 'lib/bob/builder.rb', line 5 def buildable @buildable end |
Instance Method Details
#build ⇒ Object
This is where the magic happens:
-
Notify the buildable that the build is starting.
-
Check out the repo to the appropriate commit.
-
Run the build script on it.
-
Reports the build back to the buildable.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bob/builder.rb', line 21 def build Bob.logger.info "Building #{buildable.commit} of the #{buildable.scm} repo at #{buildable.uri}" in_background do buildable.start_building if buildable.respond_to?(:start_building) scm.with_commit(buildable.commit) { |commit_info| buildable.finish_building(commit_info, *run_build_script) } end end |