mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-15 01:57:08 +01:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
3b38c4818f | |||
62c967526f | |||
6e5a44798b | |||
1fbfe2507b | |||
d6a3aab68a | |||
9fdfd1b5a6 |
10
README.md
10
README.md
@ -442,6 +442,16 @@ hackmyresume BUILD resume.json -o someFile.all -s
|
|||||||
hackmyresume BUILD resume.json -o someFile.all --silent
|
hackmyresume BUILD resume.json -o someFile.all --silent
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Debug Mode
|
||||||
|
|
||||||
|
Use `-d` or `--debug` to force HMR to emit a call stack when errors occur. In
|
||||||
|
the future, this option will emit detailed error logging.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hackmyresume BUILD resume.json -d
|
||||||
|
hackmyresume ANALYZE resume.json --debug
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
HackMyResume is a community-driven free and open source project under the MIT
|
HackMyResume is a community-driven free and open source project under the MIT
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hackmyresume",
|
"name": "hackmyresume",
|
||||||
"version": "1.5.0",
|
"version": "1.5.2",
|
||||||
"description": "Generate polished résumés and CVs in HTML, Markdown, LaTeX, MS Word, PDF, plain text, JSON, XML, YAML, smoke signal, and carrier pigeon.",
|
"description": "Generate polished résumés and CVs in HTML, Markdown, LaTeX, MS Word, PDF, plain text, JSON, XML, YAML, smoke signal, and carrier pigeon.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -3,7 +3,7 @@ Error-handling routines for HackMyResume.
|
|||||||
@module error-handler.js
|
@module error-handler.js
|
||||||
@license MIT. See LICENSE.md for details.
|
@license MIT. See LICENSE.md for details.
|
||||||
*/
|
*/
|
||||||
|
// TODO: Logging library
|
||||||
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
@ -26,7 +26,9 @@ Error-handling routines for HackMyResume.
|
|||||||
*/
|
*/
|
||||||
var ErrorHandler = module.exports = {
|
var ErrorHandler = module.exports = {
|
||||||
|
|
||||||
|
init: function( debug ) {
|
||||||
|
this.debug = debug;
|
||||||
|
},
|
||||||
|
|
||||||
err: function( ex, shouldExit ) {
|
err: function( ex, shouldExit ) {
|
||||||
|
|
||||||
@ -62,8 +64,10 @@ Error-handling routines for HackMyResume.
|
|||||||
log( msg.toString() ) :
|
log( msg.toString() ) :
|
||||||
log( chalk.red.bold('ERROR: ' + msg.toString()) );
|
log( chalk.red.bold('ERROR: ' + msg.toString()) );
|
||||||
|
|
||||||
// Usually emit the stack
|
// Selectively show the stack trace
|
||||||
( showStack && ex.code !== 'ENOENT' ) && log( chalk.gray(ex.stack) );
|
if( (ex.stack || (ex.inner && ex.inner.stack)) &&
|
||||||
|
((showStack && ex.code !== 'ENOENT' ) || (this.debug) ))
|
||||||
|
log( chalk.red( ex.stack || ex.stack.inner ) );
|
||||||
|
|
||||||
// Let the error code be the process's return code.
|
// Let the error code be the process's return code.
|
||||||
( shouldExit || ex.shouldExit ) && process.exit( exitCode );
|
( shouldExit || ex.shouldExit ) && process.exit( exitCode );
|
||||||
|
@ -47,8 +47,12 @@ Definition of the HtmlPdfCLIGenerator class.
|
|||||||
// { [Error: write EPIPE] code: 'EPIPE', errno: 'EPIPE', ... }
|
// { [Error: write EPIPE] code: 'EPIPE', errno: 'EPIPE', ... }
|
||||||
// { [Error: ENOENT] }
|
// { [Error: ENOENT] }
|
||||||
throw ( ex.inner && ex.inner.code === 'ENOENT' ) ?
|
throw ( ex.inner && ex.inner.code === 'ENOENT' ) ?
|
||||||
{ fluenterror: this.codes.notOnPath, engine: ex.cmd } :
|
|
||||||
{ fluenterror: this.codes.pdfGeneration, inner: ex.inner };
|
{ fluenterror: this.codes.notOnPath, inner: ex.inner, engine: ex.cmd,
|
||||||
|
stack: ex.inner && ex.inner.stack } :
|
||||||
|
|
||||||
|
{ fluenterror: this.codes.pdfGeneration, inner: ex.inner,
|
||||||
|
stack: ex.inner && ex.inner.stack };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
src/index.js
21
src/index.js
@ -49,7 +49,8 @@ function main() {
|
|||||||
.option('-o --opts <optionsFile>', 'Path to a .hackmyrc options file')
|
.option('-o --opts <optionsFile>', 'Path to a .hackmyrc options file')
|
||||||
.option('-s --silent', 'Run in silent mode')
|
.option('-s --silent', 'Run in silent mode')
|
||||||
.option('--no-color', 'Disable colors')
|
.option('--no-color', 'Disable colors')
|
||||||
.option('--color', 'Enable colors');
|
.option('--color', 'Enable colors')
|
||||||
|
.option('-d --debug', 'Enable diagnostics', false);
|
||||||
//.usage('COMMAND <sources> [TO <targets>]');
|
//.usage('COMMAND <sources> [TO <targets>]');
|
||||||
|
|
||||||
// Create the NEW command
|
// Create the NEW command
|
||||||
@ -172,6 +173,7 @@ Invoke a HackMyResume verb.
|
|||||||
*/
|
*/
|
||||||
function execVerb( src, dst, opts, log ) {
|
function execVerb( src, dst, opts, log ) {
|
||||||
loadOptions.call( this, opts );
|
loadOptions.call( this, opts );
|
||||||
|
require('./core/error-handler').init( _opts.debug );
|
||||||
HMR.verbs[ this.name() ].call( null, src, dst, _opts, log );
|
HMR.verbs[ this.name() ].call( null, src, dst, _opts, log );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,23 +182,24 @@ function execVerb( src, dst, opts, log ) {
|
|||||||
/**
|
/**
|
||||||
Initialize HackMyResume options.
|
Initialize HackMyResume options.
|
||||||
*/
|
*/
|
||||||
function loadOptions( opts ) {
|
function loadOptions( o ) {
|
||||||
|
|
||||||
opts.opts = this.parent.opts;
|
o.opts = this.parent.opts;
|
||||||
|
|
||||||
// Load the specified options file (if any) and apply options
|
// Load the specified options file (if any) and apply options
|
||||||
if( opts.opts && String.is( opts.opts )) {
|
if( o.opts && String.is( o.opts )) {
|
||||||
var json = safeLoadJSON( PATH.relative( process.cwd(), opts.opts ) );
|
var json = safeLoadJSON( PATH.relative( process.cwd(), o.opts ) );
|
||||||
json && ( opts = EXTEND( true, opts, json ) );
|
json && ( o = EXTEND( true, o, json ) );
|
||||||
if( !json ) {
|
if( !json ) {
|
||||||
throw safeLoadJSON.error;
|
throw safeLoadJSON.error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge in command-line options
|
// Merge in command-line options
|
||||||
opts = EXTEND( true, opts, this.opts() );
|
o = EXTEND( true, o, this.opts() );
|
||||||
opts.silent = this.parent.silent;
|
o.silent = this.parent.silent;
|
||||||
_opts = opts;
|
o.debug = this.parent.debug;
|
||||||
|
_opts = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ Definition of the HandlebarsGenerator class.
|
|||||||
( format === 'doc' ) && (encData = json.xmlify());
|
( format === 'doc' ) && (encData = json.xmlify());
|
||||||
|
|
||||||
// Compile and run the Handlebars template.
|
// Compile and run the Handlebars template.
|
||||||
var template = HANDLEBARS.compile(jst);
|
var template = HANDLEBARS.compile(jst, { strict: false, assumeObjects: false });
|
||||||
return template({
|
return template({
|
||||||
r: encData,
|
r: encData,
|
||||||
RAW: json,
|
RAW: json,
|
||||||
|
@ -133,6 +133,7 @@ Implementation of the 'generate' verb for HackMyResume.
|
|||||||
_opts.stitles = opts.sectionTitles;
|
_opts.stitles = opts.sectionTitles;
|
||||||
_opts.tips = opts.tips;
|
_opts.tips = opts.tips;
|
||||||
_opts.noTips = opts.noTips;
|
_opts.noTips = opts.noTips;
|
||||||
|
_opts.debug = opts.debug;
|
||||||
|
|
||||||
// If two or more files are passed to the GENERATE command and the TO
|
// If two or more files are passed to the GENERATE command and the TO
|
||||||
// keyword is omitted, the last file specifies the output file.
|
// keyword is omitted, the last file specifies the output file.
|
||||||
|
Reference in New Issue
Block a user