mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-02 20:37:08 +01:00
Deglitch.
This commit is contained in:
37
dist/cli/main.js
vendored
37
dist/cli/main.js
vendored
@ -6,7 +6,7 @@ Definition of the `main` function.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var Command, EXTEND, FS, HME, HMR, HMSTATUS, OUTPUT, PAD, PATH, PKG, StringUtils, _, _err, _exitCallback, _opts, _out, _title, chalk, execute, initOptions, initialize, loadOptions, logMsg, main, safeLoadJSON, splitSrcDest;
|
||||
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;
|
||||
|
||||
HMR = require('../index');
|
||||
|
||||
@ -36,6 +36,10 @@ Definition of the `main` function.
|
||||
|
||||
Command = require('commander').Command;
|
||||
|
||||
M2C = require('../utils/md2chalk');
|
||||
|
||||
printf = require('printf');
|
||||
|
||||
_opts = {};
|
||||
|
||||
_title = chalk.white.bold('\n*** HackMyResume v' + PKG.version + ' ***');
|
||||
@ -202,7 +206,7 @@ Definition of the `main` function.
|
||||
/* Invoke a HackMyResume verb. */
|
||||
|
||||
execute = function(src, dst, opts, log) {
|
||||
var onFail, prom, v;
|
||||
var prom, v;
|
||||
v = new HMR.verbs[this.name()]();
|
||||
loadOptions.call(this, opts, this.parent.jsonArgs);
|
||||
_opts.errHandler = v;
|
||||
@ -214,10 +218,31 @@ Definition of the `main` function.
|
||||
return _err.err.apply(_err, arguments);
|
||||
});
|
||||
prom = v.invoke.call(v, src, dst, _opts, log);
|
||||
onFail = function(err) {
|
||||
_exitCallback(err.fluenterror ? err.fluenterror : err);
|
||||
};
|
||||
prom.then((function() {}), onFail);
|
||||
prom.then(executeSuccess, executeFail);
|
||||
};
|
||||
|
||||
|
||||
/* Success handler for verb invocations. Calls process.exit by default */
|
||||
|
||||
executeSuccess = function(obj) {
|
||||
_exitCallback(0);
|
||||
};
|
||||
|
||||
|
||||
/* Failure handler for verb invocations. Calls process.exit by default */
|
||||
|
||||
executeFail = function(err) {
|
||||
var finalErrorCode, msgs;
|
||||
finalErrorCode = -1;
|
||||
if (err) {
|
||||
finalErrorCode = err.fluenterror ? err.fluenterror : err;
|
||||
console.log(err.stack);
|
||||
}
|
||||
if (_opts.debug) {
|
||||
msgs = require('./msg').errors;
|
||||
logMsg(printf(M2C(msgs.exiting.msg, 'cyan'), finalErrorCode));
|
||||
}
|
||||
_exitCallback(finalErrorCode);
|
||||
};
|
||||
|
||||
|
||||
|
2
dist/cli/msg.yml
vendored
2
dist/cli/msg.yml
vendored
@ -100,3 +100,5 @@ errors:
|
||||
msg: The '**%s**' parameter was needed but not supplied.
|
||||
createError:
|
||||
msg: Failed to create **'%s'**.
|
||||
exiting:
|
||||
msg: Exiting with status code **%s**.
|
||||
|
6
dist/generators/word-generator.js
vendored
6
dist/generators/word-generator.js
vendored
@ -16,13 +16,9 @@ Definition of the WordGenerator class.
|
||||
extend(WordGenerator, superClass);
|
||||
|
||||
function WordGenerator() {
|
||||
return WordGenerator.__super__.constructor.apply(this, arguments);
|
||||
WordGenerator.__super__.constructor.call(this, 'doc', 'xml');
|
||||
}
|
||||
|
||||
WordGenerator.prototype.init = function() {
|
||||
return WordGenerator.__super__.init.call(this, 'doc', 'xml');
|
||||
};
|
||||
|
||||
return WordGenerator;
|
||||
|
||||
})(TemplateGenerator);
|
||||
|
5
dist/verbs/build.js
vendored
5
dist/verbs/build.js
vendored
@ -201,11 +201,12 @@ Implementation of the 'build' verb for HackMyResume.
|
||||
_rezObj = new RTYPES[toFormat]().parseJSON(rez);
|
||||
targets = _expand(dst, theme);
|
||||
_.each(targets, function(t) {
|
||||
var ref;
|
||||
if (this.hasError() && opts.assert) {
|
||||
return {};
|
||||
}
|
||||
t.final = _single.call(this, t, theme, targets);
|
||||
if (t.final.fluenterror) {
|
||||
if ((ref = t.final) != null ? ref.fluenterror : void 0) {
|
||||
t.final.quit = opts.assert;
|
||||
this.err(t.final.fluenterror, t.final);
|
||||
}
|
||||
@ -258,7 +259,7 @@ Implementation of the 'build' verb for HackMyResume.
|
||||
f = targInfo.file;
|
||||
try {
|
||||
if (!targInfo.fmt) {
|
||||
return;
|
||||
return {};
|
||||
}
|
||||
fType = targInfo.fmt.outFormat;
|
||||
fName = PATH.basename(f, '.' + fType);
|
||||
|
7
dist/verbs/verb.js
vendored
7
dist/verbs/verb.js
vendored
@ -16,7 +16,9 @@ Definition of the Verb class.
|
||||
|
||||
|
||||
/**
|
||||
An instantiation of a HackMyResume command.
|
||||
An abstract invokable verb.
|
||||
Provides base class functionality for verbs. Provide common services such as
|
||||
error handling, event management, and promise support.
|
||||
@class Verb
|
||||
*/
|
||||
|
||||
@ -92,6 +94,9 @@ Definition of the Verb class.
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/** Has an error occurred during this verb invocation? */
|
||||
|
||||
Verb.prototype.hasError = function() {
|
||||
return this.errorCode || this.errorObj;
|
||||
};
|
||||
|
Reference in New Issue
Block a user