1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-03 04:47:07 +01:00

Deglitch.

This commit is contained in:
hacksalot
2016-02-02 19:02:56 -05:00
parent 89957aed76
commit 49ae016f08
9 changed files with 71 additions and 23 deletions

View File

@ -20,6 +20,8 @@ _ = require 'underscore'
OUTPUT = require './out'
PAD = require 'string-padding'
Command = require('commander').Command
M2C = require '../utils/md2chalk'
printf = require 'printf'
_opts = { }
_title = chalk.white.bold('\n*** HackMyResume v' +PKG.version+ ' ***')
_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: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.then executeSuccess, executeFail
# Resolved or rejected?
onFail = (err) ->
_exitCallback( if err.fluenterror then err.fluenterror else err )
return
prom.then (->), onFail
return
### 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

View File

@ -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**.

View File

@ -9,4 +9,4 @@ TemplateGenerator = require './template-generator'
module.exports = class WordGenerator extends TemplateGenerator
init: () -> super 'doc', 'xml'
constructor: () -> super 'doc', 'xml'

View File

@ -139,7 +139,7 @@ _build = ( src, dst, opts ) ->
_.each targets, (t) ->
return { } if @hasError() and opts.assert
t.final = _single.call @, t, theme, targets
if t.final.fluenterror
if t.final?.fluenterror
t.final.quit = opts.assert
@err t.final.fluenterror, t.final
return
@ -198,7 +198,7 @@ _single = ( targInfo, theme, finished ) ->
try
if !targInfo.fmt
return
return { }
fType = targInfo.fmt.outFormat
fName = PATH.basename f, '.' + fType
theFormat = null