mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-05 09:56:22 +00:00
Capture.
This commit is contained in:
parent
c9e45d4991
commit
712cba57b8
@ -10,7 +10,7 @@ Error-handling routines for HackMyResume.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
var HACKMYSTATUS = require('../core/status-codes')
|
var HMSTATUS = require('../core/status-codes')
|
||||||
, PKG = require('../../package.json')
|
, PKG = require('../../package.json')
|
||||||
, FS = require('fs')
|
, FS = require('fs')
|
||||||
, FCMD = require('../hackmyapi')
|
, FCMD = require('../hackmyapi')
|
||||||
@ -31,15 +31,18 @@ Error-handling routines for HackMyResume.
|
|||||||
*/
|
*/
|
||||||
var ErrorHandler = module.exports = {
|
var ErrorHandler = module.exports = {
|
||||||
|
|
||||||
init: function( debug, assert ) {
|
init: function( debug, assert, silent ) {
|
||||||
this.debug = debug;
|
this.debug = debug;
|
||||||
this.assert = assert;
|
this.assert = assert;
|
||||||
|
this.silent = silent;
|
||||||
this.msgs = require('./msg.js').errors;
|
this.msgs = require('./msg.js').errors;
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
err: function( ex, shouldExit ) {
|
err: function( ex, shouldExit ) {
|
||||||
|
|
||||||
|
var o = this.silent ? function() { } : _defaultLog;
|
||||||
|
|
||||||
if( !this.msgs ) {
|
if( !this.msgs ) {
|
||||||
this.msgs = require('./msg.js').errors;
|
this.msgs = require('./msg.js').errors;
|
||||||
}
|
}
|
||||||
@ -91,9 +94,9 @@ Error-handling routines for HackMyResume.
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var o = function() {
|
function _defaultLog() {
|
||||||
console.log.apply( console.log, arguments );
|
console.log.apply( console.log, arguments );
|
||||||
};
|
}
|
||||||
|
|
||||||
function assembleError( ex ) {
|
function assembleError( ex ) {
|
||||||
|
|
||||||
@ -101,20 +104,20 @@ Error-handling routines for HackMyResume.
|
|||||||
|
|
||||||
switch( ex.fluenterror ) {
|
switch( ex.fluenterror ) {
|
||||||
|
|
||||||
case HACKMYSTATUS.themeNotFound:
|
case HMSTATUS.themeNotFound:
|
||||||
msg = printf( M2C( this.msgs.themeNotFound.msg, 'yellow' ), ex.data);
|
msg = printf( M2C( this.msgs.themeNotFound.msg, 'yellow' ), ex.data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.copyCSS:
|
case HMSTATUS.copyCSS:
|
||||||
msg = M2C( this.msgs.copyCSS.msg, 'red' );
|
msg = M2C( this.msgs.copyCSS.msg, 'red' );
|
||||||
quit = false;
|
quit = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.resumeNotFound:
|
case HMSTATUS.resumeNotFound:
|
||||||
msg = M2C( this.msgs.resumeNotFound.msg, 'yellow' );
|
msg = M2C( this.msgs.resumeNotFound.msg, 'yellow' );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.missingCommand:
|
case HMSTATUS.missingCommand:
|
||||||
msg = M2C( this.msgs.missingCommand.msg + " (", 'yellow');
|
msg = M2C( this.msgs.missingCommand.msg + " (", 'yellow');
|
||||||
msg += Object.keys( FCMD.verbs ).map( function(v, idx, ar) {
|
msg += Object.keys( FCMD.verbs ).map( function(v, idx, ar) {
|
||||||
return (idx === ar.length - 1 ? chalk.yellow('or ') : '') +
|
return (idx === ar.length - 1 ? chalk.yellow('or ') : '') +
|
||||||
@ -125,53 +128,53 @@ Error-handling routines for HackMyResume.
|
|||||||
PATH.resolve(__dirname, '../cli/use.txt'), 'utf8' ));
|
PATH.resolve(__dirname, '../cli/use.txt'), 'utf8' ));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.invalidCommand:
|
case HMSTATUS.invalidCommand:
|
||||||
msg = printf( M2C( this.msgs.invalidCommand.msg, 'yellow'), ex.attempted );
|
msg = printf( M2C( this.msgs.invalidCommand.msg, 'yellow'), ex.attempted );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.resumeNotFoundAlt:
|
case HMSTATUS.resumeNotFoundAlt:
|
||||||
msg = M2C( this.msgs.resumeNotFoundAlt.msg, 'yellow' );
|
msg = M2C( this.msgs.resumeNotFoundAlt.msg, 'yellow' );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.inputOutputParity:
|
case HMSTATUS.inputOutputParity:
|
||||||
msg = M2C( this.msgs.inputOutputParity.msg );
|
msg = M2C( this.msgs.inputOutputParity.msg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.createNameMissing:
|
case HMSTATUS.createNameMissing:
|
||||||
msg = M2C( this.msgs.createNameMissing.msg );
|
msg = M2C( this.msgs.createNameMissing.msg );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.pdfGeneration:
|
case HMSTATUS.pdfGeneration:
|
||||||
msg = M2C( this.msgs.pdfGeneration.msg, 'bold' );
|
msg = M2C( this.msgs.pdfGeneration.msg, 'bold' );
|
||||||
if( ex.inner ) msg += chalk.red('\n' + ex.inner);
|
if( ex.inner ) msg += chalk.red('\n' + ex.inner);
|
||||||
withStack = true; quit = false; warn = false;
|
withStack = true; quit = false; warn = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.invalid:
|
case HMSTATUS.invalid:
|
||||||
msg = M2C( this.msgs.invalid.msg, 'red' );
|
msg = M2C( this.msgs.invalid.msg, 'red' );
|
||||||
warn = false;
|
warn = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.invalidFormat:
|
case HMSTATUS.invalidFormat:
|
||||||
ex.data.forEach(function(d){
|
ex.data.forEach(function(d){
|
||||||
msg += printf( M2C( this.msgs.invalidFormat.msg, 'bold' ),
|
msg += printf( M2C( this.msgs.invalidFormat.msg, 'bold' ),
|
||||||
ex.theme.name.toUpperCase(), d.format.toUpperCase());
|
ex.theme.name.toUpperCase(), d.format.toUpperCase());
|
||||||
}, this);
|
}, this);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.notOnPath:
|
case HMSTATUS.notOnPath:
|
||||||
msg = printf( M2C(this.msgs.notOnPath.msg, 'bold'), ex.engine);
|
msg = printf( M2C(this.msgs.notOnPath.msg, 'bold'), ex.engine);
|
||||||
quit = false;
|
quit = false;
|
||||||
warn = false;
|
warn = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.readError:
|
case HMSTATUS.readError:
|
||||||
console.error( printf( M2C(this.msgs.readError.msg, 'red'), ex.file ) );
|
console.error( printf( M2C(this.msgs.readError.msg, 'red'), ex.file ) );
|
||||||
msg = ex.inner.toString();
|
msg = ex.inner.toString();
|
||||||
warn = false;
|
warn = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HACKMYSTATUS.parseError:
|
case HMSTATUS.parseError:
|
||||||
if( SyntaxErrorEx.is( ex.inner )) {
|
if( SyntaxErrorEx.is( ex.inner )) {
|
||||||
var se = new SyntaxErrorEx( ex, ex.raw );
|
var se = new SyntaxErrorEx( ex, ex.raw );
|
||||||
msg = printf( M2C( this.msgs.parseError.msg, 'red' ),
|
msg = printf( M2C( this.msgs.parseError.msg, 'red' ),
|
||||||
|
@ -131,10 +131,10 @@ Definition of the `main` function.
|
|||||||
/** Massage command-line args and setup Commander.js. */
|
/** Massage command-line args and setup Commander.js. */
|
||||||
function initialize( ar ) {
|
function initialize( ar ) {
|
||||||
|
|
||||||
logMsg( _title );
|
|
||||||
|
|
||||||
var o = initOptions( ar );
|
var o = initOptions( ar );
|
||||||
|
|
||||||
|
o.silent || logMsg( _title );
|
||||||
|
|
||||||
// Emit debug prelude if --debug was specified
|
// Emit debug prelude if --debug was specified
|
||||||
if( o.debug ) {
|
if( o.debug ) {
|
||||||
_out.log(chalk.cyan('The -d or --debug switch was specified. DEBUG mode engaged.'));
|
_out.log(chalk.cyan('The -d or --debug switch was specified. DEBUG mode engaged.'));
|
||||||
@ -213,8 +213,14 @@ Definition of the `main` function.
|
|||||||
return v === '-d' || v === '--debug';
|
return v === '-d' || v === '--debug';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Grab the --silent flag
|
||||||
|
var isSilent = _.some( args, function(v) {
|
||||||
|
return v === '-s' || v === '--silent';
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
debug: isDebug,
|
debug: isDebug,
|
||||||
|
silent: isSilent,
|
||||||
orgVerb: oVerb,
|
orgVerb: oVerb,
|
||||||
verb: verb,
|
verb: verb,
|
||||||
json: oJSON,
|
json: oJSON,
|
||||||
@ -229,7 +235,7 @@ Definition of the `main` function.
|
|||||||
|
|
||||||
loadOptions.call( this, opts, this.parent.jsonArgs );
|
loadOptions.call( this, opts, this.parent.jsonArgs );
|
||||||
var hand = require( './error' );
|
var hand = require( './error' );
|
||||||
hand.init( _opts.debug, _opts.assert );
|
hand.init( _opts.debug, _opts.assert, _opts.silent );
|
||||||
var v = new HMR.verbs[ this.name() ]();
|
var v = new HMR.verbs[ this.name() ]();
|
||||||
_out.init( _opts );
|
_out.init( _opts );
|
||||||
v.on( 'hmr:status', function() { _out.do.apply( _out, arguments ); });
|
v.on( 'hmr:status', function() { _out.do.apply( _out, arguments ); });
|
||||||
@ -271,7 +277,7 @@ Definition of the `main` function.
|
|||||||
logMsg(chalk.cyan('OPTIONS:') + '\n');
|
logMsg(chalk.cyan('OPTIONS:') + '\n');
|
||||||
_.each(o, function(val, key) {
|
_.each(o, function(val, key) {
|
||||||
logMsg(chalk.cyan(' %s') + chalk.cyan.bold(' %s'),
|
logMsg(chalk.cyan(' %s') + chalk.cyan.bold(' %s'),
|
||||||
PAD(key,17,null,PAD.RIGHT), val);
|
PAD(key,22,null,PAD.RIGHT), val);
|
||||||
});
|
});
|
||||||
logMsg('');
|
logMsg('');
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,12 @@ events:
|
|||||||
- Peeking at **%s**
|
- Peeking at **%s**
|
||||||
afterPeek:
|
afterPeek:
|
||||||
msg: "The specified key **%s** was not found in **%s**."
|
msg: "The specified key **%s** was not found in **%s**."
|
||||||
|
afterInlineConvert:
|
||||||
|
msg: Converting **%s** to **%s** format.
|
||||||
errors:
|
errors:
|
||||||
themeNotFound:
|
themeNotFound:
|
||||||
msg: >
|
msg: >
|
||||||
Couldn't find the '%s' theme. Please specify the name of a preinstalled
|
**Couldn't find the '%s' theme.** Please specify the name of a preinstalled
|
||||||
FRESH theme or the path to a locally installed FRESH or JSON Resume theme.
|
FRESH theme or the path to a locally installed FRESH or JSON Resume theme.
|
||||||
copyCSS:
|
copyCSS:
|
||||||
msg: Couldn't copy CSS file to destination folder.
|
msg: Couldn't copy CSS file to destination folder.
|
||||||
|
@ -100,7 +100,7 @@ Output routines for HackMyResume.
|
|||||||
this.msgs.beforeMerge.msg[1] ), a.i().file
|
this.msgs.beforeMerge.msg[1] ), a.i().file
|
||||||
);
|
);
|
||||||
}, this);
|
}, this);
|
||||||
L( M2C(msg, 'cyan') );
|
L( M2C(msg, 'green') );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HME.afterMerge:
|
case HME.afterMerge:
|
||||||
@ -148,7 +148,7 @@ Output routines for HackMyResume.
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case HME.beforeAnalyze:
|
case HME.beforeAnalyze:
|
||||||
L( M2C( this.msgs.beforeAnalyze.msg, 'cyan' ), evt.fmt, evt.file);
|
L( M2C( this.msgs.beforeAnalyze.msg, 'green' ), evt.fmt, evt.file);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HME.afterAnalyze:
|
case HME.afterAnalyze:
|
||||||
@ -169,6 +169,11 @@ Output routines for HackMyResume.
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HME.afterInlineConvert:
|
||||||
|
L( M2C( this.msgs.afterInlineConvert.msg, 'green'),
|
||||||
|
evt.file, evt.fmt );
|
||||||
|
break;
|
||||||
|
|
||||||
case HME.afterValidate:
|
case HME.afterValidate:
|
||||||
var style = evt.isValid ? 'green' : 'yellow';
|
var style = evt.isValid ? 'green' : 'yellow';
|
||||||
L(
|
L(
|
||||||
|
@ -34,7 +34,9 @@ Event code definitions.
|
|||||||
beforeParse: 18,
|
beforeParse: 18,
|
||||||
afterParse: 19,
|
afterParse: 19,
|
||||||
beforePeek: 20,
|
beforePeek: 20,
|
||||||
afterPeek: 21
|
afterPeek: 21,
|
||||||
|
beforeInlineConvert: 22,
|
||||||
|
afterInlineConvert: 23
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ Definition of the FRESHResume class.
|
|||||||
FreshResume.prototype.open = function( file, opts ) {
|
FreshResume.prototype.open = function( file, opts ) {
|
||||||
var raw = FS.readFileSync( file, 'utf8' );
|
var raw = FS.readFileSync( file, 'utf8' );
|
||||||
var ret = this.parse( raw, opts );
|
var ret = this.parse( raw, opts );
|
||||||
this.imp.fileName = file;
|
this.imp.file = file;
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -100,8 +100,8 @@ Definition of the FRESHResume class.
|
|||||||
Save the sheet to disk (for environments that have disk access).
|
Save the sheet to disk (for environments that have disk access).
|
||||||
*/
|
*/
|
||||||
FreshResume.prototype.save = function( filename ) {
|
FreshResume.prototype.save = function( filename ) {
|
||||||
this.imp.fileName = filename || this.imp.fileName;
|
this.imp.file = filename || this.imp.file;
|
||||||
FS.writeFileSync( this.imp.fileName, this.stringify(), 'utf8' );
|
FS.writeFileSync( this.imp.file, this.stringify(), 'utf8' );
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -113,8 +113,8 @@ Definition of the FRESHResume class.
|
|||||||
FreshResume.prototype.saveAs = function( filename, format ) {
|
FreshResume.prototype.saveAs = function( filename, format ) {
|
||||||
|
|
||||||
if( format !== 'JRS' ) {
|
if( format !== 'JRS' ) {
|
||||||
this.imp.fileName = filename || this.imp.fileName;
|
this.imp.file = filename || this.imp.file;
|
||||||
FS.writeFileSync( this.imp.fileName, this.stringify(), 'utf8' );
|
FS.writeFileSync( this.imp.file, this.stringify(), 'utf8' );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var newRep = CONVERTER.toJRS( this );
|
var newRep = CONVERTER.toJRS( this );
|
||||||
|
@ -39,7 +39,7 @@ Definition of the JRSResume class.
|
|||||||
//this.imp = { fileName: file }; <-- schema violation, tuck it into .basics
|
//this.imp = { fileName: file }; <-- schema violation, tuck it into .basics
|
||||||
this.basics = {
|
this.basics = {
|
||||||
imp: {
|
imp: {
|
||||||
fileName: file,
|
file: file,
|
||||||
raw: FS.readFileSync( file, 'utf8' )
|
raw: FS.readFileSync( file, 'utf8' )
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -91,8 +91,8 @@ Definition of the JRSResume class.
|
|||||||
Save the sheet to disk (for environments that have disk access).
|
Save the sheet to disk (for environments that have disk access).
|
||||||
*/
|
*/
|
||||||
JRSResume.prototype.save = function( filename ) {
|
JRSResume.prototype.save = function( filename ) {
|
||||||
this.basics.imp.fileName = filename || this.basics.imp.fileName;
|
this.basics.imp.file = filename || this.basics.imp.file;
|
||||||
FS.writeFileSync(this.basics.imp.fileName, this.stringify( this ), 'utf8');
|
FS.writeFileSync(this.basics.imp.file, this.stringify( this ), 'utf8');
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -104,8 +104,8 @@ Definition of the JRSResume class.
|
|||||||
JRSResume.prototype.saveAs = function( filename, format ) {
|
JRSResume.prototype.saveAs = function( filename, format ) {
|
||||||
|
|
||||||
if( format === 'JRS' ) {
|
if( format === 'JRS' ) {
|
||||||
this.basics.imp.fileName = filename || this.imp.fileName;
|
this.basics.imp.file = filename || this.basics.imp.file;
|
||||||
FS.writeFileSync( this.basics.imp.fileName, this.stringify(), 'utf8' );
|
FS.writeFileSync( this.basics.imp.file, this.stringify(), 'utf8' );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var newRep = CONVERTER.toFRESH( this );
|
var newRep = CONVERTER.toFRESH( this );
|
||||||
@ -171,8 +171,9 @@ Definition of the JRSResume class.
|
|||||||
so tuck this into the .basic sub-object.
|
so tuck this into the .basic sub-object.
|
||||||
*/
|
*/
|
||||||
JRSResume.prototype.i = function() {
|
JRSResume.prototype.i = function() {
|
||||||
this.basics = this.basics || { imp: { } };
|
this.basics = this.basics || { };
|
||||||
return this.basics;
|
this.basics.imp = this.basics.imp || { };
|
||||||
|
return this.basics.imp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Implementation of the 'analyze' verb for HackMyResume.
|
|||||||
|
|
||||||
var MKDIRP = require('mkdirp')
|
var MKDIRP = require('mkdirp')
|
||||||
, PATH = require('path')
|
, PATH = require('path')
|
||||||
, HME = require('../core/event-codes')
|
, HMEVENT = require('../core/event-codes')
|
||||||
, HMSTATUS = require('../core/status-codes')
|
, HMSTATUS = require('../core/status-codes')
|
||||||
, _ = require('underscore')
|
, _ = require('underscore')
|
||||||
, ResumeFactory = require('../core/resume-factory')
|
, ResumeFactory = require('../core/resume-factory')
|
||||||
@ -28,7 +28,9 @@ Implementation of the 'analyze' verb for HackMyResume.
|
|||||||
},
|
},
|
||||||
|
|
||||||
invoke: function() {
|
invoke: function() {
|
||||||
|
this.stat( HMEVENT.begin, { cmd: 'analyze' });
|
||||||
analyze.apply( this, arguments );
|
analyze.apply( this, arguments );
|
||||||
|
this.stat( HMEVENT.end );
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -39,7 +41,6 @@ Implementation of the 'analyze' verb for HackMyResume.
|
|||||||
Run the 'analyze' command.
|
Run the 'analyze' command.
|
||||||
*/
|
*/
|
||||||
function analyze( sources, dst, opts ) {
|
function analyze( sources, dst, opts ) {
|
||||||
this.stat('begin');
|
|
||||||
if( !sources || !sources.length )
|
if( !sources || !sources.length )
|
||||||
throw { fluenterror: HMSTATUS.resumeNotFound };
|
throw { fluenterror: HMSTATUS.resumeNotFound };
|
||||||
|
|
||||||
@ -52,7 +53,6 @@ Implementation of the 'analyze' verb for HackMyResume.
|
|||||||
result.fluenterror || _analyze.call(this, result, nlzrs, opts );
|
result.fluenterror || _analyze.call(this, result, nlzrs, opts );
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.stat('end');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,11 +66,11 @@ Implementation of the 'analyze' verb for HackMyResume.
|
|||||||
(rez.meta && rez.meta.format && rez.meta.format.startsWith('FRESH')) ?
|
(rez.meta && rez.meta.format && rez.meta.format.startsWith('FRESH')) ?
|
||||||
'FRESH' : 'JRS';
|
'FRESH' : 'JRS';
|
||||||
|
|
||||||
this.stat( HME.beforeAnalyze, { fmt: safeFormat, file: resumeObject.file });
|
this.stat( HMEVENT.beforeAnalyze, { fmt: safeFormat, file: resumeObject.file });
|
||||||
var info = _.mapObject( nlzrs, function(val, key) {
|
var info = _.mapObject( nlzrs, function(val, key) {
|
||||||
return val.run( resumeObject.rez );
|
return val.run( resumeObject.rez );
|
||||||
});
|
});
|
||||||
this.stat( HME.afterAnalyze, { info: info } );
|
this.stat( HMEVENT.afterAnalyze, { info: info } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,8 +15,11 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
, MD = require('marked')
|
, MD = require('marked')
|
||||||
, MKDIRP = require('mkdirp')
|
, MKDIRP = require('mkdirp')
|
||||||
, EXTEND = require('../utils/extend')
|
, EXTEND = require('../utils/extend')
|
||||||
, HACKMYSTATUS = require('../core/status-codes')
|
, HMSTATUS = require('../core/status-codes')
|
||||||
, HME = require('../core/event-codes')
|
, HMEVENT = require('../core/event-codes')
|
||||||
|
, RConverter = require('fresh-jrs-converter')
|
||||||
|
, RTYPES = { FRESH: require('../core/fresh-resume'),
|
||||||
|
JRS: require('../core/jrs-resume') }
|
||||||
, parsePath = require('parse-filepath')
|
, parsePath = require('parse-filepath')
|
||||||
, _opts = require('../core/default-options')
|
, _opts = require('../core/default-options')
|
||||||
, FluentTheme = require('../core/fresh-theme')
|
, FluentTheme = require('../core/fresh-theme')
|
||||||
@ -43,9 +46,9 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
|
|
||||||
/** Invoke the Build command. */
|
/** Invoke the Build command. */
|
||||||
invoke: function() {
|
invoke: function() {
|
||||||
this.stat( HME.begin, { cmd: 'build' } );
|
this.stat( HMEVENT.begin, { cmd: 'build' } );
|
||||||
build.apply( this, arguments );
|
build.apply( this, arguments );
|
||||||
this.stat( HME.end );
|
this.stat( HMEVENT.end );
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -63,7 +66,7 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
function build( src, dst, opts ) {
|
function build( src, dst, opts ) {
|
||||||
|
|
||||||
|
|
||||||
if( !src || !src.length ) { this.err( HACKMYSTATUS.resumeNotFound ); }
|
if( !src || !src.length ) { this.err( HMSTATUS.resumeNotFound ); }
|
||||||
|
|
||||||
prep( src, dst, opts );
|
prep( src, dst, opts );
|
||||||
|
|
||||||
@ -76,24 +79,36 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
|
|
||||||
// Load the theme...we do this first because the theme choice (FRESH or
|
// Load the theme...we do this first because the theme choice (FRESH or
|
||||||
// JSON Resume) determines what format we'll convert the resume to.
|
// JSON Resume) determines what format we'll convert the resume to.
|
||||||
this.stat( HME.beforeTheme, { theme: _opts.theme });
|
this.stat( HMEVENT.beforeTheme, { theme: _opts.theme });
|
||||||
var tFolder = verifyTheme.call( this, _opts.theme );
|
var tFolder = verifyTheme.call( this, _opts.theme );
|
||||||
var theme = loadTheme( tFolder );
|
var theme = loadTheme( tFolder );
|
||||||
this.stat( HME.afterTheme, { theme: theme });
|
this.stat( HMEVENT.afterTheme, { theme: theme });
|
||||||
|
|
||||||
// Check for invalid outputs
|
// Check for invalid outputs
|
||||||
var inv = verifyOutputs.call( this, dst, theme );
|
var inv = verifyOutputs.call( this, dst, theme );
|
||||||
if( inv && inv.length ) {
|
if( inv && inv.length ) {
|
||||||
this.err( HACKMYSTATUS.invalidFormat, { data: inv, theme: theme } );
|
this.err( HMSTATUS.invalidFormat, { data: inv, theme: theme } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert resume inputs as necessary
|
||||||
|
var toFormat = theme.render ? 'JRS' : 'FRESH';
|
||||||
|
sheets.forEach( function( sh, idx ) {
|
||||||
|
if( sh.format() !== toFormat ) {
|
||||||
|
this.stat( HMEVENT.beforeInlineConvert );
|
||||||
|
sheets[ idx ] = new (RTYPES[ toFormat ])();
|
||||||
|
var convJSON = RConverter[ 'to' + toFormat ]( sh );
|
||||||
|
sheets[ idx ].parseJSON( convJSON );
|
||||||
|
this.stat( HMEVENT.afterInlineConvert, { file: sh.i().file, fmt: toFormat } );
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
// Merge input resumes...
|
// Merge input resumes...
|
||||||
(sheets.length > 1) && this.stat( HME.beforeMerge, { f: _.clone(sheets) });
|
(sheets.length > 1) && this.stat( HMEVENT.beforeMerge, { f: _.clone(sheets) });
|
||||||
rez = _.reduceRight( sheets, function( a, b, idx ) {
|
rez = _.reduceRight( sheets, function( a, b, idx ) {
|
||||||
return extend( true, b, a );
|
return extend( true, b, a );
|
||||||
});
|
});
|
||||||
// TODO: Fix this condition
|
// TODO: Fix this condition
|
||||||
(sheets.length) && this.stat( HME.afterMerge, { r: rez } );
|
(sheets.length) && this.stat( HMEVENT.afterMerge, { r: rez } );
|
||||||
|
|
||||||
// Expand output resumes...
|
// Expand output resumes...
|
||||||
var targets = expand( dst, theme );
|
var targets = expand( dst, theme );
|
||||||
@ -151,7 +166,7 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
, fName = PATH.basename(f, '.' + fType)
|
, fName = PATH.basename(f, '.' + fType)
|
||||||
, theFormat;
|
, theFormat;
|
||||||
|
|
||||||
this.stat( HME.beforeGenerate, {
|
this.stat( HMEVENT.beforeGenerate, {
|
||||||
fmt: targInfo.fmt.outFormat,
|
fmt: targInfo.fmt.outFormat,
|
||||||
file: PATH.relative(process.cwd(), f)
|
file: PATH.relative(process.cwd(), f)
|
||||||
});
|
});
|
||||||
@ -184,7 +199,7 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
// Catch any errors caused by generating this file and don't let them
|
// Catch any errors caused by generating this file and don't let them
|
||||||
// propagate -- typically we want to continue processing other formats
|
// propagate -- typically we want to continue processing other formats
|
||||||
// even if this format failed.
|
// even if this format failed.
|
||||||
this.err( HME.generate, { inner: ex } );
|
this.err( HMEVENT.generate, { inner: ex } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +210,7 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
*/
|
*/
|
||||||
function verifyOutputs( targets, theme ) {
|
function verifyOutputs( targets, theme ) {
|
||||||
|
|
||||||
this.stat(HME.verifyOutputs, { targets: targets, theme: theme });
|
this.stat(HMEVENT.verifyOutputs, { targets: targets, theme: theme });
|
||||||
|
|
||||||
return _.reject(
|
return _.reject(
|
||||||
targets.map( function( t ) {
|
targets.map( function( t ) {
|
||||||
@ -286,7 +301,7 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
if( !exists( tFolder ) ) {
|
if( !exists( tFolder ) ) {
|
||||||
tFolder = PATH.resolve( themeNameOrPath );
|
tFolder = PATH.resolve( themeNameOrPath );
|
||||||
if( !exists( tFolder ) ) {
|
if( !exists( tFolder ) ) {
|
||||||
this.err( HACKMYSTATUS.themeNotFound, { data: _opts.theme } );
|
this.err( HMSTATUS.themeNotFound, { data: _opts.theme } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tFolder;
|
return tFolder;
|
||||||
|
@ -13,9 +13,9 @@ Implementation of the 'convert' verb for HackMyResume.
|
|||||||
var ResumeFactory = require('../core/resume-factory')
|
var ResumeFactory = require('../core/resume-factory')
|
||||||
, chalk = require('chalk')
|
, chalk = require('chalk')
|
||||||
, Verb = require('../verbs/verb')
|
, Verb = require('../verbs/verb')
|
||||||
, HACKMYSTATUS = require('../core/status-codes')
|
, HMSTATUS = require('../core/status-codes')
|
||||||
, _ = require('underscore')
|
, _ = require('underscore')
|
||||||
, HME = require('../core/event-codes');
|
, HMEVENT = require('../core/event-codes');
|
||||||
|
|
||||||
|
|
||||||
var ConvertVerb = module.exports = Verb.extend({
|
var ConvertVerb = module.exports = Verb.extend({
|
||||||
@ -25,7 +25,9 @@ Implementation of the 'convert' verb for HackMyResume.
|
|||||||
},
|
},
|
||||||
|
|
||||||
invoke: function() {
|
invoke: function() {
|
||||||
|
this.stat( HMEVENT.begin, { cmd: 'convert' });
|
||||||
convert.apply( this, arguments );
|
convert.apply( this, arguments );
|
||||||
|
this.stat( HMEVENT.end );
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -41,17 +43,17 @@ Implementation of the 'convert' verb for HackMyResume.
|
|||||||
if( !srcs || !srcs.length ) { throw { fluenterror: 6 }; }
|
if( !srcs || !srcs.length ) { throw { fluenterror: 6 }; }
|
||||||
if( !dst || !dst.length ) {
|
if( !dst || !dst.length ) {
|
||||||
if( srcs.length === 1 ) {
|
if( srcs.length === 1 ) {
|
||||||
throw { fluenterror: HACKMYSTATUS.inputOutputParity };
|
throw { fluenterror: HMSTATUS.inputOutputParity };
|
||||||
}
|
}
|
||||||
else if( srcs.length === 2 ) {
|
else if( srcs.length === 2 ) {
|
||||||
dst = dst || []; dst.push( srcs.pop() );
|
dst = dst || []; dst.push( srcs.pop() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw { fluenterror: HACKMYSTATUS.inputOutputParity };
|
throw { fluenterror: HMSTATUS.inputOutputParity };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(srcs && dst && srcs.length && dst.length && srcs.length !== dst.length){
|
if(srcs && dst && srcs.length && dst.length && srcs.length !== dst.length){
|
||||||
throw { fluenterror: HACKMYSTATUS.inputOutputParity };
|
throw { fluenterror: HMSTATUS.inputOutputParity };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load source resumes
|
// Load source resumes
|
||||||
@ -67,7 +69,7 @@ Implementation of the 'convert' verb for HackMyResume.
|
|||||||
'JRS' : 'FRESH'
|
'JRS' : 'FRESH'
|
||||||
, targetFormat = srcFmt === 'JRS' ? 'FRESH' : 'JRS';
|
, targetFormat = srcFmt === 'JRS' ? 'FRESH' : 'JRS';
|
||||||
|
|
||||||
this.stat(HME.beforeConvert, { srcFile: rinfo.file, srcFmt: srcFmt, dstFile: dst[idx], dstFmt: targetFormat });
|
this.stat(HMEVENT.beforeConvert, { srcFile: rinfo.file, srcFmt: srcFmt, dstFile: dst[idx], dstFmt: targetFormat });
|
||||||
|
|
||||||
// Save it to the destination format
|
// Save it to the destination format
|
||||||
s.saveAs( dst[idx], targetFormat );
|
s.saveAs( dst[idx], targetFormat );
|
||||||
|
@ -15,8 +15,8 @@ Implementation of the 'create' verb for HackMyResume.
|
|||||||
, chalk = require('chalk')
|
, chalk = require('chalk')
|
||||||
, Verb = require('../verbs/verb')
|
, Verb = require('../verbs/verb')
|
||||||
, _ = require('underscore')
|
, _ = require('underscore')
|
||||||
, HACKMYSTATUS = require('../core/status-codes')
|
, HMSTATUS = require('../core/status-codes')
|
||||||
, HME = require('../core/event-codes');
|
, HMEVENT = require('../core/event-codes');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -27,7 +27,9 @@ Implementation of the 'create' verb for HackMyResume.
|
|||||||
},
|
},
|
||||||
|
|
||||||
invoke: function() {
|
invoke: function() {
|
||||||
|
this.stat( HMEVENT.begin, { cmd: 'create' });
|
||||||
create.apply( this, arguments );
|
create.apply( this, arguments );
|
||||||
|
this.stat( HMEVENT.begin, { cmd: 'convert' });
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -39,19 +41,17 @@ Implementation of the 'create' verb for HackMyResume.
|
|||||||
*/
|
*/
|
||||||
function create( src, dst, opts ) {
|
function create( src, dst, opts ) {
|
||||||
|
|
||||||
if(!src || !src.length) throw {fluenterror: HACKMYSTATUS.createNameMissing};
|
if(!src || !src.length) throw {fluenterror: HMSTATUS.createNameMissing};
|
||||||
this.stat( HME.begin );
|
|
||||||
|
|
||||||
_.each( src, function( t ) {
|
_.each( src, function( t ) {
|
||||||
var safeFmt = opts.format.toUpperCase();
|
var safeFmt = opts.format.toUpperCase();
|
||||||
this.stat( HME.beforeCreate, { fmt: safeFmt, file: t } );
|
this.stat( HMEVENT.beforeCreate, { fmt: safeFmt, file: t } );
|
||||||
MKDIRP.sync( PATH.dirname( t ) ); // Ensure dest folder exists;
|
MKDIRP.sync( PATH.dirname( t ) ); // Ensure dest folder exists;
|
||||||
var RezClass = require('../core/' + safeFmt.toLowerCase() + '-resume' );
|
var RezClass = require('../core/' + safeFmt.toLowerCase() + '-resume' );
|
||||||
RezClass.default().save(t);
|
RezClass.default().save(t);
|
||||||
this.stat( HME.afterCreate, { fmt: safeFmt, file: t } );
|
this.stat( HMEVENT.afterCreate, { fmt: safeFmt, file: t } );
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.stat( HME.end );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,9 @@ Implementation of the 'peek' verb for HackMyResume.
|
|||||||
},
|
},
|
||||||
|
|
||||||
invoke: function() {
|
invoke: function() {
|
||||||
|
this.stat( HMEVENT.begin, { cmd: 'peek' } );
|
||||||
peek.apply( this, arguments );
|
peek.apply( this, arguments );
|
||||||
|
this.stat( HMEVENT.end );
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -39,7 +41,6 @@ Implementation of the 'peek' verb for HackMyResume.
|
|||||||
function peek( src, dst, opts ) {
|
function peek( src, dst, opts ) {
|
||||||
|
|
||||||
if(!src || !src.length) throw {fluenterror: HMSTATUS.resumeNotFound};
|
if(!src || !src.length) throw {fluenterror: HMSTATUS.resumeNotFound};
|
||||||
this.stat( HMEVENT.begin );
|
|
||||||
|
|
||||||
var objPath = (dst && dst[0]) || '';
|
var objPath = (dst && dst[0]) || '';
|
||||||
|
|
||||||
@ -55,7 +56,6 @@ Implementation of the 'peek' verb for HackMyResume.
|
|||||||
this.stat( HMEVENT.afterPeek, { file: t, requested: objPath, target: targ } );
|
this.stat( HMEVENT.afterPeek, { file: t, requested: objPath, target: targ } );
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.stat( HMEVENT.end );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ Implementation of the 'validate' verb for HackMyResume.
|
|||||||
var SyntaxErrorEx = require('../utils/syntax-error-ex');
|
var SyntaxErrorEx = require('../utils/syntax-error-ex');
|
||||||
var chalk = require('chalk');
|
var chalk = require('chalk');
|
||||||
var Verb = require('../verbs/verb');
|
var Verb = require('../verbs/verb');
|
||||||
var HACKMYSTATUS = require('../core/status-codes');
|
var HMSTATUS = require('../core/status-codes');
|
||||||
var HME = require('../core/event-codes');
|
var HMEVENT = require('../core/event-codes');
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
|
|
||||||
|
|
||||||
@ -24,7 +24,9 @@ Implementation of the 'validate' verb for HackMyResume.
|
|||||||
},
|
},
|
||||||
|
|
||||||
invoke: function() {
|
invoke: function() {
|
||||||
|
this.stat( HMEVENT.begin, { cmd: 'validate' } );
|
||||||
validate.apply( this, arguments );
|
validate.apply( this, arguments );
|
||||||
|
this.stat( HMEVENT.end );
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -81,11 +83,11 @@ Implementation of the 'validate' verb for HackMyResume.
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stat(HME.afterValidate, { file: src.file, isValid: isValid,
|
this.stat(HMEVENT.afterValidate, { file: src.file, isValid: isValid,
|
||||||
fmt: fmt.replace('jars', 'JSON Resume'), errors: errors });
|
fmt: fmt.replace('jars', 'JSON Resume'), errors: errors });
|
||||||
|
|
||||||
if( opts.assert && !isValid ) {
|
if( opts.assert && !isValid ) {
|
||||||
throw { fluenterror: HACKMYSTATUS.invalid, shouldExit: true };
|
throw { fluenterror: HMSTATUS.invalid, shouldExit: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1,99 +0,0 @@
|
|||||||
/**
|
|
||||||
@module test-api.js
|
|
||||||
*/
|
|
||||||
|
|
||||||
var chai = require('chai')
|
|
||||||
, expect = chai.expect
|
|
||||||
, should = chai.should()
|
|
||||||
, path = require('path')
|
|
||||||
, _ = require('underscore')
|
|
||||||
, FRESHResume = require('../src/core/fresh-resume')
|
|
||||||
, FCMD = require( '../src/hackmyapi')
|
|
||||||
, validator = require('is-my-json-valid')
|
|
||||||
, HMRMAIN = require('../src/cli/main')
|
|
||||||
, EXTEND = require('../src/utils/extend');
|
|
||||||
|
|
||||||
chai.config.includeStack = false;
|
|
||||||
|
|
||||||
describe('Testing CLI interface', function () {
|
|
||||||
|
|
||||||
var _sheet;
|
|
||||||
|
|
||||||
|
|
||||||
var opts = {
|
|
||||||
format: 'FRESH',
|
|
||||||
prettify: true,
|
|
||||||
silent: false,
|
|
||||||
assert: true // Causes validation errors to throw exceptions
|
|
||||||
};
|
|
||||||
|
|
||||||
var opts2 = {
|
|
||||||
format: 'JRS',
|
|
||||||
prettify: true,
|
|
||||||
silent: true
|
|
||||||
};
|
|
||||||
|
|
||||||
var sb = 'test/sandbox/';
|
|
||||||
var ft = 'node_modules/fresh-test-resumes/src/fresh/';
|
|
||||||
|
|
||||||
[
|
|
||||||
|
|
||||||
[ 'new', [sb + 'new-fresh-resume.json'], [], opts, ' (FRESH format)' ],
|
|
||||||
[ 'new', [sb + 'new-jrs-resume.json'], [], opts2, ' (JRS format)'],
|
|
||||||
[ 'new', [sb + 'new-1.json', sb + 'new-2.json', sb + 'new-3.json'], [], opts, ' (multiple FRESH resumes)' ],
|
|
||||||
[ 'new', [sb + 'new-jrs-1.json', sb + 'new-jrs-2.json', sb + 'new-jrs-3.json'], [], opts, ' (multiple JRS resumes)' ],
|
|
||||||
[ '!new', [], [], opts, " (when a filename isn't specified)" ],
|
|
||||||
|
|
||||||
[ 'validate', [ft + 'jane-fullstacker.json'], [], opts, ' (jane-q-fullstacker|FRESH)' ],
|
|
||||||
[ 'validate', [ft + 'johnny-trouble.json'], [], opts, ' (johnny-trouble|FRESH)' ],
|
|
||||||
[ 'validate', [sb + 'new-fresh-resume.json'], [], opts, ' (new-fresh-resume|FRESH)' ],
|
|
||||||
[ 'validate', ['test/resumes/jrs-0.0.0/richard-hendriks.json'], [], opts2, ' (richard-hendriks.json|JRS)' ],
|
|
||||||
[ 'validate', ['test/resumes/jrs-0.0.0/jane-incomplete.json'], [], opts2, ' (jane-incomplete.json|JRS)' ],
|
|
||||||
[ 'validate', [sb + 'new-1.json', sb + 'new-jrs-resume.json', sb + 'new-1.json', sb + 'new-2.json', sb + 'new-3.json'], [], opts, ' (5|BOTH)' ],
|
|
||||||
|
|
||||||
[ 'analyze', [ft + 'jane-fullstacker.json'], [], opts, ' (jane-q-fullstacker|FRESH)' ],
|
|
||||||
[ 'analyze', ['test/resumes/jrs-0.0.0/richard-hendriks.json'], [], opts2, ' (richard-hendriks|JRS)' ],
|
|
||||||
|
|
||||||
[ 'build', [ ft + 'jane-fullstacker.json', ft + 'override/jane-fullstacker-override.fresh.json' ], [ sb + 'merged/jane-fullstacker-gamedev.fresh.all'], opts, ' (jane-q-fullstacker w/ override|FRESH)' ],
|
|
||||||
[ '!build', [ ft + 'jane-fullstacker.json'], [ sb + 'shouldnt-exist.pdf' ], EXTEND(true, opts, { theme: 'awesome' }), ' (jane-q-fullstacker + Awesome + PDF|FRESH)' ]
|
|
||||||
|
|
||||||
].forEach( function(a) {
|
|
||||||
|
|
||||||
run.apply( /* The players of */ null, a );
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function run( verb, src, dst, opts, msg ) {
|
|
||||||
msg = msg || '.';
|
|
||||||
var shouldSucceed = true;
|
|
||||||
if( verb[0] === '!' ) {
|
|
||||||
verb = verb.substr(1);
|
|
||||||
shouldSucceed = false;
|
|
||||||
}
|
|
||||||
it( 'The ' + verb.toUpperCase() + ' command should ' + (shouldSucceed ? ' SUCCEED' : ' FAIL') + msg, function () {
|
|
||||||
function runIt() {
|
|
||||||
try {
|
|
||||||
var v = new FCMD.verbs[verb]();
|
|
||||||
v.on('hmr:error', function(ex) {
|
|
||||||
throw ex;
|
|
||||||
});
|
|
||||||
v.invoke( src, dst, opts, opts.silent ?
|
|
||||||
function(){} : function(msg){ msg = msg || ''; console.log(msg); } );
|
|
||||||
}
|
|
||||||
catch(ex) {
|
|
||||||
console.error(ex);
|
|
||||||
console.error(ex.stack);
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( shouldSucceed )
|
|
||||||
runIt.should.not.Throw();
|
|
||||||
else
|
|
||||||
runIt.should.Throw();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
@ -1,44 +0,0 @@
|
|||||||
|
|
||||||
var chai = require('chai')
|
|
||||||
, expect = chai.expect
|
|
||||||
, should = chai.should()
|
|
||||||
, path = require('path')
|
|
||||||
, parsePath = require('parse-filepath')
|
|
||||||
, _ = require('underscore')
|
|
||||||
, FRESHResume = require('../src/core/fresh-resume')
|
|
||||||
, JRSResume = require('../src/core/jrs-resume')
|
|
||||||
, CONVERTER = require('fresh-jrs-converter')
|
|
||||||
, FS = require('fs')
|
|
||||||
, MKDIRP = require('mkdirp')
|
|
||||||
, _ = require('underscore');
|
|
||||||
|
|
||||||
chai.config.includeStack = false;
|
|
||||||
|
|
||||||
describe('FRESH/JRS converter', function () {
|
|
||||||
|
|
||||||
var _sheet;
|
|
||||||
|
|
||||||
it('should round-trip from JRS to FRESH to JRS without modifying or losing data', function () {
|
|
||||||
|
|
||||||
var fileA = path.join( __dirname, 'resumes/jrs-0.0.0/richard-hendriks.json' );
|
|
||||||
var fileB = path.join( __dirname, 'sandbox/richard-hendriks.converted.fresh.json' );
|
|
||||||
var fileC = path.join( __dirname, 'sandbox/richard-hendriks.converted.jrs.json' );
|
|
||||||
|
|
||||||
_sheet = new JRSResume().open( fileA );
|
|
||||||
MKDIRP.sync( parsePath( fileB ).dirname );
|
|
||||||
_sheet.saveAs( fileB, 'FRESH' );
|
|
||||||
|
|
||||||
var freshSheet = new FRESHResume().open( fileB );
|
|
||||||
freshSheet.saveAs( fileC, 'JRS' );
|
|
||||||
|
|
||||||
var rawA = FS.readFileSync( fileA, 'utf8' );
|
|
||||||
var rawC = FS.readFileSync( fileC, 'utf8' );
|
|
||||||
|
|
||||||
var objA = JSON.parse( rawA );
|
|
||||||
var objC = JSON.parse( rawC );
|
|
||||||
|
|
||||||
_.isEqual(objA, objC).should.equal(true);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
@ -6,8 +6,8 @@
|
|||||||
5|notacommand
|
5|notacommand
|
||||||
3|build
|
3|build
|
||||||
14|build doesnt-exist.json
|
14|build doesnt-exist.json
|
||||||
1|build doesnt-exist.json -t not-a-theme
|
14|build doesnt-exist.json -t not-a-theme
|
||||||
1|build doesnt-exist.json -t node_modules/not-a-theme
|
14|build doesnt-exist.json -t node_modules/not-a-theme
|
||||||
8|new
|
8|new
|
||||||
0|new test/sandbox/cli-test/new-empty-resume.auto.json
|
0|new test/sandbox/cli-test/new-empty-resume.auto.json
|
||||||
0|new test/sandbox/cli-test/new-empty-resume.jrs.json -f jrs
|
0|new test/sandbox/cli-test/new-empty-resume.jrs.json -f jrs
|
||||||
|
@ -32,18 +32,16 @@ function genThemes( title, src, fmt ) {
|
|||||||
format: fmt,
|
format: fmt,
|
||||||
prettify: true,
|
prettify: true,
|
||||||
silent: false,
|
silent: false,
|
||||||
css: 'embed'
|
css: 'embed',
|
||||||
|
debug: true
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
var v = new HMR.verbs.build();
|
var v = new HMR.verbs.build();
|
||||||
v.invoke( src, dst, opts, function(msg) {
|
v.invoke( src, dst, opts );
|
||||||
msg = msg || '';
|
|
||||||
console.log(msg);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
catch(ex) {
|
catch(ex) {
|
||||||
console.log(ex);
|
console.error( ex );
|
||||||
console.log(ex.stack);
|
console.error( ex.stack );
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +68,7 @@ function folderContains( needle, haystack ) {
|
|||||||
return _.some( READFILES( path.join(__dirname, haystack) ), function( absPath ) {
|
return _.some( READFILES( path.join(__dirname, haystack) ), function( absPath ) {
|
||||||
if( FS.lstatSync( absPath ).isFile() ) {
|
if( FS.lstatSync( absPath ).isFile() ) {
|
||||||
if( fileContains( absPath, needle ) ) {
|
if( fileContains( absPath, needle ) ) {
|
||||||
console.log('Found invalid metadata in ' + absPath);
|
console.error('Found invalid metadata in ' + absPath);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user