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, commit_id) ⇒ Builder
constructor
Instantiate the Builder, passing an object that understands the
Buildableinterface, and acommit_id.
Constructor Details
#initialize(buildable, commit_id) ⇒ Builder
Instantiate the Builder, passing an object that understands the Buildable interface, and a commit_id.
You can pass :head as the commit id, in which case it will resolve to the head commit of the current branch (for example, “HEAD” under git, or the latest revision under svn)
13 14 15 16 |
# File 'lib/bob/builder.rb', line 13 def initialize(buildable, commit_id) @buildable = buildable @commit_id = commit_id 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:
-
Check out the repo to the appropriate commit.
-
Notify the buildable that the build is starting.
-
Run the build script on it in the background.
-
Reports the build back to the buildable.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bob/builder.rb', line 24 def build Bob.logger.info "Building #{commit_id} of the #{buildable.scm} repo at #{buildable.uri}" in_background do scm.with_commit(commit_id) { buildable.start_building(commit_id, scm.info(commit_id)) build_status, build_output = run_build_script buildable.finish_building(commit_id, build_status, build_output) } end end |