Skip to content
This repository has been archived by the owner on Mar 18, 2018. It is now read-only.

Commit

Permalink
Merge pull request #42 from mkuster/issue41
Browse files Browse the repository at this point in the history
Execute setCurrentRevision() in workspace directory
  • Loading branch information
gregberge committed Apr 1, 2015
2 parents 13cd3e4 + 229b35a commit d4498b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tasks/deploy/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module.exports = function (gruntOrShipit) {
function setCurrentRevision() {
shipit.log('Setting current revision and creating revision file.');

return shipit.local('git rev-parse ' + shipit.config.branch).then(function(response) {
return shipit.local('git rev-parse ' + shipit.config.branch, {cwd: shipit.config.workspace}).then(function(response) {
shipit.currentRevision = response.stdout.trim();
return shipit.remote('echo "' + shipit.currentRevision + '" > ' + path.join(shipit.releasePath, 'REVISION'));
}).then(function() {
Expand Down
15 changes: 15 additions & 0 deletions test/unit/tasks/deploy/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ describe('deploy:update task', function () {
shipit.start('deploy:update', function (err) {
if (err) return done(err);
expect(shipit.previousRevision).to.equal(null);
expect(shipit.local).to.be.calledWith('git rev-parse ' + shipit.config.branch, {cwd: '/tmp/workspace'});
done();
});
});
Expand All @@ -101,6 +102,13 @@ describe('deploy:update task', function () {
beforeEach(function () {
sinon.stub(shipit, 'remote').resolves();
sinon.stub(shipit, 'remoteCopy').resolves();
sinon.stub(shipit, 'local', function (command) {
if (command === 'git rev-parse ' + shipit.config.branch) {
return Promise.resolve(
{stdout: '9d63d434a921f496c12854a53cef8d293e2b4756\n'}
);
}
});
});
afterEach(function () {
shipit.remote.restore();
Expand All @@ -121,6 +129,13 @@ describe('deploy:update task', function () {
beforeEach(function () {
sinon.stub(shipit, 'remote').resolves();
sinon.stub(shipit, 'remoteCopy').resolves();
sinon.stub(shipit, 'local', function (command) {
if (command === 'git rev-parse ' + shipit.config.branch) {
return Promise.resolve(
{stdout: '9d63d434a921f496c12854a53cef8d293e2b4756\n'}
);
}
});
});
afterEach(function () {
shipit.remote.restore();
Expand Down

0 comments on commit d4498b3

Please sign in to comment.