Merge pull request #128 from hpinkos/master

Add cloc
This commit is contained in:
Sean Lilley 2018-01-30 11:27:22 -05:00 committed by GitHub
commit bbdecdece2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 1 deletions

View File

@ -1,6 +1,7 @@
'use strict';
var Cesium = require('cesium');
var Promise = require('bluebird');
var child_process = require('child_process');
var fsExtra = require('fs-extra');
var gulp = require('gulp');
@ -60,3 +61,42 @@ gulp.task('coverage', function () {
});
open('coverage/lcov-report/index.html');
});
gulp.task('cloc', function() {
var cmdLine;
var clocPath = path.join('node_modules', 'cloc', 'lib', 'cloc');
//Run cloc on primary Source files only
var source = new Promise(function(resolve, reject) {
cmdLine = 'perl ' + clocPath + ' --quiet --progress-rate=0' +
' lib/ bin/';
child_process.exec(cmdLine, function(error, stdout, stderr) {
if (error) {
console.log(stderr);
return reject(error);
}
console.log('Source:');
console.log(stdout);
resolve();
});
});
//If running cloc on source succeeded, also run it on the tests.
return source.then(function() {
return new Promise(function(resolve, reject) {
cmdLine = 'perl ' + clocPath + ' --quiet --progress-rate=0' +
' specs/lib/';
child_process.exec(cmdLine, function(error, stdout, stderr) {
if (error) {
console.log(stderr);
return reject(error);
}
console.log('Specs:');
console.log(stdout);
resolve();
});
});
});
});

View File

@ -35,6 +35,7 @@
"yargs": "^10.0.3"
},
"devDependencies": {
"cloc": "^2.3.3",
"coveralls": "^3.0.0",
"eslint": "^4.4.1",
"eslint-config-cesium": "^2.0.1",
@ -52,7 +53,8 @@
"test": "gulp test",
"test-watch": "gulp test-watch",
"coverage": "gulp coverage",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"
"coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls",
"cloc": "gulp cloc"
},
"bin": {
"obj2gltf": "./bin/obj2gltf.js"