Skip to content

Commit

Permalink
allow to give a specific revision to builder#build
Browse files Browse the repository at this point in the history
  • Loading branch information
sr committed Jul 20, 2008
1 parent 1a194d1 commit b81b654
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/integrity/builder.rb
Expand Up @@ -11,8 +11,12 @@ def initialize(project)
@build = Build.new(:project => project)
end

def build
@scm.with_latest_code { run_build_script }
def build(commit=nil)
if commit
@scm.with_revision(commit) { run_build_script }
else
@scm.with_latest_code { run_build_script }
end
@build
ensure
@build.commit = @scm.head
Expand Down
8 changes: 8 additions & 0 deletions spec/builder_spec.rb
Expand Up @@ -67,6 +67,14 @@ def mock_scm(messages={})
end
@builder.build
end

it 'should checkout the given commit from the scm and run the build script' do
mock_scm.should_receive(:with_revision).
with('6437fa27779daba40dbd130e2937d36253be1d4c').and_yield do
@builder.should_receive(:run_build_script)
end
@builder.build('6437fa27779daba40dbd130e2937d36253be1d4c')
end

it "should assign the head of the SCM as the commit in the build" do
mock_build.should_receive(:commit=).with mock_scm.head
Expand Down

0 comments on commit b81b654

Please sign in to comment.