diff --git a/Gruntfile.js b/Gruntfile.js index 8506b81..35265cb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -59,14 +59,14 @@ module.exports = function (grunt) { // Use 'grunt test' for local testing grunt.registerTask('test', 'Test the HackMyResume application.', - function( config ) { + function() { grunt.task.run(['clean:test','build','eslint','simplemocha:all']); } ); // Use 'grunt build' to build HMR grunt.registerTask('build', 'Build the HackMyResume application.', - function( config ) { + function() { grunt.task.run( ['clean:dist','copy','coffee','eslint'] ); } ); diff --git a/dist/cli/error.js b/dist/cli/error.js index 4a00503..f87ce4d 100644 --- a/dist/cli/error.js +++ b/dist/cli/error.js @@ -4,18 +4,12 @@ @module cli/error @license MIT. See LICENSE.md for details. */ - /** Error handler for HackMyResume. All errors are handled here. - @class ErrorHandler */ - var ErrorHandler, FCMD, FS, HMSTATUS, M2C, PATH, PKG, SyntaxErrorEx, WRAP, YAML, _defaultLog, assembleError, chalk, extend, printf; + var FS, HMSTATUS, M2C, PATH, SyntaxErrorEx, WRAP, _defaultLog, assembleError, chalk, extend, printf; HMSTATUS = require('../core/status-codes'); - PKG = require('../../package.json'); - FS = require('fs'); - FCMD = require('../index'); - PATH = require('path'); WRAP = require('word-wrap'); @@ -26,15 +20,15 @@ extend = require('extend'); - YAML = require('yamljs'); - printf = require('printf'); SyntaxErrorEx = require('../utils/syntax-error-ex'); require('string.prototype.startswith'); - ErrorHandler = module.exports = { + /** Error handler for HackMyResume. All errors are handled here. + @class ErrorHandler */ + module.exports = { init: function(debug, assert, silent) { this.debug = debug; this.assert = assert; @@ -94,7 +88,7 @@ }; _defaultLog = function() { - return console.log.apply(console.log, arguments); + return console.log.apply(console.log, arguments); // eslint-disable-line no-console }; assembleError = function(ex) { @@ -185,6 +179,7 @@ break; case HMSTATUS.readError: if (!ex.quiet) { + // eslint-disable-next-line no-console console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file)); } msg = ex.inner.toString(); @@ -215,6 +210,7 @@ break; case HMSTATUS.parseError: if (SyntaxErrorEx.is(ex.inner)) { + // eslint-disable-next-line no-console console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file)); se = new SyntaxErrorEx(ex, ex.raw); if ((se.line != null) && (se.col != null)) { @@ -243,6 +239,7 @@ case HMSTATUS.invalidOptionsFile: msg = M2C(this.msgs.invalidOptionsFile.msg[0]); if (SyntaxErrorEx.is(ex.inner)) { + // eslint-disable-next-line no-console console.error(printf(M2C(this.msgs.readError.msg, 'red'), ex.file)); se = new SyntaxErrorEx(ex, ex.raw); if ((se.line != null) && (se.col != null)) { diff --git a/dist/cli/main.js b/dist/cli/main.js index 0408292..677f37b 100644 --- a/dist/cli/main.js +++ b/dist/cli/main.js @@ -15,15 +15,8 @@ - Need to accept JSON inputs from the command line. */ /* Simple logging placeholder. */ - /* - A callable implementation of the HackMyResume CLI. Encapsulates the command - line interface as a single method accepting a parameter array. - @alias module:cli/main.main - @param rawArgs {Array} An array of command-line parameters. Will either be - process.argv (in production) or custom parameters (in test). - */ /* Split multiple command-line filenames by the 'TO' keyword */ - var Command, EXTEND, FS, HME, HMR, HMSTATUS, M2C, OUTPUT, PAD, PATH, PKG, StringUtils, _, _err, _exitCallback, _opts, _out, _title, chalk, execute, executeFail, executeSuccess, initOptions, initialize, loadOptions, logMsg, main, printf, safeLoadJSON, splitSrcDest; + var Command, EXTEND, FS, HMR, HMSTATUS, M2C, OUTPUT, PAD, PATH, PKG, _, _err, _exitCallback, _opts, _out, _title, chalk, execute, executeFail, executeSuccess, initOptions, initialize, loadOptions, logMsg, printf, safeLoadJSON, splitSrcDest; HMR = require('../index'); @@ -39,12 +32,9 @@ HMSTATUS = require('../core/status-codes'); - HME = require('../core/event-codes'); - safeLoadJSON = require('../utils/safe-json-loader'); - StringUtils = require('../utils/string.js'); - + //StringUtils = require '../utils/string.js' _ = require('underscore'); OUTPUT = require('./out'); @@ -67,7 +57,14 @@ _exitCallback = null; - main = module.exports = function(rawArgs, exitCallback) { + /* + A callable implementation of the HackMyResume CLI. Encapsulates the command + line interface as a single method accepting a parameter array. + @alias module:cli/main.main + @param rawArgs {Array} An array of command-line parameters. Will either be + process.argv (in production) or custom parameters (in test). + */ + module.exports = function(rawArgs, exitCallback) { var args, initInfo, program; initInfo = initialize(rawArgs, exitCallback); if (initInfo === null) { @@ -96,13 +93,15 @@ execute.call(this, sources, [], this.opts(), logMsg); }); // Create the PEEK command - program.command('peek').arguments('').description('Peek at a resume field or section').action(function(sources, sectionOrField) { + //.action(( sources, sectionOrField ) -> + program.command('peek').arguments('').description('Peek at a resume field or section').action(function(sources) { var dst; dst = (sources && sources.length > 1) ? [sources.pop()] : []; execute.call(this, sources, dst, this.opts(), logMsg); }); // Create the BUILD command - program.command('build').alias('generate').option('-t --theme ', 'Theme name or path').option('-n --no-prettify', 'Disable HTML prettification', true).option('-c --css