mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 16:30:11 +00:00
Deglitch.
This commit is contained in:
parent
89957aed76
commit
49ae016f08
37
dist/cli/main.js
vendored
37
dist/cli/main.js
vendored
@ -6,7 +6,7 @@ Definition of the `main` function.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(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');
|
HMR = require('../index');
|
||||||
|
|
||||||
@ -36,6 +36,10 @@ Definition of the `main` function.
|
|||||||
|
|
||||||
Command = require('commander').Command;
|
Command = require('commander').Command;
|
||||||
|
|
||||||
|
M2C = require('../utils/md2chalk');
|
||||||
|
|
||||||
|
printf = require('printf');
|
||||||
|
|
||||||
_opts = {};
|
_opts = {};
|
||||||
|
|
||||||
_title = chalk.white.bold('\n*** HackMyResume v' + PKG.version + ' ***');
|
_title = chalk.white.bold('\n*** HackMyResume v' + PKG.version + ' ***');
|
||||||
@ -202,7 +206,7 @@ Definition of the `main` function.
|
|||||||
/* Invoke a HackMyResume verb. */
|
/* Invoke a HackMyResume verb. */
|
||||||
|
|
||||||
execute = function(src, dst, opts, log) {
|
execute = function(src, dst, opts, log) {
|
||||||
var onFail, prom, v;
|
var prom, v;
|
||||||
v = new HMR.verbs[this.name()]();
|
v = new HMR.verbs[this.name()]();
|
||||||
loadOptions.call(this, opts, this.parent.jsonArgs);
|
loadOptions.call(this, opts, this.parent.jsonArgs);
|
||||||
_opts.errHandler = v;
|
_opts.errHandler = v;
|
||||||
@ -214,10 +218,31 @@ Definition of the `main` function.
|
|||||||
return _err.err.apply(_err, arguments);
|
return _err.err.apply(_err, arguments);
|
||||||
});
|
});
|
||||||
prom = v.invoke.call(v, src, dst, _opts, log);
|
prom = v.invoke.call(v, src, dst, _opts, log);
|
||||||
onFail = function(err) {
|
prom.then(executeSuccess, executeFail);
|
||||||
_exitCallback(err.fluenterror ? err.fluenterror : err);
|
};
|
||||||
};
|
|
||||||
prom.then((function() {}), onFail);
|
|
||||||
|
/* 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.
|
msg: The '**%s**' parameter was needed but not supplied.
|
||||||
createError:
|
createError:
|
||||||
msg: Failed to create **'%s'**.
|
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);
|
extend(WordGenerator, superClass);
|
||||||
|
|
||||||
function WordGenerator() {
|
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;
|
return WordGenerator;
|
||||||
|
|
||||||
})(TemplateGenerator);
|
})(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);
|
_rezObj = new RTYPES[toFormat]().parseJSON(rez);
|
||||||
targets = _expand(dst, theme);
|
targets = _expand(dst, theme);
|
||||||
_.each(targets, function(t) {
|
_.each(targets, function(t) {
|
||||||
|
var ref;
|
||||||
if (this.hasError() && opts.assert) {
|
if (this.hasError() && opts.assert) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
t.final = _single.call(this, t, theme, targets);
|
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;
|
t.final.quit = opts.assert;
|
||||||
this.err(t.final.fluenterror, t.final);
|
this.err(t.final.fluenterror, t.final);
|
||||||
}
|
}
|
||||||
@ -258,7 +259,7 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
f = targInfo.file;
|
f = targInfo.file;
|
||||||
try {
|
try {
|
||||||
if (!targInfo.fmt) {
|
if (!targInfo.fmt) {
|
||||||
return;
|
return {};
|
||||||
}
|
}
|
||||||
fType = targInfo.fmt.outFormat;
|
fType = targInfo.fmt.outFormat;
|
||||||
fName = PATH.basename(f, '.' + fType);
|
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
|
@class Verb
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -92,6 +94,9 @@ Definition of the Verb class.
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** Has an error occurred during this verb invocation? */
|
||||||
|
|
||||||
Verb.prototype.hasError = function() {
|
Verb.prototype.hasError = function() {
|
||||||
return this.errorCode || this.errorObj;
|
return this.errorCode || this.errorObj;
|
||||||
};
|
};
|
||||||
|
@ -20,6 +20,8 @@ _ = require 'underscore'
|
|||||||
OUTPUT = require './out'
|
OUTPUT = require './out'
|
||||||
PAD = require 'string-padding'
|
PAD = require 'string-padding'
|
||||||
Command = require('commander').Command
|
Command = require('commander').Command
|
||||||
|
M2C = require '../utils/md2chalk'
|
||||||
|
printf = require 'printf'
|
||||||
_opts = { }
|
_opts = { }
|
||||||
_title = chalk.white.bold('\n*** HackMyResume v' +PKG.version+ ' ***')
|
_title = chalk.white.bold('\n*** HackMyResume v' +PKG.version+ ' ***')
|
||||||
_out = new OUTPUT( _opts )
|
_out = new OUTPUT( _opts )
|
||||||
@ -251,14 +253,29 @@ execute = ( src, dst, opts, log ) ->
|
|||||||
v.on 'hmr:status', -> _out.do.apply _out, arguments
|
v.on 'hmr:status', -> _out.do.apply _out, arguments
|
||||||
v.on 'hmr:error', -> _err.err.apply _err, arguments
|
v.on 'hmr:error', -> _err.err.apply _err, arguments
|
||||||
|
|
||||||
# Invoke the verb! Returns a promise
|
# Invoke the verb using promise syntax
|
||||||
prom = v.invoke.call v, src, dst, _opts, log
|
prom = v.invoke.call v, src, dst, _opts, log
|
||||||
|
prom.then executeSuccess, executeFail
|
||||||
|
|
||||||
# Resolved or rejected?
|
return
|
||||||
onFail = (err) ->
|
|
||||||
_exitCallback( if err.fluenterror then err.fluenterror else err )
|
|
||||||
return
|
|
||||||
prom.then (->), onFail
|
### Success handler for verb invocations. Calls process.exit by default ###
|
||||||
|
executeSuccess = (obj) -> _exitCallback 0; return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Failure handler for verb invocations. Calls process.exit by default ###
|
||||||
|
executeFail = (err) ->
|
||||||
|
finalErrorCode = -1
|
||||||
|
if err
|
||||||
|
finalErrorCode = if err.fluenterror then err.fluenterror else err
|
||||||
|
console.log err.stack
|
||||||
|
if _opts.debug
|
||||||
|
msgs = require('./msg').errors;
|
||||||
|
logMsg printf M2C( msgs.exiting.msg, 'cyan' ), finalErrorCode
|
||||||
|
_exitCallback finalErrorCode
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,3 +100,5 @@ errors:
|
|||||||
msg: The '**%s**' parameter was needed but not supplied.
|
msg: The '**%s**' parameter was needed but not supplied.
|
||||||
createError:
|
createError:
|
||||||
msg: Failed to create **'%s'**.
|
msg: Failed to create **'%s'**.
|
||||||
|
exiting:
|
||||||
|
msg: Exiting with status code **%s**.
|
||||||
|
@ -9,4 +9,4 @@ TemplateGenerator = require './template-generator'
|
|||||||
|
|
||||||
module.exports = class WordGenerator extends TemplateGenerator
|
module.exports = class WordGenerator extends TemplateGenerator
|
||||||
|
|
||||||
init: () -> super 'doc', 'xml'
|
constructor: () -> super 'doc', 'xml'
|
||||||
|
@ -139,7 +139,7 @@ _build = ( src, dst, opts ) ->
|
|||||||
_.each targets, (t) ->
|
_.each targets, (t) ->
|
||||||
return { } if @hasError() and opts.assert
|
return { } if @hasError() and opts.assert
|
||||||
t.final = _single.call @, t, theme, targets
|
t.final = _single.call @, t, theme, targets
|
||||||
if t.final.fluenterror
|
if t.final?.fluenterror
|
||||||
t.final.quit = opts.assert
|
t.final.quit = opts.assert
|
||||||
@err t.final.fluenterror, t.final
|
@err t.final.fluenterror, t.final
|
||||||
return
|
return
|
||||||
@ -198,7 +198,7 @@ _single = ( targInfo, theme, finished ) ->
|
|||||||
try
|
try
|
||||||
|
|
||||||
if !targInfo.fmt
|
if !targInfo.fmt
|
||||||
return
|
return { }
|
||||||
fType = targInfo.fmt.outFormat
|
fType = targInfo.fmt.outFormat
|
||||||
fName = PATH.basename f, '.' + fType
|
fName = PATH.basename f, '.' + fType
|
||||||
theFormat = null
|
theFormat = null
|
||||||
|
Loading…
Reference in New Issue
Block a user