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.
-
#commit_id ⇒ Object
readonly
Returns the value of attribute commit_id.
Instance Method Summary collapse
-
#build ⇒ Object
This is where the magic happens:.
-
#initialize(buildable, commit_id) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(buildable, commit_id) ⇒ Builder
Returns a new instance of Builder.
7 8 9 10 |
# File 'lib/bob/builder.rb', line 7 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 |
#commit_id ⇒ Object (readonly)
Returns the value of attribute commit_id.
5 6 7 |
# File 'lib/bob/builder.rb', line 5 def commit_id @commit_id 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.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bob/builder.rb', line 18 def build Bob.logger.info "Building #{commit_id} of the #{buildable.kind} repo at #{buildable.uri}" in_background do scm.with_commit(commit_id) do 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 end |