forked from salomonelli/best-resume-ever
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6b33b6
commit 3d2d934
Showing
16 changed files
with
199 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ test/unit/coverage | |
test/e2e/reports | ||
selenium-debug.log | ||
firefox_root/ | ||
GeckoChildCrash* |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"url":"https://localhost:8080/#/resume-material-dark","delay":0,"selector":"","zoom-factor":1,"format":"pdf","quality":75,"user-agent":"","latency":null,"download":null,"upload":null,"css":"","js":"","debug":false,"root":"","pdf":{"pageSize":"A4","marginsType":1,"printBackground":true,"landscape":false},"size":{"width":2481,"height":3508},"out":"/home/s/workspace/pdf/resume-material-dark.pdf"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const path = require('path'); | ||
const Util = require('./Util'); | ||
const ResumeToPdf = { | ||
/** | ||
* generates electroshot command for screenshoting resume | ||
* @param {string} resume resume name in URL | ||
* @return {string} electroshot command | ||
*/ | ||
electroshotScript: resume => { | ||
const dir = path.join(__dirname, '../../pdf'); | ||
return 'electroshot localhost:8080/#/' + resume + | ||
' 2481x3508 --pdf-margin none --format pdf --out ' + dir + | ||
' --filename "' + resume + '.pdf" --pdf-background; '; | ||
}, | ||
/** | ||
* converts resumes to pdf | ||
* @return {Promise} | ||
*/ | ||
convert: async() => { | ||
const directories = Util.getResumesFromDirectories(); | ||
let script = ''; | ||
directories.forEach(resume => (script += ResumeToPdf.electroshotScript(resume.path))); | ||
script = script.substring(0, script.length - 2); | ||
await Util.execBash(script); | ||
} | ||
}; | ||
|
||
module.exports = ResumeToPdf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const request = require('request-promise'); | ||
|
||
const PORT = 8080; | ||
const Server = { | ||
/** | ||
* kills express app | ||
*/ | ||
kill: () => { | ||
request.get('https://localhost:' + PORT + '/kill') | ||
.catch(error => { | ||
if (error) return false; | ||
}); | ||
} | ||
}; | ||
module.exports = Server; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
const path = require('path'); | ||
const writeFile = require('write'); | ||
const fs = require('fs'); | ||
const exec = require('child_process').exec; | ||
|
||
const Util = { | ||
/** | ||
* gets directories starting with 'resume-' | ||
* @return {[]} | ||
*/ | ||
getDirectories: () => { | ||
const srcpath = path.join(__dirname, '../src/components'); | ||
return fs.readdirSync(srcpath) | ||
.filter(file => file.includes('resume-')); | ||
}, | ||
/** | ||
* gets resumes names and paths from directories | ||
* @return {Object[]} array with resumes object {path: '', name: ''} | ||
*/ | ||
getResumesFromDirectories: () => { | ||
const directories = Util.getDirectories(); | ||
return directories | ||
.filter(dir => dir.includes('resume-') && dir !== 'resume-XX') | ||
.map(dir => { | ||
let name = dir.replace('resume-', ''); | ||
return { | ||
path: dir.replace('.vue', ''), | ||
name: name.replace('-', ' ') | ||
}; | ||
}); | ||
}, | ||
/** | ||
* setTimeout as Promise | ||
* @param {number} time time in ms | ||
* @return {Promise} | ||
*/ | ||
setTimeout: time => { | ||
return new Promise(resolve => setTimeout(resolve, time)); | ||
}, | ||
/** | ||
* reads file of content | ||
* @param {string} dir directory | ||
* @return {Promise} | ||
*/ | ||
readFileContent: dir => { | ||
return new Promise((resolve, reject) => { | ||
fs.readFile(dir, 'utf8', (err, template) => { | ||
if (err) reject(err); | ||
else resolve(template); | ||
}); | ||
}); | ||
}, | ||
/** | ||
* writes content to given file | ||
* @param {string} dir directory | ||
* @param {string} content content of file | ||
* @return {Promise} | ||
*/ | ||
writeFile: async (dir, content) => { | ||
return new Promise((resolve, reject) => { | ||
writeFile(dir, content, (err) => { | ||
if (err) reject(err); | ||
resolve(); | ||
}); | ||
}); | ||
}, | ||
/** | ||
* executes command | ||
* @param {string} script e.g. 'echo "Hello World"' | ||
* @return {Promise} | ||
*/ | ||
execBash: script => { | ||
return new Promise((resolve, reject) => { | ||
exec(script, | ||
error => { | ||
if (error) reject(error); | ||
else resolve(); | ||
}); | ||
}); | ||
} | ||
}; | ||
|
||
module.exports = Util; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const ResumeToPdf = require('./ResumeToPdf'); | ||
ResumeToPdf.convert(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
module.exports = function(grunt) { | ||
grunt.loadNpmTasks('grunt-exec'); | ||
require('load-grunt-tasks')(grunt); | ||
grunt.initConfig({ | ||
babel: { | ||
options: { | ||
sourceMap: true, | ||
presets: ['es2015'] | ||
}, | ||
dist: { | ||
files: { | ||
'public/js/gen/javascript.js': 'public/js/javascript.js' | ||
} | ||
} | ||
}, | ||
exec: { | ||
less: 'node --harmony-async-await src/app.js less', | ||
pdf: 'node --harmony-async-await src/app.js pdf' | ||
module.exports = function (grunt) { | ||
grunt.loadNpmTasks('grunt-exec'); | ||
require('load-grunt-tasks')(grunt); | ||
grunt.initConfig({ | ||
babel: { | ||
options: { | ||
sourceMap: true, | ||
presets: ['es2015'] | ||
}, | ||
dist: { | ||
files: { | ||
'public/js/gen/javascript.js': 'public/js/javascript.js' | ||
} | ||
}); | ||
} | ||
}, | ||
exec: { | ||
less: 'node --harmony-async-await src/app.js less', | ||
pdf: 'node --harmony-async-await src/app.js pdf' | ||
} | ||
}); | ||
|
||
grunt.registerTask('default', ['babel', 'exec:less', 'exec:pdf']); | ||
grunt.registerTask('default', ['babel', 'exec:less', 'exec:pdf']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,7 @@ new Vue({ | |
el: '#app', | ||
router, | ||
template: '<App/>', | ||
components: { App } | ||
components: { | ||
App | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters