Skip to content

Commit

Permalink
Bug #1, semistandard Javascript fix - Travis-CI [iet:10116746]
Browse files Browse the repository at this point in the history
  • Loading branch information
nfreear committed Sep 28, 2017
1 parent 1d2785e commit 647bcea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
27 changes: 14 additions & 13 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
E-Access Bulletin task-runner | © 2016 Nick Freear.
*/

var COUNT_CMD = 'find eab/issues/ -type f | grep ".txt" | wc -l';
var COUNT_CMD = require('./package.json').scripts.count;
// var COUNT_CMD = 'find eab/issues/ -type f | grep ".txt" | wc -l';
var exec = require('child_process').execSync;
// var exec = require('child_process').exec;

module.exports = function (grunt) {
'use strict';
Expand All @@ -14,15 +14,17 @@ module.exports = function (grunt) {

var bulletinCount = (exec(COUNT_CMD) + '').replace(/\s+/g, '');

// grunt.config.set('bulletinCount', bulletinCount);

grunt.log.oklns('Bulletin count:', bulletinCount);
// bulletinCount(bcount);

grunt.initConfig({
bulletinCount: bulletinCount,
exec: {
// count: COUNT_CMD,
// build: 'perl perl/bulletins.pl && perl perl/e-access.pl',
bulletins: 'perl perl/bulletins.pl',
build_site: 'perl perl/e-access.pl'
build_site: 'perl perl/e-access.pl',
semistandard: 'node_modules/.bin/semistandard'
},
jshint: {
options: {
Expand Down Expand Up @@ -70,7 +72,7 @@ module.exports = function (grunt) {
options: {
replacements: [{
pattern: /class="COUNT">(\d+)<\//ig,
replacement: 'class="COUNT">' + bulletinCount + '</'
replacement: 'class="COUNT"><%= bulletinCount %></'
}]
}
},
Expand All @@ -79,7 +81,7 @@ module.exports = function (grunt) {
options: {
replacements: [{
pattern: /"x-bulletin-count": ?(\d+)/,
replacement: '"x-bulletin-count": ' + bulletinCount
replacement: '"x-bulletin-count": <%= bulletinCount %>'
}]
}
}
Expand Down Expand Up @@ -107,23 +109,22 @@ module.exports = function (grunt) {
// grunt.loadNpmTasks('grunt-notify');
// grunt.task.run('notify_hooks');


grunt.registerTask('default', [ 'exec', 'jshint', 'htmlhint', 'validate_xml', 'string-replace' ]);
};

/*
function bulletinCount (bcount) {
//var bcount = 999; // 204!
const exec = require('child_process').exec;
var bcount = 0;
function bulletinCount (bcount) {
exec(COUNT_CMD, function (err, stdout, stderr) {
if (err) {
console.error(err);
return;
}
bcount = stdout;
bcount = stdout; // 204!
console.log('Bulletin count: ', stdout);
});
}
*/
} */
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"build": "perl perl/bulletins.pl && perl perl/e-access.pl",
"sfix": "semistandard --fix",
"count": "find eab/issues/ -type f | grep '.txt' | wc -l",
"test": "grunt && semistandard"
"test": "grunt"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 647bcea

Please sign in to comment.