-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
158 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var CoreObject = require('core-object'); | ||
var Promise = require('ember-cli/lib/ext/promise'); | ||
var gitRepoInfo = require('git-repo-info'); | ||
var simpleGit = require('simple-git'); | ||
|
||
module.exports = CoreObject.extend({ | ||
init: function(path) { | ||
this.path = path; | ||
}, | ||
|
||
generate: function() { | ||
var _this = this; | ||
return new Promise(function(resolve, reject) { | ||
simpleGit(_this.path).log(function(err, log) { | ||
var info = log.latest; | ||
resolve({ | ||
sha: info.hash.substring(1), | ||
email: info.author_email.substring(0, info.author_email.length - 1), | ||
name: info.author_name, | ||
timestamp: new Date(info.date).toISOString(), | ||
branch: gitRepoInfo().branch | ||
}); | ||
}); | ||
}); | ||
} | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
"git": require('./git'), | ||
}; |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
|
||
var assert = require('ember-cli/tests/helpers/assert'); | ||
var gitRepoInfo = require('git-repo-info'); | ||
var ScmDataGenerator = require('../../../../lib/scm-data-generators/git'); | ||
|
||
describe('the git scm data generator', function() { | ||
var cwd; | ||
|
||
before(function() { | ||
gitRepoInfo._changeGitDir('dotgit'); | ||
}); | ||
|
||
beforeEach(function() { | ||
cwd = process.cwd(); | ||
}); | ||
|
||
afterEach(function() { | ||
process.chdir(cwd); | ||
}); | ||
|
||
describe('#generate', function() { | ||
it('returns the correct data', function() { | ||
process.chdir('tests/fixtures/repo'); | ||
|
||
var subject = new ScmDataGenerator('dotgit'); | ||
|
||
return assert.isFulfilled(subject.generate()) | ||
.then(function(data) { | ||
assert.equal(data.sha, '41d41f081b45ad50935c08b1203220737d9739b4'); | ||
assert.equal(data.email, '[email protected]'); | ||
assert.equal(data.name, 'Alisdair McDiarmid'); | ||
assert.isNotNull(data.timestamp); | ||
assert.equal(data.branch, 'master'); | ||
}); | ||
}); | ||
}); | ||
}); |
Seems to be a problem here, instantiating ScmDataGenerator with
plugin: this
, which is treated in the constructor as thepath
. See #43 (comment)