mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 08:20:11 +00:00
Merge branch 'dev'
This commit is contained in:
commit
782068463c
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -1,8 +1,7 @@
|
|||||||
# Auto detect text files and perform LF normalization
|
# Auto detect text files and perform LF normalization
|
||||||
* text=auto
|
* text=auto
|
||||||
|
*.js text eol=lf
|
||||||
# Custom for Visual Studio
|
*.json text eol=lf
|
||||||
*.cs diff=csharp
|
|
||||||
|
|
||||||
# Standard to msysgit
|
# Standard to msysgit
|
||||||
*.doc diff=astextplain
|
*.doc diff=astextplain
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "fluentcmd",
|
"name": "fluentcmd",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"description": "Generate beautiful, targeted resumes from your command line or shell.",
|
"description": "Generate beautiful, targeted resumes from your command line or shell.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -24,7 +24,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/fluentdesk/fluentcmd",
|
"homepage": "https://github.com/fluentdesk/fluentcmd",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fluentlib": "fluentdesk/fluentlib",
|
"fluentlib": "fluentdesk/fluentlib#v0.1.0",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"underscore": "^1.8.3"
|
"underscore": "^1.8.3"
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,10 @@ module.exports = function () {
|
|||||||
var path = require( 'path' )
|
var path = require( 'path' )
|
||||||
, extend = require( './utils/extend' )
|
, extend = require( './utils/extend' )
|
||||||
, unused = require('./utils/string')
|
, unused = require('./utils/string')
|
||||||
, FLUENT = require('fluentlib')
|
, fs = require('fs')
|
||||||
, _ = require('underscore')
|
, _ = require('underscore')
|
||||||
, rez, _log;
|
, FLUENT = require('fluentlib')
|
||||||
|
, rez, _log, _err;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Given a source JSON resume, a destination resume path, and a theme file,
|
Given a source JSON resume, a destination resume path, and a theme file,
|
||||||
@ -21,19 +22,21 @@ module.exports = function () {
|
|||||||
@param theme Friendly name of the resume theme. Defaults to "informatic".
|
@param theme Friendly name of the resume theme. Defaults to "informatic".
|
||||||
@param logger Optional logging override.
|
@param logger Optional logging override.
|
||||||
*/
|
*/
|
||||||
function gen( src, dst, theme, logger ) {
|
function gen( src, dst, theme, logger, errHandler ) {
|
||||||
|
|
||||||
_log = logger || console.log;
|
_log = logger || console.log;
|
||||||
_opts.theme = theme;
|
_err = errHandler || error;
|
||||||
var msg = '';
|
_opts.theme = (theme && theme.toLowerCase().trim()) || 'informatic';
|
||||||
|
|
||||||
// Load input resumes...
|
// Load input resumes...
|
||||||
|
if(!src || !src.length) { throw { fluenterror: 3 }; }
|
||||||
var sheets = src.map( function( res ) {
|
var sheets = src.map( function( res ) {
|
||||||
_log( 'Reading JSON resume: ' + res );
|
_log( 'Reading JSON resume: ' + res );
|
||||||
return (new FLUENT.Sheet()).open( res );
|
return (new FLUENT.Sheet()).open( res );
|
||||||
});
|
});
|
||||||
|
|
||||||
// Merge input resumes...
|
// Merge input resumes...
|
||||||
|
var msg = '';
|
||||||
rez = _.reduceRight( sheets, function( a, b, idx ) {
|
rez = _.reduceRight( sheets, function( a, b, idx ) {
|
||||||
msg += ((idx == sheets.length - 2) ? 'Merging ' + a.meta.fileName : '')
|
msg += ((idx == sheets.length - 2) ? 'Merging ' + a.meta.fileName : '')
|
||||||
+ ' onto ' + b.meta.fileName;
|
+ ' onto ' + b.meta.fileName;
|
||||||
@ -77,18 +80,15 @@ module.exports = function () {
|
|||||||
return fObj.gen.generate( rez, fOut, _opts.theme );
|
return fObj.gen.generate( rez, fOut, _opts.theme );
|
||||||
}
|
}
|
||||||
catch( ex ) {
|
catch( ex ) {
|
||||||
err( ex );
|
_err( ex );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handle an exception.
|
Handle an exception.
|
||||||
*/
|
*/
|
||||||
function err( ex ) {
|
function error( ex ) {
|
||||||
var msg = ex.toString();
|
throw ex;
|
||||||
var idx = msg.indexOf('Error: ');
|
|
||||||
var trimmed = idx === -1 ? msg : msg.substring( idx + 7 );
|
|
||||||
_log( 'ERROR: ' + trimmed.toString() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
25
src/index.js
25
src/index.js
@ -6,19 +6,32 @@ Command-line interface (CLI) for FluentCMD via Node.js.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var ARGS = require( 'minimist' )
|
var ARGS = require( 'minimist' )
|
||||||
, FCMD = require( './fluentcmd');
|
, FCMD = require( './fluentcmd')
|
||||||
|
, PKG = require('../package.json');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log( '*** FluentCMD v0.1.0 ***' );
|
console.log( '*** FluentCMD v' + PKG.version + ' ***' );
|
||||||
if( process.argv.length <= 2 ) { throw 'Please specify a JSON resume file.'; }
|
if( process.argv.length <= 2 ) { throw { fluenterror: 3 }; }
|
||||||
var args = ARGS( process.argv.slice(2) );
|
var args = ARGS( process.argv.slice(2) );
|
||||||
var src = args._.filter( function( a ) { return a.endsWith('.json'); });
|
var src = args._.filter( function( a ) { return a.match(/\.json$/); });
|
||||||
var dst = args._.filter( function( a ) { return !a.endsWith('.json'); });
|
var dst = args._.filter( function( a ) { return !a.match(/\.json$/); });
|
||||||
FCMD.generate( src, dst, args.t || 'informatic' );
|
FCMD.generate( src, dst, args.t || 'informatic' );
|
||||||
process.platform !== 'win32' && console.log('\n');
|
process.platform !== 'win32' && console.log('\n');
|
||||||
}
|
}
|
||||||
catch( ex ) {
|
catch( ex ) {
|
||||||
var msg = ex.toString();
|
|
||||||
|
var msg = '';
|
||||||
|
if( ex.fluenterror ){
|
||||||
|
switch( ex.fluenterror ) {
|
||||||
|
case 1: msg = "The specified theme couldn't be found: " + ex.data; break;
|
||||||
|
case 2: msg = "Couldn't copy CSS file to destination folder"; break;
|
||||||
|
case 3: msg = "Please specify a valid JSON resume file."; break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg = ex.toString();
|
||||||
|
}
|
||||||
|
|
||||||
var idx = msg.indexOf('Error: ');
|
var idx = msg.indexOf('Error: ');
|
||||||
var trimmed = idx === -1 ? msg : msg.substring( idx + 7 );
|
var trimmed = idx === -1 ? msg : msg.substring( idx + 7 );
|
||||||
console.log( 'ERROR: ' + trimmed.toString() );
|
console.log( 'ERROR: ' + trimmed.toString() );
|
||||||
|
Loading…
Reference in New Issue
Block a user