mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-03 04:47:07 +01:00
Deglitch.
This commit is contained in:
@ -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
|
||||
|
||||
|
||||
|
@ -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**.
|
||||
|
@ -9,4 +9,4 @@ TemplateGenerator = require './template-generator'
|
||||
|
||||
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) ->
|
||||
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
|
||||
|
Reference in New Issue
Block a user