mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-22 16:30:11 +00:00
Scrub.
This commit is contained in:
parent
3e7d9c0411
commit
3c7868a750
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
Definition of the BaseGenerator class.
|
Definition of the BaseGenerator class.
|
||||||
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
|
|
||||||
@module base-generator.js
|
@module base-generator.js
|
||||||
|
@license MIT. See LICENSE.md for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
module.exports =
|
module.exports =
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Given a source JSON resume, a destination resume path, and a theme file,
|
Given a source resume in FRESH or JRS format, a destination resume path, and a
|
||||||
generate 0..N resumes in the desired formats.
|
theme file, generate 0..N resumes in the desired formats.
|
||||||
@param src Path to the source JSON resume file: "rez/resume.json".
|
@param src Path to the source JSON resume file: "rez/resume.json".
|
||||||
@param dst An array of paths to the target resume file(s).
|
@param dst An array of paths to the target resume file(s).
|
||||||
@param theme Friendly name of the resume theme. Defaults to "modern".
|
@param theme Friendly name of the resume theme. Defaults to "modern".
|
||||||
@ -52,7 +52,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the theme
|
// Load the theme
|
||||||
var theTheme = (new FluentTheme()).open( tFolder );
|
|
||||||
var theTheme = _opts.theme.startsWith('jsonresume-theme') ?
|
var theTheme = _opts.theme.startsWith('jsonresume-theme') ?
|
||||||
new JRSTheme().open(tFolder) : new FluentTheme().open( tFolder );
|
new JRSTheme().open(tFolder) : new FluentTheme().open( tFolder );
|
||||||
_opts.themeObj = theTheme;
|
_opts.themeObj = theTheme;
|
||||||
@ -118,8 +117,8 @@
|
|||||||
, fName = PATH.basename(f, '.' + fType)
|
, fName = PATH.basename(f, '.' + fType)
|
||||||
, theFormat;
|
, theFormat;
|
||||||
|
|
||||||
// If targInfo.fmt.files exists, this theme has an explicit "files"
|
// If targInfo.fmt.files exists, this format is backed by a document.
|
||||||
// section in its theme.json file.
|
// Fluent/FRESH themes are handled here.
|
||||||
if( targInfo.fmt.files && targInfo.fmt.files.length ) {
|
if( targInfo.fmt.files && targInfo.fmt.files.length ) {
|
||||||
|
|
||||||
_log( 'Generating '.useful +
|
_log( 'Generating '.useful +
|
||||||
@ -131,19 +130,22 @@
|
|||||||
MKDIRP.sync( PATH.dirname( f ) ); // Ensure dest folder exists;
|
MKDIRP.sync( PATH.dirname( f ) ); // Ensure dest folder exists;
|
||||||
theFormat.gen.generate( rez, f, _opts );
|
theFormat.gen.generate( rez, f, _opts );
|
||||||
}
|
}
|
||||||
// Otherwise the theme has no files section
|
|
||||||
|
// Otherwise this is either a) a JSON Resume theme or b) an ad-hoc format
|
||||||
|
// (JSON, YML, or PNG) that every theme gets "for free".
|
||||||
else {
|
else {
|
||||||
_log( 'Generating '.useful +
|
_log( 'Generating '.useful +
|
||||||
targInfo.fmt.outFormat.toUpperCase().useful.bold +
|
targInfo.fmt.outFormat.toUpperCase().useful.bold +
|
||||||
' resume: '.useful + PATH.relative(process.cwd(), f ).replace(/\\/g,'/').useful.bold);
|
' resume: '.useful + PATH.relative(process.cwd(), f ).replace(/\\/g,'/').useful.bold);
|
||||||
|
|
||||||
theFormat = _fmts.filter(
|
theFormat = _fmts.filter( function(fmt) {
|
||||||
function(fmt) { return fmt.name === targInfo.fmt.outFormat; })[0];
|
return fmt.name === targInfo.fmt.outFormat;
|
||||||
|
})[0];
|
||||||
|
|
||||||
var outFolder = PATH.dirname( f );
|
var outFolder = PATH.dirname( f );
|
||||||
MKDIRP.sync( outFolder ); // Ensure dest folder exists;
|
MKDIRP.sync( outFolder ); // Ensure dest folder exists;
|
||||||
|
|
||||||
// TODO: refactor
|
// JSON Resume themes have a 'render' method that needs to be called
|
||||||
if( theme.render ) {
|
if( theme.render ) {
|
||||||
var COPY = require('copy');
|
var COPY = require('copy');
|
||||||
var globs = [ /*'**',*/ '*.css', '*.js', '*.png', '*.jpg', '*.gif', '*.bmp' ];
|
var globs = [ /*'**',*/ '*.css', '*.js', '*.png', '*.jpg', '*.gif', '*.bmp' ];
|
||||||
@ -155,7 +157,7 @@
|
|||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
// Prevent JSON Resume theme .js from chattering
|
// Prevent JSON Resume theme .js from chattering (TODO: redirect IO)
|
||||||
var consoleLog = console.log;
|
var consoleLog = console.log;
|
||||||
console.log = function() { };
|
console.log = function() { };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user