From fced92a5a0543bf689640f3d5dd06df2c44b8117 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Tue, 22 Dec 2015 18:47:23 -0500 Subject: [PATCH 01/10] Bump version to 1.3.0. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d3e0751..acda9c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hackmyresume", - "version": "1.2.0", + "version": "1.3.0", "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": { "type": "git", From dd61b5360a35abc097163c6a0a85167a68165abb Mon Sep 17 00:00:00 2001 From: hacksalot Date: Tue, 22 Dec 2015 18:49:11 -0500 Subject: [PATCH 02/10] Update package.json contact info. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index acda9c0..7a2d4f4 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "Underscore", "template" ], - "author": "hacksalot (https://github.com/hacksalot)", + "author": "hacksalot (https://github.com/hacksalot)", "license": "MIT", "preferGlobal": "true", "bugs": { From dab6ebfd8291de9629134d4f1f24b1615249fa82 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Tue, 22 Dec 2015 18:49:29 -0500 Subject: [PATCH 03/10] Bump fluent-themes version to 0.8.0-beta. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a2d4f4..112ad01 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "homepage": "https://github.com/hacksalot/HackMyResume", "dependencies": { "colors": "^1.1.2", - "fluent-themes": "~0.7.0-beta", + "fluent-themes": "~0.8.0-beta", "fresca": "~0.2.2", "fs-extra": "^0.24.0", "handlebars": "^4.0.5", From ebad1677bc5670733e4f80a63b372609e9bc3f18 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Tue, 22 Dec 2015 18:55:17 -0500 Subject: [PATCH 04/10] Replace file-exists.js with NPM path-exists. --- package.json | 1 + src/gen/template-generator.js | 2 +- src/utils/file-exists.js | 19 ------------------- src/verbs/generate.js | 2 +- 4 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 src/utils/file-exists.js diff --git a/package.json b/package.json index 112ad01..47f6f2e 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "minimist": "^1.2.0", "mkdirp": "^0.5.1", "moment": "^2.10.6", + "path-exists": "^2.1.0", "recursive-readdir-sync": "^1.0.6", "simple-html-tokenizer": "^0.2.0", "underscore": "^1.8.3", diff --git a/src/gen/template-generator.js b/src/gen/template-generator.js index e12eef0..4510ade 100644 --- a/src/gen/template-generator.js +++ b/src/gen/template-generator.js @@ -224,7 +224,7 @@ Definition of the TemplateGenerator class. PATH.parse( require.resolve('fluent-themes') ).dir, this.opts.theme ); - var exists = require('../utils/file-exists'); + var exists = require('path-exists').sync; if( !exists( tFolder ) ) { tFolder = PATH.resolve( this.opts.theme ); if( !exists( tFolder ) ) { diff --git a/src/utils/file-exists.js b/src/utils/file-exists.js deleted file mode 100644 index ef99ef9..0000000 --- a/src/utils/file-exists.js +++ /dev/null @@ -1,19 +0,0 @@ -/** -Definition of the `fileExists` method. -@license MIT. Copyright (c) 2015 James Devlin / FluentDesk. -@module file-exists.js -*/ - -var FS = require('fs'); - -// Yup, this is now the recommended way to check for file existence on Node. -// fs.exists is deprecated and the recommended fs.statSync/lstatSync throws -// exceptions on non-existent paths :) -module.exports = function (path) { - try { - FS.statSync( path ); - return true; - } catch( err ) { - return !(err && err.code === 'ENOENT'); - } -}; diff --git a/src/verbs/generate.js b/src/verbs/generate.js index 4fa10ff..88857c8 100644 --- a/src/verbs/generate.js +++ b/src/verbs/generate.js @@ -51,7 +51,7 @@ // Verify the specified theme name/path var relativeThemeFolder = '../../node_modules/fluent-themes/themes'; var tFolder = PATH.resolve( __dirname, relativeThemeFolder, _opts.theme); - var exists = require('../utils/file-exists'); + var exists = require('path-exists').sync; if (!exists( tFolder )) { tFolder = PATH.resolve( _opts.theme ); if (!exists( tFolder )) { From e2589b37307c16991a79ac0c89dab5632d396403 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Thu, 24 Dec 2015 03:23:56 -0500 Subject: [PATCH 05/10] Fix validate command error. Still hitting some inconsistent behavior in different NPM versions/platforms with invalid uppercase dependency names per https://github.com/npm/npm/issues/3692. Partial fix for #33. --- src/core/fresh-resume.js | 2 +- src/verbs/validate.js | 2 +- tests/test-fresh-sheet.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/fresh-resume.js b/src/core/fresh-resume.js index 261b1a8..68641f9 100644 --- a/src/core/fresh-resume.js +++ b/src/core/fresh-resume.js @@ -299,7 +299,7 @@ Definition of the FRESHResume class. Validate the sheet against the FRESH Resume schema. */ FreshResume.prototype.isValid = function( info ) { - var schemaObj = require('FRESCA'); + var schemaObj = require('fresca'); var validator = require('is-my-json-valid'); var validate = validator( schemaObj, { // Note [1] formats: { date: /^\d{4}(?:-(?:0[0-9]{1}|1[0-2]{1})(?:-[0-9]{2})?)?$/ } diff --git a/src/verbs/validate.js b/src/verbs/validate.js index f5fb3be..52bd6da 100644 --- a/src/verbs/validate.js +++ b/src/verbs/validate.js @@ -15,7 +15,7 @@ var validator = require('is-my-json-valid'); var schemas = { - fresh: require('FRESCA'), + fresh: require('fresca'), jars: require('../core/resume.json') }; diff --git a/tests/test-fresh-sheet.js b/tests/test-fresh-sheet.js index 955c924..f35487d 100644 --- a/tests/test-fresh-sheet.js +++ b/tests/test-fresh-sheet.js @@ -55,7 +55,7 @@ describe('jane-doe.json (FRESH)', function () { it('should validate against the FRESH resume schema', function() { var result = _sheet.isValid(); - // var schemaJson = require('FRESCA'); + // var schemaJson = require('fresca'); // var validate = validator( schemaJson, { verbose: true } ); // var result = validate( JSON.parse( _sheet.imp.raw ) ); result || console.log("\n\nOops, resume didn't validate. " + From ef2fe95bd8e02995ca9d3824c57c4ec22b2ae7c2 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Thu, 24 Dec 2015 04:04:44 -0500 Subject: [PATCH 06/10] Remove unused method. --- src/core/fresh-resume.js | 9 --------- src/core/jrs-resume.js | 9 --------- 2 files changed, 18 deletions(-) diff --git a/src/core/fresh-resume.js b/src/core/fresh-resume.js index 68641f9..1759994 100644 --- a/src/core/fresh-resume.js +++ b/src/core/fresh-resume.js @@ -187,15 +187,6 @@ Definition of the FRESHResume class. return flatSkills; }, - /** - Update the sheet's raw data. TODO: remove/refactor - */ - FreshResume.prototype.updateData = function( str ) { - this.clear( false ); - this.parse( str ); - return this; - }; - /** Reset the sheet to an empty state. */ diff --git a/src/core/jrs-resume.js b/src/core/jrs-resume.js index 9a5bbdd..c9311a0 100644 --- a/src/core/jrs-resume.js +++ b/src/core/jrs-resume.js @@ -107,15 +107,6 @@ Definition of the JRSResume class. return flatSkills; }; - /** - Update the sheet's raw data. TODO: remove/refactor - */ - JRSResume.prototype.updateData = function( str ) { - this.clear( false ); - this.parse( str ); - return this; - }; - /** Reset the sheet to an empty state. */ From c74eda90ed933c14228e99c0a49c7bfdc1f354f0 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Thu, 24 Dec 2015 04:05:17 -0500 Subject: [PATCH 07/10] Introduce lodash dependency. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 47f6f2e..c5d563e 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "html": "0.0.10", "is-my-json-valid": "^2.12.2", "jst": "0.0.13", + "lodash": "^3.10.1", "marked": "^0.3.5", "minimist": "^1.2.0", "mkdirp": "^0.5.1", From c5ee1ee33c49fbb01777ec503e3df13c686b83d0 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Thu, 24 Dec 2015 04:05:56 -0500 Subject: [PATCH 08/10] Quick fix for ".history" errors. Affects #31 and #33. --- src/core/fresh-resume.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/fresh-resume.js b/src/core/fresh-resume.js index 1759994..4754194 100644 --- a/src/core/fresh-resume.js +++ b/src/core/fresh-resume.js @@ -10,6 +10,7 @@ Definition of the FRESHResume class. , extend = require('../utils/extend') , validator = require('is-my-json-valid') , _ = require('underscore') + , __ = require('lodash') , PATH = require('path') , moment = require('moment') , MD = require('marked') @@ -312,7 +313,8 @@ Definition of the FRESHResume class. sheets that have overlapping jobs. */ FreshResume.prototype.duration = function() { - if( this.employment.history && this.employment.history.length ) { + var empHist = __.get(this, 'employment.history'); + if( empHist && empHist.length ) { var firstJob = _.last( this.employment.history ); var careerStart = firstJob.start ? firstJob.safe.start : ''; if ((typeof careerStart === 'string' || careerStart instanceof String) && @@ -332,9 +334,9 @@ Definition of the FRESHResume class. */ FreshResume.prototype.sort = function( ) { - this.employment.history && this.employment.history.sort( byDateDesc ); - this.education.history && this.education.history.sort( byDateDesc ); - this.service.history && this.service.history.sort( byDateDesc ); + __.get(this, 'employment.history') && this.employment.history.sort( byDateDesc ); + __.get(this, 'education.history') && this.education.history.sort( byDateDesc ); + __.get(this, 'service.history') && this.service.history.sort( byDateDesc ); // this.awards && this.awards.sort( function(a, b) { // return( a.safeDate.isBefore(b.safeDate) ) ? 1 From bbac1fdceb62e2b19c0add0f21e847225910a386 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Thu, 24 Dec 2015 06:08:45 -0500 Subject: [PATCH 09/10] Improve test coverage around incomplete JRS resumes. Add quick sanity checks around incomplete or irregular JRS-format resumes. Also decorate existing JRS test resumes (/tests/resumes/) with current 0.0.0 JRS version ahead of 1.0.0 release. --- tests/resumes/jrs-0.0.0/empty.json | 91 +++++++++++++++ tests/resumes/jrs-0.0.0/jane-incomplete.json | 104 ++++++++++++++++++ .../jane-q-fullstacker.json | 0 .../{jrs => jrs-0.0.0}/richard-hendriks.json | 0 tests/test-converter.js | 2 +- tests/test-jrs-sheet.js | 46 ++++---- 6 files changed, 222 insertions(+), 21 deletions(-) create mode 100644 tests/resumes/jrs-0.0.0/empty.json create mode 100644 tests/resumes/jrs-0.0.0/jane-incomplete.json rename tests/resumes/{jrs => jrs-0.0.0}/jane-q-fullstacker.json (100%) rename tests/resumes/{jrs => jrs-0.0.0}/richard-hendriks.json (100%) diff --git a/tests/resumes/jrs-0.0.0/empty.json b/tests/resumes/jrs-0.0.0/empty.json new file mode 100644 index 0000000..120d0c2 --- /dev/null +++ b/tests/resumes/jrs-0.0.0/empty.json @@ -0,0 +1,91 @@ +{ + "basics": { + "name": "", + "label": "", + "picture": "", + "email": "", + "phone": "", + "degree": "", + "website": "", + "summary": "", + "location": { + "address": "", + "postalCode": "", + "city": "", + "countryCode": "", + "region": "" + }, + "profiles": [ + { + "network": "", + "username": "", + "url": "" + } + ] + }, + "work": [ + { + "company": "", + "position": "", + "website": "", + "startDate": "", + "endDate": "", + "summary": "", + "highlights": [ + "" + ] + } + ], + "awards": [ + { + "title": "", + "date": "", + "awarder": "", + "summary": "" + } + ], + "education": [ + { + "institution": "", + "area": "", + "studyType": "", + "startDate": "", + "endDate": "", + "gpa": "", + "courses": [ + "" + ] + } + ], + "publications": [ + { + "name": "", + "publisher": "", + "releaseDate": "", + "website": "", + "summary": "" + } + ], + "volunteer": [ + { + "organization": "", + "position": "", + "website": "", + "startDate": "", + "endDate": "", + "summary": "", + "highlights": [ + "" + ] + } + ], + "skills": [ + { + "name": "", + "level": "", + "keywords": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/tests/resumes/jrs-0.0.0/jane-incomplete.json b/tests/resumes/jrs-0.0.0/jane-incomplete.json new file mode 100644 index 0000000..3aa670d --- /dev/null +++ b/tests/resumes/jrs-0.0.0/jane-incomplete.json @@ -0,0 +1,104 @@ +{ + "basics": { + "name": "Jane Q. Fullstacker" + }, + "education": [ + { + "gpa": "3.5", + "courses": [ + "Course 1", + "Course 2", + "Course 2" + ], + "startDate": "2005-09", + "endDate": "2008-05" + }, + { + "institution": "Medfield College", + "gpa": "3.2", + "courses": [ + "Course 1", + "Course 2", + "Course 2" + ], + "startDate": "2003-09", + "endDate": "2005-06" + } + ], + "skills": [ + { + "name": "Web Dev", + "keywords": [ + "JavaScript", + "HTML 5", + "CSS", + "LAMP", + "MVC", + "REST" + ] + }, + { + "name": "JavaScript" + } + ], + "volunteer": [], + "publications": [ + { + "name": "Building User Interfaces with Electron and Atom", + "releaseDate": "2011", + "website": "http://codeproject.com/build-ui-electron-atom.aspx" + }, + { + "name": "Jane Fullstacker's Blog", + "publisher": "self", + "releaseDate": "2011", + "website": "http://janef.me" + }, + { + "name": "Teach Yourself GORFF in 21 Days", + "publisher": "Amazon" + } + ], + "interests": [ + { + "name": "reading", + "summary": "Jane is a fan of mystery novels and courtroom dramas including Agatha Christie and John Grisham.", + "keywords": [ + "mystery", + "Agatha Christie", + "John Grisham" + ] + }, + { + "name": "hiking", + "summary": "Jane enjoys hiking, light mountain climbing, and has four summits under her belt!" + }, + { + "name": "yoga" + } + ], + "references": [ + { + "name": "John Davidson", + "reference": "Jane is awesome! I'd hire her again in a heartbeat." + }, + { + "name": "Elias Fullstacker", + "reference": "I worked with Jane on Jabberwocky and can vouch for her awesome technical capabilities and attention to detail. Insta-hire." + }, + { + "name": "Dana Nevins", + "reference": "I've known Jane personally and professionally for almost ten years. She is one in a million." + } + ], + "languages": [ + { + "language": "English", + "level": "Native" + }, + { + "language": "Spanish", + "level": "Moderate" + } + ] +} diff --git a/tests/resumes/jrs/jane-q-fullstacker.json b/tests/resumes/jrs-0.0.0/jane-q-fullstacker.json similarity index 100% rename from tests/resumes/jrs/jane-q-fullstacker.json rename to tests/resumes/jrs-0.0.0/jane-q-fullstacker.json diff --git a/tests/resumes/jrs/richard-hendriks.json b/tests/resumes/jrs-0.0.0/richard-hendriks.json similarity index 100% rename from tests/resumes/jrs/richard-hendriks.json rename to tests/resumes/jrs-0.0.0/richard-hendriks.json diff --git a/tests/test-converter.js b/tests/test-converter.js index d66368e..c3cfb23 100644 --- a/tests/test-converter.js +++ b/tests/test-converter.js @@ -18,7 +18,7 @@ describe('FRESH/JRS converter', function () { it('should round-trip from JRS to FRESH to JRS without modifying or losing data', function () { - var fileA = path.join( __dirname, 'resumes/jrs/richard-hendriks.json' ); + var fileA = path.join( __dirname, 'resumes/jrs-0.0.0/richard-hendriks.json' ); var fileB = path.join( __dirname, 'sandbox/richard-hendriks.json' ); _sheet = new FRESHResume().open( fileA ); diff --git a/tests/test-jrs-sheet.js b/tests/test-jrs-sheet.js index ee4b1b1..acd6f2e 100644 --- a/tests/test-jrs-sheet.js +++ b/tests/test-jrs-sheet.js @@ -9,55 +9,61 @@ var chai = require('chai') chai.config.includeStack = false; -describe('jane-doe.json (JRS)', function () { +function testResume( opts ) { + + describe( opts.title + ' (JRS)', function() { + + opts.isValid = opts.isValid !== false; var _sheet; - it('should open without throwing an exception', function () { + it('should open without throwing an exception', function () { + var that = this; function tryOpen() { _sheet = new JRSResume().open( - path.join( __dirname, 'resumes/jrs/jane-q-fullstacker.json' ) ); + path.join( __dirname, 'resumes/jrs-0.0.0/' + opts.title + '.json' ) ); } tryOpen.should.not.Throw(); }); it('should have one or more of each section', function() { - expect( - (_sheet.basics) && - (_sheet.work && _sheet.work.length > 0) && - (_sheet.skills && _sheet.skills.length > 0) && - (_sheet.education && _sheet.education.length > 0) && - (_sheet.volunteer && _sheet.volunteer.length > 0) && - (_sheet.publications && _sheet.publications.length > 0) && - (_sheet.awards && _sheet.awards.length > 0) - ).to.equal( true ); + var newObj = _.pick( _sheet, opts.sections ); + expect( Object.keys(newObj).length ).to.equal( opts.sections.length ); }); - it('should have a work duration of 7 years', function() { - _sheet.basics.computed.numYears.should.equal( 7 ); + it('should have a work duration of ' + opts.duration + ' years', function() { + _sheet.basics.computed.numYears.should.equal( opts.duration ); }); - it('should save without throwing an exception', function(){ + it('should save without throwing an exception', function() { + var that = this; function trySave() { - _sheet.save( 'tests/sandbox/jane-q-fullstacker.json' ); + _sheet.save( 'tests/sandbox/' + opts.title + '.json' ); } trySave.should.not.Throw(); }); it('should not be modified after saving', function() { - var savedSheet = new JRSResume().open( 'tests/sandbox/jane-q-fullstacker.json' ); + var savedSheet = new JRSResume().open( 'tests/sandbox/' + opts.title + '.json' ); _sheet.stringify().should.equal( savedSheet.stringify() ) }); - it('should validate against the JSON Resume schema', function() { + it('should ' + (opts.isValid ? '' : 'NOT ') + 'validate against the JSON Resume schema', function() { var result = _sheet.isValid(); // var schemaJson = require('../src/core/resume.json'); // var validate = validator( schemaJson, { verbose: true } ); // var result = validate( JSON.parse( _sheet.imp.raw ) ); result || console.log("\n\nOops, resume didn't validate. " + "Validation errors:\n\n", _sheet.basics.imp.validationErrors, "\n\n"); - result.should.equal( true ); + result.should.equal( opts.isValid ); }); + }); +} -}); +var sects = [ 'basics', 'work', 'volunteer', 'skills', 'education', 'publications', 'awards', 'references' ]; + +testResume({ title: 'jane-q-fullstacker', duration: 7, sections: sects }); +testResume({ title: 'jane-incomplete', duration: 0, sections: _.without(sects, 'awards', 'work') }); +testResume({ title: 'richard-hendriks', duration: 1, sections: sects }); +testResume({ title: 'empty', duration: 0, sections: [], isValid: false }); From bf84341acfef39ee4babaf7e1cfe97820259cd45 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Thu, 24 Dec 2015 07:42:07 -0500 Subject: [PATCH 10/10] Version -> 1.2.1 Holding off on 1.3.0 pending HTTP/HTTPS support. #rebase #semver --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c5d563e..76b42a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hackmyresume", - "version": "1.3.0", + "version": "1.2.1", "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": { "type": "git", @@ -37,7 +37,7 @@ "homepage": "https://github.com/hacksalot/HackMyResume", "dependencies": { "colors": "^1.1.2", - "fluent-themes": "~0.8.0-beta", + "fluent-themes": "~0.7.1-beta", "fresca": "~0.2.2", "fs-extra": "^0.24.0", "handlebars": "^4.0.5",