Created
April 12, 2009 19:35
-
-
Save foca/94122 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/bob/builder.rb b/lib/bob/builder.rb | |
| index a316799..b5c2ea3 100644 | |
| --- a/lib/bob/builder.rb | |
| +++ b/lib/bob/builder.rb | |
| @@ -5,6 +5,7 @@ module Bob | |
| def initialize(buildable, commit_id) | |
| @buildable = buildable | |
| @commit_id = commit_id | |
| + @build_status = nil | |
| @build_output = nil | |
| end | |
| @@ -18,7 +19,8 @@ module Bob | |
| in_background do | |
| scm.with_commit(commit_id) do | |
| buildable.start_building(commit_id, scm.info(commit_id)) | |
| - report_build run_build_script | |
| + run_build_script | |
| + report_build | |
| end | |
| end | |
| end | |
| @@ -31,6 +33,11 @@ module Bob | |
| @scm ||= SCM.new(buildable.repo_kind, buildable.repo_uri, buildable.repo_branch) | |
| end | |
| + def build_status | |
| + raise RuntimeError, "the build hasn't finished yet" if @build_status.nil? | |
| + @build_status | |
| + end | |
| + | |
| def run_build_script | |
| Bob.logger.debug "Running the build script for #{buildable.repo_uri}" | |
| @@ -39,11 +46,12 @@ module Bob | |
| end | |
| Bob.logger.debug("Ran command '(cd #{scm.working_dir} && #{buildable.build_script} 2>&1)' and got:\n#{build_output}") | |
| - $?.success? | |
| + | |
| + @build_status = $?.success? | |
| end | |
| - def report_build(status) | |
| - if status | |
| + def report_build | |
| + if build_status | |
| buildable.add_successful_build(commit_id, build_output) | |
| else | |
| buildable.add_failed_build(commit_id, build_output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment