mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 08:20:11 +00:00
Gather.
This commit is contained in:
parent
a935fe7dc2
commit
01c053702d
@ -198,7 +198,7 @@ Error-handling routines for HackMyResume.
|
|||||||
case HMSTATUS.invalidHelperUse:
|
case HMSTATUS.invalidHelperUse:
|
||||||
msg = printf( M2C( this.msgs.invalidHelperUse.msg ), ex.helper );
|
msg = printf( M2C( this.msgs.invalidHelperUse.msg ), ex.helper );
|
||||||
quit = false;
|
quit = false;
|
||||||
etype = 'error';
|
etype = 'warning';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HMSTATUS.notOnPath:
|
case HMSTATUS.notOnPath:
|
||||||
@ -226,10 +226,18 @@ Error-handling routines for HackMyResume.
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case HMSTATUS.compileTemplate:
|
case HMSTATUS.compileTemplate:
|
||||||
//msg = printf( M2C( this.msgs.compileTemplate.msg ), ex.inner);
|
|
||||||
etype = 'error';
|
etype = 'error';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HMSTATUS.themeLoad:
|
||||||
|
msg = M2C( printf( this.msgs.themeLoad.msg, ex.attempted.toUpperCase() ), 'red');
|
||||||
|
if( ex.inner && ex.inner.fluenterror ) {
|
||||||
|
msg += M2C('\nError: ', 'red') + assembleError.call( this, ex.inner ).msg;
|
||||||
|
}
|
||||||
|
quit = true;
|
||||||
|
etype = 'custom';
|
||||||
|
break;
|
||||||
|
|
||||||
case HMSTATUS.parseError:
|
case HMSTATUS.parseError:
|
||||||
if( SyntaxErrorEx.is( ex.inner )) {
|
if( SyntaxErrorEx.is( ex.inner )) {
|
||||||
console.error( printf( M2C(this.msgs.readError.msg, 'red'), ex.file ) );
|
console.error( printf( M2C(this.msgs.readError.msg, 'red'), ex.file ) );
|
||||||
|
@ -238,6 +238,7 @@ Definition of the `main` function.
|
|||||||
var hand = require( './error' );
|
var hand = require( './error' );
|
||||||
hand.init( _opts.debug, _opts.assert, _opts.silent );
|
hand.init( _opts.debug, _opts.assert, _opts.silent );
|
||||||
var v = new HMR.verbs[ this.name() ]();
|
var v = new HMR.verbs[ this.name() ]();
|
||||||
|
_opts.errHandler = v;
|
||||||
_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 ); });
|
||||||
v.on( 'hmr:error', function() {
|
v.on( 'hmr:error', function() {
|
||||||
|
@ -81,7 +81,7 @@ errors:
|
|||||||
parseError:
|
parseError:
|
||||||
msg: Invalid or corrupt JSON on line %s column %s.
|
msg: Invalid or corrupt JSON on line %s column %s.
|
||||||
invalidHelperUse:
|
invalidHelperUse:
|
||||||
msg: Invalid use of the **%s** theme helper.
|
msg: Warning: Invalid use of the **%s** theme helper.
|
||||||
fileSaveError:
|
fileSaveError:
|
||||||
msg: An error occurred while writing %s to disk: %s.
|
msg: An error occurred while writing %s to disk: %s.
|
||||||
mixedMerge:
|
mixedMerge:
|
||||||
@ -90,3 +90,5 @@ errors:
|
|||||||
msg: "An error occurred during template invocation."
|
msg: "An error occurred during template invocation."
|
||||||
compileTemplate:
|
compileTemplate:
|
||||||
msg: "An error occurred during template compilation."
|
msg: "An error occurred during template compilation."
|
||||||
|
themeLoad:
|
||||||
|
msg: "Applying **%s** theme (? formats)"
|
||||||
|
@ -107,7 +107,7 @@ Output routines for HackMyResume.
|
|||||||
case HME.applyTheme:
|
case HME.applyTheme:
|
||||||
this.theme = evt.theme;
|
this.theme = evt.theme;
|
||||||
var numFormats = Object.keys( evt.theme.formats ).length;
|
var numFormats = Object.keys( evt.theme.formats ).length;
|
||||||
L( M2C(this.msgs.applyTheme.msg, 'green'),
|
L( M2C(this.msgs.applyTheme.msg, evt.status === 'error' ? 'red' : 'green'),
|
||||||
evt.theme.name.toUpperCase(),
|
evt.theme.name.toUpperCase(),
|
||||||
numFormats, ( numFormats === 1 ? '' : 's') );
|
numFormats, ( numFormats === 1 ? '' : 's') );
|
||||||
break;
|
break;
|
||||||
|
@ -15,7 +15,9 @@ Definition of the FRESHTheme class.
|
|||||||
, parsePath = require('parse-filepath')
|
, parsePath = require('parse-filepath')
|
||||||
, pathExists = require('path-exists').sync
|
, pathExists = require('path-exists').sync
|
||||||
, EXTEND = require('extend')
|
, EXTEND = require('extend')
|
||||||
|
, HMSTATUS = require('./status-codes')
|
||||||
, moment = require('moment')
|
, moment = require('moment')
|
||||||
|
, loadSafeJson = require('../utils/safe-json-loader')
|
||||||
, READFILES = require('recursive-readdir-sync');
|
, READFILES = require('recursive-readdir-sync');
|
||||||
|
|
||||||
|
|
||||||
@ -46,11 +48,17 @@ Definition of the FRESHTheme class.
|
|||||||
|
|
||||||
// Load the theme
|
// Load the theme
|
||||||
var themeFile = PATH.join( themeFolder, 'theme.json' );
|
var themeFile = PATH.join( themeFolder, 'theme.json' );
|
||||||
var themeInfo = JSON.parse( FS.readFileSync( themeFile, 'utf8' ) );
|
var themeInfo = loadSafeJson( themeFile );
|
||||||
|
if( themeInfo.ex ) throw {
|
||||||
|
fluenterror: themeInfo.ex.operation === 'parse' ?
|
||||||
|
HMSTATUS.parseError : HMSTATUS.readError,
|
||||||
|
inner: themeInfo.ex.inner
|
||||||
|
};
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
// Move properties from the theme JSON file to the theme object
|
// Move properties from the theme JSON file to the theme object
|
||||||
EXTEND( true, this, themeInfo );
|
EXTEND( true, this, themeInfo.json );
|
||||||
|
|
||||||
// Check for an "inherits" entry in the theme JSON.
|
// Check for an "inherits" entry in the theme JSON.
|
||||||
if( this.inherits ) {
|
if( this.inherits ) {
|
||||||
|
@ -28,7 +28,8 @@ Status codes for HackMyResume.
|
|||||||
invalidHelperUse: 18,
|
invalidHelperUse: 18,
|
||||||
mixedMerge: 19,
|
mixedMerge: 19,
|
||||||
invokeTemplate: 20,
|
invokeTemplate: 20,
|
||||||
compileTemplate: 21
|
compileTemplate: 21,
|
||||||
|
themeLoad: 22
|
||||||
};
|
};
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
@ -74,12 +74,30 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
format: null, objectify: false, quit: true, inner: { sort: _opts.sort }
|
format: null, objectify: false, quit: true, inner: { sort: _opts.sort }
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
// Explicit check for any resume loading errors...
|
||||||
|
if( !sheetObjects ||
|
||||||
|
_.some( sheetObjects, function(so) { return so.fluenterror; } ) ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var sheets = sheetObjects.map(function(r) { return r.json; });
|
var sheets = sheetObjects.map(function(r) { return r.json; });
|
||||||
|
|
||||||
// Load the theme...
|
// Load the theme...
|
||||||
|
var theme;
|
||||||
this.stat( HMEVENT.beforeTheme, { theme: _opts.theme });
|
this.stat( HMEVENT.beforeTheme, { theme: _opts.theme });
|
||||||
|
try {
|
||||||
var tFolder = verifyTheme.call( this, _opts.theme );
|
var tFolder = verifyTheme.call( this, _opts.theme );
|
||||||
var theme = _opts.themeObj = loadTheme( tFolder );
|
theme = _opts.themeObj = loadTheme( tFolder );
|
||||||
|
}
|
||||||
|
catch( ex ) {
|
||||||
|
var newEx = {
|
||||||
|
fluenterror: HMSTATUS.themeLoad,
|
||||||
|
inner: ex,
|
||||||
|
attempted: _opts.theme
|
||||||
|
};
|
||||||
|
this.err( HMSTATUS.themeLoad, newEx );
|
||||||
|
return null;
|
||||||
|
}
|
||||||
this.stat( HMEVENT.afterTheme, { theme: theme });
|
this.stat( HMEVENT.afterTheme, { theme: theme });
|
||||||
|
|
||||||
// Check for invalid outputs...
|
// Check for invalid outputs...
|
||||||
@ -149,6 +167,7 @@ Implementation of the 'build' verb for HackMyResume.
|
|||||||
_opts.wrap = opts.wrap || 60;
|
_opts.wrap = opts.wrap || 60;
|
||||||
_opts.stitles = opts.sectionTitles;
|
_opts.stitles = opts.sectionTitles;
|
||||||
_opts.tips = opts.tips;
|
_opts.tips = opts.tips;
|
||||||
|
_opts.errHandler = opts.errHandler;
|
||||||
_opts.noTips = opts.noTips;
|
_opts.noTips = opts.noTips;
|
||||||
_opts.debug = opts.debug;
|
_opts.debug = opts.debug;
|
||||||
_opts.sort = opts.sort;
|
_opts.sort = opts.sort;
|
||||||
|
Loading…
Reference in New Issue
Block a user