1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-05 09:56:22 +00:00

Support NEW command.

This commit is contained in:
devlinjd 2015-12-02 14:56:36 -05:00
parent 2431ae4d89
commit 5b3a25c461
8 changed files with 227 additions and 20 deletions

View File

@ -52,6 +52,15 @@ it when you need to submit, upload, print, or email resumes in specific formats.
fluentcv BUILD r1.json r2.json TO out/rez.html out/rez.md foo/rez.all fluentcv BUILD r1.json r2.json TO out/rez.html out/rez.md foo/rez.all
``` ```
- `new` creates a new resume in FRESH or JSON Resume format.
```bash
# fluentcv NEW <OUTPUTS> [-f <FORMAT>]
fluentcv NEW resume.json
fluentcv NEW resume.json -f fresh
fluentcv NEW r1.json r2.json -f jrs
```
- `convert` converts your source resume between FRESH and JSON Resume formats. - `convert` converts your source resume between FRESH and JSON Resume formats.
Use it to convert between the two formats to take advantage of tools and services. Use it to convert between the two formats to take advantage of tools and services.

182
src/core/empty-fresh.json Normal file
View File

@ -0,0 +1,182 @@
{
"name": "",
"meta": {
"format": "FRESH@0.1.0",
"version": "0.1.0"
},
"info": {
"label": "",
"characterClass": "",
"brief": "",
"image": ""
},
"contact": {
"website": "",
"phone": "",
"email": "",
"other": []
},
"location": {
"address": "",
"city": "",
"region": "",
"code": "",
"country": ""
},
"social": [
{
"label": "",
"network": "",
"user": "",
"url": ""
}
],
"employment": {
"summary": "",
"history": [
{
"employer": "",
"url": "",
"position": "",
"summary": "",
"start": "",
"keywords": [],
"highlights": []
}
]
},
"education": {
"summary": "",
"level": "",
"degree": "",
"history": [
{
"institution": "",
"url": "",
"start": "",
"end": "",
"grade": "",
"summary": "",
"curriculum": []
}
]
},
"service": {
"summary": "",
"history": [
{
"flavor": "",
"position": "",
"organization": "",
"url": "",
"start": "",
"end": "",
"summary": "",
"highlights": []
}
]
},
"skills": {
"sets": [
{
"name": "",
"skills": []
}
],
"list": [ ]
},
"samples": [
{
"title": "",
"summary": "",
"url": "",
"date": ""
}
],
"writing": [
{
"title": "",
"flavor": "",
"date": "",
"publisher": {
"name": "",
"url": ""
},
"url": ""
}
],
"reading": [
{
"title": "",
"flavor": "",
"url": "",
"author": ""
}
],
"recognition": [
{
"flavor": "",
"from": "",
"title": "",
"event": "",
"date": "",
"summary": ""
}
],
"references": [
{
"name": "",
"flavor": "",
"private": true,
"contact": [
{
"label": "",
"flavor": "",
"value": ""
}
]
}
],
"testimonials": [
{
"name": "",
"flavor": "",
"quote": ""
}
],
"languages": [
{
"language": "",
"level": "",
"years": 0
}
],
"interests": [
{
"name": "",
"summary": "",
"keywords": []
}
]
}

View File

@ -143,9 +143,10 @@ Definition of the FRESHResume class.
delete this.employment; delete this.employment;
delete this.service; delete this.service;
delete this.education; delete this.education;
//delete this.awards; delete this.recognition;
delete this.publications; delete this.reading;
//delete this.interests; delete this.writing;
delete this.interests;
delete this.skills; delete this.skills;
delete this.social; delete this.social;
}; };
@ -154,7 +155,7 @@ Definition of the FRESHResume class.
Get the default (empty) sheet. Get the default (empty) sheet.
*/ */
FreshResume.default = function() { FreshResume.default = function() {
return new FreshResume().open( PATH.join( __dirname, 'empty.json'), 'Empty' ); return new FreshResume().open( PATH.join( __dirname, 'empty-fresh.json'), 'Empty' );
} }
/** /**
@ -243,7 +244,7 @@ Definition of the FRESHResume class.
// return( a.safeDate.isBefore(b.safeDate) ) ? 1 // return( a.safeDate.isBefore(b.safeDate) ) ? 1
// : ( a.safeDate.isAfter(b.safeDate) && -1 ) || 0; // : ( a.safeDate.isAfter(b.safeDate) && -1 ) || 0;
// }); // });
this.publications && this.publications.sort( function(a, b) { this.writing && this.writing.sort( function(a, b) {
return( a.safe.date.isBefore(b.safe.date) ) ? 1 return( a.safe.date.isBefore(b.safe.date) ) ? 1
: ( a.safe.date.isAfter(b.safe.date) && -1 ) || 0; : ( a.safe.date.isAfter(b.safe.date) && -1 ) || 0;
}); });

View File

@ -50,7 +50,7 @@ Definition of the JRSResume class.
*/ */
JRSResume.prototype.stringify = function() { JRSResume.prototype.stringify = function() {
function replacer( key,value ) { // Exclude these keys from stringification function replacer( key,value ) { // Exclude these keys from stringification
return _.some(['meta', 'warnings', 'computed', 'filt', 'ctrl', 'index', return _.some(['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index',
'safeStartDate', 'safeEndDate', 'safeDate', 'safeReleaseDate', 'result', 'safeStartDate', 'safeEndDate', 'safeDate', 'safeReleaseDate', 'result',
'isModified', 'htmlPreview', 'display_progress_bar'], 'isModified', 'htmlPreview', 'display_progress_bar'],
function( val ) { return key.trim() === val; } function( val ) { return key.trim() === val; }
@ -126,7 +126,7 @@ Definition of the JRSResume class.
Get the default (empty) sheet. Get the default (empty) sheet.
*/ */
JRSResume.default = function() { JRSResume.default = function() {
return new JRSResume().open( PATH.join( __dirname, 'empty.json'), 'Empty' ); return new JRSResume().open( PATH.join( __dirname, 'empty-jrs.json'), 'Empty' );
} }
/** /**

View File

@ -104,7 +104,7 @@ module.exports = function () {
var theFormat = _fmts.filter( var theFormat = _fmts.filter(
function( fmt ) { return fmt.name === fi.fmt.pre; })[0]; function( fmt ) { return fmt.name === fi.fmt.pre; })[0];
MKDIRP.sync( path.dirname(fOut) ); // Ensure dest folder exists; MKDIRP.sync( path.dirname( fOut ) ); // Ensure dest folder exists;
theFormat.gen.generate( rez, fOut, _opts ); theFormat.gen.generate( rez, fOut, _opts );
} }
catch( ex ) { catch( ex ) {
@ -227,6 +227,20 @@ module.exports = function () {
}); });
} }
/**
Create a new empty resume in either FRESH or JRS format.
*/
function create( src, dst, opts, logger ) {
_log = logger || console.log;
dst = src || ['resume.json'];
dst.forEach( function( t ) {
var safeFormat = opts.format.toUpperCase();
_log('Creating '.useful +safeFormat.useful.bold+ ' resume: '.useful + t.useful.bold);
MKDIRP.sync( path.dirname( t ) ); // Ensure dest folder exists;
FLUENT[ safeFormat + 'Resume' ].default().save( t );
});
}
/** /**
Display help documentation. Display help documentation.
*/ */
@ -275,6 +289,7 @@ module.exports = function () {
build: generate, build: generate,
validate: validate, validate: validate,
convert: convert, convert: convert,
new: create,
help: help help: help
}, },
lib: require('./fluentlib'), lib: require('./fluentlib'),

View File

@ -59,17 +59,14 @@ function main() {
var splitAt = _.indexOf( params, 'to' ); var splitAt = _.indexOf( params, 'to' );
if( splitAt === a._.length - 1 ) { if( splitAt === a._.length - 1 ) {
// 'TO' cannot be the last argument // 'TO' cannot be the last argument
logMsg('Please '.warn + 'specify an output file'.warnBold + logMsg('Please '.warn + 'specify an output file'.warn.bold +
' for this operation or '.warn + 'omit the TO keyword'.warnBold + '.'.warn ); ' for this operation or '.warn + 'omit the TO keyword'.warn.bold +
'.'.warn );
return; return;
} }
var src = a._.slice(1, splitAt === -1 ? undefined : splitAt ); var src = a._.slice(1, splitAt === -1 ? undefined : splitAt );
var dst = splitAt === -1 ? [] : a._.slice( splitAt + 1 ); var dst = splitAt === -1 ? [] : a._.slice( splitAt + 1 );
// Preload our params array
//var dst = (a.o && ((typeof a.o === 'string' && [ a.o ]) || a.o)) || [];
//dst = (dst === true) ? [] : dst; // Handle -o with missing output file
var parms = [ src, dst, opts, logMsg ]; var parms = [ src, dst, opts, logMsg ];
// Invoke the action // Invoke the action
@ -86,6 +83,7 @@ function getOpts( args ) {
noPretty = noPretty && (noPretty === true || noPretty === 'true'); noPretty = noPretty && (noPretty === true || noPretty === 'true');
return { return {
theme: args.t || 'modern', theme: args.t || 'modern',
format: args.f || 'FRESH',
prettify: !noPretty, prettify: !noPretty,
silent: args.s || args.silent silent: args.s || args.silent
}; };
@ -105,7 +103,7 @@ function handleError( ex ) {
Object.keys( FCMD.verbs ).map( function(v, idx, ar) { Object.keys( FCMD.verbs ).map( function(v, idx, ar) {
return (idx === ar.length - 1 ? 'or '.guide : '') return (idx === ar.length - 1 ? 'or '.guide : '')
+ v.toUpperCase().guide; + v.toUpperCase().guide;
}).join(', '.guide) + ") to get started.\n\n".guide + FS.readFileSync( PATH.join(__dirname, 'use.txt'), 'utf8' ).info.bold; }).join(', '.guide) + ").\n\n".guide + FS.readFileSync( PATH.join(__dirname, 'use.txt'), 'utf8' ).info.bold;
break; break;
//case 4: msg = title + '\n' + ; break; //case 4: msg = title + '\n' + ; break;
case 5: msg = 'Please '.guide + 'specify the output resume file'.guide.bold + ' that should be created in the new format.'.guide; break; case 5: msg = 'Please '.guide + 'specify the output resume file'.guide.bold + ' that should be created in the new format.'.guide; break;

View File

@ -2,21 +2,23 @@ Usage:
fluentcv <COMMAND> <SOURCES> [TO <TARGETS>] [-t <THEME>] fluentcv <COMMAND> <SOURCES> [TO <TARGETS>] [-t <THEME>]
<COMMAND> should be BUILD, CONVERT, VALIDATE, or HELP. <SOURCES> should <COMMAND> should be BUILD, NEW, CONVERT, VALIDATE, or HELP. <SOURCES> should
be the path to one or more FRESH or JSON Resume format resumes. <TARGETS> be the path to one or more FRESH or JSON Resume format resumes. <TARGETS>
should be the name of the destination resume to be created, if any. The should be the name of the destination resume to be created, if any. The
<THEME> parameter should be the name of a predefined theme (for example: <THEME> parameter should be the name of a predefined theme (for example:
COMPACT, MINIMIST, MODERN, or HELLO-WORLD) or the relative path to a COMPACT, MINIMIST, MODERN, or HELLO-WORLD) or the relative path to a custom
custom theme. theme.
fluentcv BUILD resume.json TO out/resume.all fluentcv BUILD resume.json TO out/resume.all
fluentcv NEW resume.json
fluentcv CONVERT resume.json TO resume-jrs.json fluentcv CONVERT resume.json TO resume-jrs.json
fluentcv VALIDATE resume.json fluentcv VALIDATE resume.json
Both SOURCES and TARGETS can accept multiple files: Both SOURCES and TARGETS can accept multiple files:
fluentCV BUILD r1.json r2.json TO out/resume.all out2/resume.html fluentCV BUILD r1.json r2.json TO out/resume.all out2/resume.html
fluentCV NEW r1.json r2.json r3.json
fluentCV VALIDATE resume.json resume2.json resume3.json fluentCV VALIDATE resume.json resume2.json resume3.json
See https://github.com/fluentdesk/fluentCV/blob/master/README.md See https://github.com/fluentdesk/fluentCV/blob/master/README.md for more
for more information. information.