1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-07-02 16:30:04 +01:00
This commit is contained in:
hacksalot 2016-01-20 21:43:11 -05:00
parent f77cced7f3
commit 984ae95576
4 changed files with 17 additions and 21 deletions

View File

@ -87,8 +87,6 @@ Output routines for HackMyResume.
break; break;
case HME.afterTheme: case HME.afterTheme:
this.theme = evt.theme;
// this.opts.debug && L( M2C(this.msgs.beforeTheme.msg, 'green'), evt.theme );
break; break;
case HME.beforeMerge: case HME.beforeMerge:
@ -107,9 +105,10 @@ Output routines for HackMyResume.
break; break;
case HME.applyTheme: case HME.applyTheme:
var numFormats = Object.keys( this.theme.formats ).length; this.theme = evt.theme;
var numFormats = Object.keys( evt.theme.formats ).length;
L( M2C(this.msgs.applyTheme.msg, 'green'), L( M2C(this.msgs.applyTheme.msg, 'green'),
this.theme.name.toUpperCase(), evt.theme.name.toUpperCase(),
numFormats, ( numFormats === 1 ? '' : 's') ); numFormats, ( numFormats === 1 ? '' : 's') );
break; break;

View File

@ -36,7 +36,9 @@ Event code definitions.
beforePeek: 20, beforePeek: 20,
afterPeek: 21, afterPeek: 21,
beforeInlineConvert: 22, beforeInlineConvert: 22,
afterInlineConvert: 23 afterInlineConvert: 23,
beforeValidate: 24,
afterValidate: 25
}; };

View File

@ -117,7 +117,7 @@ Implementation of the 'build' verb for HackMyResume.
// Add freebie formats to the theme // Add freebie formats to the theme
addFreebieFormats( theme ); addFreebieFormats( theme );
this.stat( HMEVENT.applyTheme, { r: rez }); this.stat( HMEVENT.applyTheme, { r: rez, theme: theme });
// Load the resume into a FRESHResume or JRSResume object // Load the resume into a FRESHResume or JRSResume object
_rezObj = new (RTYPES[ toFormat ])().parseJSON( rez ); _rezObj = new (RTYPES[ toFormat ])().parseJSON( rez );
@ -161,12 +161,6 @@ Implementation of the 'build' verb for HackMyResume.
function handleInternalError( ex ) {
console.log(ex);
}
/** /**
Generate a single target resume such as "out/rez.html" or "out/rez.doc". Generate a single target resume such as "out/rez.html" or "out/rez.doc".
TODO: Refactor. TODO: Refactor.

View File

@ -4,8 +4,12 @@ Implementation of the 'validate' verb for HackMyResume.
@license MIT. See LICENSE.md for details. @license MIT. See LICENSE.md for details.
*/ */
(function() { (function() {
var FS = require('fs'); var FS = require('fs');
var ResumeFactory = require('../core/resume-factory'); var ResumeFactory = require('../core/resume-factory');
var SyntaxErrorEx = require('../utils/syntax-error-ex'); var SyntaxErrorEx = require('../utils/syntax-error-ex');
@ -17,6 +21,7 @@ Implementation of the 'validate' verb for HackMyResume.
/** An invokable resume validation command. */
var ValidateVerb = module.exports = Verb.extend({ var ValidateVerb = module.exports = Verb.extend({
init: function() { init: function() {
@ -33,16 +38,12 @@ Implementation of the 'validate' verb for HackMyResume.
/** /** Validate 1 to N resumes in FRESH or JSON Resume format. */
Validate 1 to N resumes in either FRESH or JSON Resume format.
*/
function validate( sources, unused, opts ) { function validate( sources, unused, opts ) {
if( !sources || !sources.length ) if( !sources || !sources.length )
throw { fluenterror: HMSTATUS.resumeNotFoundAlt, quit: true }; throw { fluenterror: HMSTATUS.resumeNotFoundAlt, quit: true };
var isValid = true;
var validator = require('is-my-json-valid'); var validator = require('is-my-json-valid');
var schemas = { var schemas = {
fresh: require('fresca'), fresh: require('fresca'),
@ -82,14 +83,14 @@ Implementation of the 'validate' verb for HackMyResume.
} }
} }
catch(exc) { catch( exc ) {
return ret; return ret;
} }
this.stat(HMEVENT.afterValidate, { file: src.file, isValid: isValid, this.stat( HMEVENT.afterValidate, { file: src.file, isValid: ret.isValid,
fmt: fmt.replace('jars', 'JSON Resume'), errors: errors }); fmt: fmt.replace( 'jars', 'JSON Resume' ), errors: errors });
if( opts.assert && !isValid ) { if( opts.assert && !ret.isValid ) {
throw { fluenterror: HMSTATUS.invalid, shouldExit: true }; throw { fluenterror: HMSTATUS.invalid, shouldExit: true };
} }