mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-05 09:56:22 +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
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.js text eol=lf
|
||||
*.json text eol=lf
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "fluentcmd",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"description": "Generate beautiful, targeted resumes from your command line or shell.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -24,7 +24,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/fluentdesk/fluentcmd",
|
||||
"dependencies": {
|
||||
"fluentlib": "fluentdesk/fluentlib",
|
||||
"fluentlib": "fluentdesk/fluentlib#v0.1.0",
|
||||
"minimist": "^1.2.0",
|
||||
"underscore": "^1.8.3"
|
||||
}
|
||||
|
@ -9,9 +9,10 @@ module.exports = function () {
|
||||
var path = require( 'path' )
|
||||
, extend = require( './utils/extend' )
|
||||
, unused = require('./utils/string')
|
||||
, FLUENT = require('fluentlib')
|
||||
, fs = require('fs')
|
||||
, _ = require('underscore')
|
||||
, rez, _log;
|
||||
, FLUENT = require('fluentlib')
|
||||
, rez, _log, _err;
|
||||
|
||||
/**
|
||||
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 logger Optional logging override.
|
||||
*/
|
||||
function gen( src, dst, theme, logger ) {
|
||||
function gen( src, dst, theme, logger, errHandler ) {
|
||||
|
||||
_log = logger || console.log;
|
||||
_opts.theme = theme;
|
||||
var msg = '';
|
||||
_err = errHandler || error;
|
||||
_opts.theme = (theme && theme.toLowerCase().trim()) || 'informatic';
|
||||
|
||||
// Load input resumes...
|
||||
if(!src || !src.length) { throw { fluenterror: 3 }; }
|
||||
var sheets = src.map( function( res ) {
|
||||
_log( 'Reading JSON resume: ' + res );
|
||||
return (new FLUENT.Sheet()).open( res );
|
||||
});
|
||||
|
||||
// Merge input resumes...
|
||||
var msg = '';
|
||||
rez = _.reduceRight( sheets, function( a, b, idx ) {
|
||||
msg += ((idx == sheets.length - 2) ? 'Merging ' + a.meta.fileName : '')
|
||||
+ ' onto ' + b.meta.fileName;
|
||||
@ -77,18 +80,15 @@ module.exports = function () {
|
||||
return fObj.gen.generate( rez, fOut, _opts.theme );
|
||||
}
|
||||
catch( ex ) {
|
||||
err( ex );
|
||||
_err( ex );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Handle an exception.
|
||||
*/
|
||||
function err( ex ) {
|
||||
var msg = ex.toString();
|
||||
var idx = msg.indexOf('Error: ');
|
||||
var trimmed = idx === -1 ? msg : msg.substring( idx + 7 );
|
||||
_log( 'ERROR: ' + trimmed.toString() );
|
||||
function error( ex ) {
|
||||
throw ex;
|
||||
}
|
||||
|
||||
/**
|
||||
|
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' )
|
||||
, FCMD = require( './fluentcmd');
|
||||
, FCMD = require( './fluentcmd')
|
||||
, PKG = require('../package.json');
|
||||
|
||||
try {
|
||||
console.log( '*** FluentCMD v0.1.0 ***' );
|
||||
if( process.argv.length <= 2 ) { throw 'Please specify a JSON resume file.'; }
|
||||
console.log( '*** FluentCMD v' + PKG.version + ' ***' );
|
||||
if( process.argv.length <= 2 ) { throw { fluenterror: 3 }; }
|
||||
var args = ARGS( process.argv.slice(2) );
|
||||
var src = args._.filter( function( a ) { return a.endsWith('.json'); });
|
||||
var dst = 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.match(/\.json$/); });
|
||||
FCMD.generate( src, dst, args.t || 'informatic' );
|
||||
process.platform !== 'win32' && console.log('\n');
|
||||
}
|
||||
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 trimmed = idx === -1 ? msg : msg.substring( idx + 7 );
|
||||
console.log( 'ERROR: ' + trimmed.toString() );
|
||||
|
Loading…
Reference in New Issue
Block a user