1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-10 15:57:07 +01:00

Refactor API interface.

This commit is contained in:
hacksalot
2016-01-04 07:23:20 -05:00
parent a8fed1b69b
commit ce75f09210
12 changed files with 98 additions and 113 deletions

View File

@ -10,8 +10,7 @@ Implementation of the 'analyze' verb for HackMyResume.
var FLUENT = require('../hackmyapi')
, MKDIRP = require('mkdirp')
var MKDIRP = require('mkdirp')
, PATH = require('path')
, _ = require('underscore')
, ResumeFactory = require('../core/resume-factory')

View File

@ -6,8 +6,7 @@ Implementation of the 'create' verb for HackMyResume.
(function(){
var FLUENT = require('../hackmyapi')
, MKDIRP = require('mkdirp')
var MKDIRP = require('mkdirp')
, PATH = require('path')
, chalk = require('chalk');
@ -22,7 +21,9 @@ Implementation of the 'create' verb for HackMyResume.
_log(chalk.green('Creating new ') + chalk.green.bold(safeFormat) +
chalk.green(' resume: ') + chalk.green.bold(t));
MKDIRP.sync( PATH.dirname( t ) ); // Ensure dest folder exists;
FLUENT[ safeFormat + 'Resume' ].default().save( t );
var RezClass = require('../core/' + safeFormat.toLowerCase() + '-resume' );
RezClass.default().save(t);
//FLUENT[ safeFormat + 'Resume' ].default().save( t );
});
};

View File

@ -52,7 +52,7 @@ Implementation of the 'generate' verb for HackMyResume.
_err = errHandler || error;
_opts.theme = (opts.theme && opts.theme.toLowerCase().trim())|| 'modern';
_opts.prettify = opts.prettify === true ? _opts.prettify : false;
_opts.css = opts.css;
_opts.css = opts.css || 'embed';
_opts.pdf = opts.pdf;
_opts.wrap = opts.wrap || 60;
@ -131,8 +131,20 @@ Implementation of the 'generate' verb for HackMyResume.
, theFormat;
var suffix = '';
if( targInfo.fmt.outFormat === 'pdf' && _opts.pdf ) {
suffix = chalk.green(' (with ' + _opts.pdf + ')');
if( targInfo.fmt.outFormat === 'pdf' ) {
if( _opts.pdf ) {
if( _opts.pdf !== 'none' ) {
suffix = chalk.green(' (with ' + _opts.pdf + ')');
}
else {
_log( chalk.gray('Skipping ') +
chalk.white.bold(
pad(targInfo.fmt.outFormat.toUpperCase(),4,null,pad.RIGHT)) +
chalk.gray(' resume') + suffix + chalk.green(': ') +
chalk.white( PATH.relative(process.cwd(), f )) );
return;
}
}
}
_log( chalk.green('Generating ') +
@ -244,28 +256,22 @@ Implementation of the 'generate' verb for HackMyResume.
var to = PATH.resolve(t), pa = parsePath(to),fmat = pa.extname || '.all';
var explicitFormats = _.omit( theTheme.formats, function(val, key) {
return !val.freebie;
});
var implicitFormats = _.omit( theTheme.formats, function(val) {
return val.freebie;
});
targets.push.apply(
targets, fmat === '.all' ?
Object.keys( implicitFormats ).map( function( k ) {
Object.keys( theTheme.formats ).map( function( k ) {
var z = theTheme.formats[k];
return { file: to.replace( /all$/g, z.outFormat ), fmt: z };
}) :
[{ file: to, fmt: theTheme.getFormat( fmat.slice(1) ) }]);
targets.push.apply(
targets, fmat === '.all' ?
Object.keys( explicitFormats ).map( function( k ) {
var z = theTheme.formats[k];
return { file: to.replace( /all$/g, z.outFormat ), fmt: z };
}) :
[{ file: to, fmt: theTheme.getFormat( fmat.slice(1) ) }]);
// targets.push.apply(
// targets, fmat === '.all' ?
// Object.keys( explicitFormats ).map( function( k ) {
// var z = theTheme.formats[k];
// return { file: to.replace( /all$/g, z.outFormat ), fmt: z };
// }) :
// [{ file: to, fmt: theTheme.getFormat( fmat.slice(1) ) }]);
});