Comparing version 2.2.0 to 2.3.0
22
index.js
module.exports = gitlog | ||
var exec = require('child_process').exec | ||
, execSync = require('child_process').execSync | ||
, debug = require('debug')('gitlog') | ||
@@ -41,3 +42,2 @@ , extend = require('lodash.assign') | ||
if (!options.repo) throw new Error('Repo required!') | ||
if (!cb) throw new Error('Callback required!') | ||
@@ -98,2 +98,22 @@ var defaultOptions = | ||
debug('command', options.execOptions, command) | ||
if (!cb) { | ||
// run Sync | ||
var stdout = execSync(command, options.execOptions).toString() | ||
, commits = stdout.split('\n@begin@') | ||
if (commits.length === 1 && commits[0] === '' ){ | ||
commits.shift() | ||
} | ||
debug('commits',commits) | ||
commits = parseCommits(commits, options.fields,options.nameStatus) | ||
process.chdir(prevWorkingDir) | ||
return commits | ||
} | ||
exec(command, options.execOptions, function(err, stdout, stderr) { | ||
@@ -100,0 +120,0 @@ debug('stdout',stdout) |
{ | ||
"name": "gitlog", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Git log parser for Node.JS", | ||
@@ -9,5 +9,4 @@ "main": "index.js", | ||
"checkStyle": "jscs .", | ||
"pretest": "npm run-script lint && npm run-script checkStyle", | ||
"test": "istanbul cover ./node_modules/.bin/_mocha -- -r should", | ||
"posttest": "istanbul check-coverage --statements 95 --branches 91 --functions 100 --lines 95 && rm -rf coverage" | ||
"posttest": "istanbul check-coverage --statements 95 --branches 90 --functions 100 --lines 95 && rm -rf coverage" | ||
}, | ||
@@ -14,0 +13,0 @@ "publishConfig": { |
@@ -37,8 +37,2 @@ var gitlog = require('../') | ||
it('throws an error when cb is not provided', function() { | ||
(function() { | ||
gitlog({ repo: 'test-repo' }) | ||
}).should.throw('Callback required!') | ||
}) | ||
it('throws an error when repo location does not exist', function() { | ||
@@ -60,3 +54,2 @@ (function() { | ||
commits.length.should.equal(20) | ||
done() | ||
@@ -236,2 +229,7 @@ }) | ||
it('returns synchronously if no callback is provided', function () { | ||
var commits = gitlog({ repo: testRepoLocation }) | ||
commits.length.should.equal(10) | ||
}) | ||
after(function(done) { | ||
@@ -238,0 +236,0 @@ execInTestDir(__dirname + '/delete-repo.sh', function() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34815
17
366
3