mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-12 00:27:08 +01:00
Compare commits
397 Commits
Author | SHA1 | Date | |
---|---|---|---|
58b6ad841e | |||
fc937e3ec8 | |||
8652c7ecdf | |||
c882235eff | |||
d6c5239f9e | |||
4b2db3f720 | |||
9736777828 | |||
d3194fba19 | |||
fa29f9794d | |||
07915002bb | |||
fbcc06dcda | |||
7413a3a257 | |||
e6d2255291 | |||
2840ec3f87 | |||
05cd863ebf | |||
20961afb62 | |||
1256095e25 | |||
f073c79b8d | |||
ac9e4aa1a0 | |||
915f35b1e6 | |||
4fe74057f9 | |||
5a1ec033bb | |||
6801e39f97 | |||
f6f383751f | |||
43ed564a6e | |||
7b3364c356 | |||
58a7fc09e5 | |||
01c053702d | |||
a935fe7dc2 | |||
c9825fa016 | |||
9eb9207348 | |||
6b171e69db | |||
5b0ee89e34 | |||
8bd3ddc7fd | |||
984ae95576 | |||
f77cced7f3 | |||
57787f1bc7 | |||
9419f905df | |||
001fd893c1 | |||
babe4b4b31 | |||
201f39442e | |||
47f6aff561 | |||
cef9a92cb6 | |||
2253e4ead7 | |||
2f628f8564 | |||
23cd52885b | |||
181419ae28 | |||
a81ad0fef2 | |||
d220cedfeb | |||
e72564162b | |||
c98d05270e | |||
3e3803ed85 | |||
c8d8e566f8 | |||
712cba57b8 | |||
c9e45d4991 | |||
e9edc0d15c | |||
b99a09c88a | |||
5c95fe7af1 | |||
17f2ebb753 | |||
fc67f680ee | |||
88879257e6 | |||
fff45e1431 | |||
934d8a6123 | |||
defe9b6e95 | |||
4c5ccc001a | |||
de5c2ecb95 | |||
dbb95aef3a | |||
c9ae2ffef3 | |||
86af2a2c4f | |||
37ea6cf804 | |||
a9c685c6a4 | |||
7765e85336 | |||
7af50c51f6 | |||
19b30d55ec | |||
eddda8146e | |||
1a0b91a58f | |||
1b94ada709 | |||
1966b0a862 | |||
8ced6a730a | |||
6cd1e60e79 | |||
be691e4230 | |||
07b23109f9 | |||
32769a2b0b | |||
280977cb62 | |||
ddceec68a2 | |||
b961fd1c07 | |||
342b960f63 | |||
f965bf456a | |||
69be38110f | |||
3800e19418 | |||
e29ed58a1c | |||
11bfcd4bef | |||
fbc2e9a4db | |||
7814786957 | |||
542776fd2e | |||
815ee3dc7e | |||
376e720f4b | |||
b224c8939b | |||
0ecac98cff | |||
1416f57d0b | |||
65c7e41c53 | |||
c8cc673ad5 | |||
656dbe2fc2 | |||
a4ee7127ee | |||
fee21a7b17 | |||
32fd8dc636 | |||
2c8f444d42 | |||
bd8b587c5b | |||
4c954b79df | |||
b7fffbcf73 | |||
0829800b65 | |||
d7cfc76636 | |||
311030474d | |||
ec69e668ff | |||
f18910f490 | |||
540ad48d61 | |||
540c745069 | |||
c5b8eec33a | |||
bece335a64 | |||
3aabb5028d | |||
732bc9809a | |||
d77b484e55 | |||
43564bf380 | |||
88c71f6e9c | |||
47e8605f50 | |||
9466a8c0dd | |||
d878270bc6 | |||
3b38c4818f | |||
62c967526f | |||
6e5a44798b | |||
1fbfe2507b | |||
d6a3aab68a | |||
9fdfd1b5a6 | |||
f4e763bd9c | |||
fbfff2a4e4 | |||
1c93932737 | |||
cba29511bc | |||
1d655a4ddb | |||
ca94513630 | |||
971d4a5439 | |||
f3dcbd9081 | |||
29c53af843 | |||
8d24087faa | |||
95df8e5af4 | |||
8a1da777b0 | |||
44555da00f | |||
46bd5d51cc | |||
3964d300aa | |||
d6280e6d89 | |||
4a2a47f551 | |||
ae51930c9c | |||
fb33455bea | |||
28c703daf7 | |||
0246a5da19 | |||
840d17c67b | |||
9f22e94cf7 | |||
97ebecd84a | |||
96b9bb68e3 | |||
c5a5d3761d | |||
c147403b1c | |||
a2723452c2 | |||
cb3488276d | |||
43419c27cf | |||
0f0c399dd5 | |||
cb46497346 | |||
850c640368 | |||
60e455b36d | |||
af896c85ea | |||
6a7bb5ea5b | |||
3b6f2ad37e | |||
101eebdd95 | |||
830c36818e | |||
39e995213f | |||
37a053722d | |||
12fcf3b0cb | |||
43ad9c1c71 | |||
4f9207a868 | |||
3d1f589bc1 | |||
ae436a3b84 | |||
202bb44c76 | |||
041c609ff0 | |||
712b504168 | |||
bc9f0d468f | |||
2d20077c08 | |||
f61deda4e8 | |||
8203fa50ae | |||
c5eab0fd9c | |||
40e71238ac | |||
9d75b207d1 | |||
9b52c396d3 | |||
2759727984 | |||
e230d640cb | |||
d69688697c | |||
9f7ec62b18 | |||
b1a02918ff | |||
ec05f6737a | |||
da5db6477b | |||
0f580efb2b | |||
ff23ee508b | |||
2819faeb6f | |||
d205e882f6 | |||
3f40441b0a | |||
6185f20ec9 | |||
6a61989eb4 | |||
d658a069cd | |||
25688dbe8e | |||
98362b9687 | |||
4c31c96891 | |||
219209c6ca | |||
eff9fc51cb | |||
2ba23ee80d | |||
0f83f8f5c2 | |||
4ba3a3f2a9 | |||
db486a48aa | |||
2cab1195e8 | |||
ce75f09210 | |||
a8fed1b69b | |||
62ca2020d8 | |||
f65cf8880e | |||
c8d4a3deb3 | |||
d5e2a45034 | |||
2465f2ce1c | |||
f2001bcbb1 | |||
d5afb3eb2e | |||
c711cb7922 | |||
e45e0316f6 | |||
08ab512f4c | |||
f2bf09bf96 | |||
75e2b1c131 | |||
0b7ef16a41 | |||
247eec396c | |||
46c7fa9838 | |||
b3fb2c7130 | |||
c3ec3f28bd | |||
0a8ee721e8 | |||
8d7cf32988 | |||
655ecebaa5 | |||
8fc0fa99d3 | |||
69e8adc1cc | |||
6b3396e01b | |||
a95b52acd0 | |||
47553b6def | |||
e4a549ed30 | |||
dd2148bb92 | |||
d8b9d86896 | |||
889bd4bfc5 | |||
13fc903b2b | |||
8c8dbfed72 | |||
2b669cf35c | |||
5a2d892b85 | |||
37a7c318d5 | |||
43873efcab | |||
bb28e5aa8e | |||
c17261cd25 | |||
49e56cc226 | |||
84ad6cf356 | |||
b96526da31 | |||
cb14452df3 | |||
d54b9a6d6c | |||
6285c2db3b | |||
3453293c79 | |||
fb32cb0d78 | |||
baccb75256 | |||
5c39c1c93d | |||
48cc315fc8 | |||
ea8da6811a | |||
dbda48c16d | |||
bc710b5c6e | |||
b85d40b1b3 | |||
069c02ddcc | |||
1f6d77fc28 | |||
2b4266ee42 | |||
2b3c83c57e | |||
6f37ccdee3 | |||
df27924ac2 | |||
3cf24cfb40 | |||
3acf648eb4 | |||
76cafa4249 | |||
55943bf49a | |||
a280d8acb2 | |||
558a321fe8 | |||
d901047043 | |||
d4e0a0fa05 | |||
22554c61c5 | |||
72de1bbd33 | |||
2ff912e687 | |||
ccadb0416f | |||
5e51beddf7 | |||
97c9ba08d0 | |||
39d61c66b9 | |||
7a1eadb3fc | |||
1bcc2f7d0c | |||
e3cb949992 | |||
a0c356941c | |||
3c7868a750 | |||
3e7d9c0411 | |||
b21fd93d66 | |||
37e75acd86 | |||
6280a18c14 | |||
5bc8b9c987 | |||
0c570f8512 | |||
7593afa586 | |||
417d07f469 | |||
b803eba934 | |||
483207e5a0 | |||
02ef2b2241 | |||
13430bcad5 | |||
e65c0e128e | |||
bf5c040971 | |||
5dd3d1a3b4 | |||
6b0ea0c7bd | |||
6bc6b3262e | |||
3c1ae4cbd1 | |||
547b87afc6 | |||
db31744c98 | |||
9423a19842 | |||
07b303e530 | |||
ec51148374 | |||
0514f7805c | |||
dfa19899b0 | |||
1265ecab9f | |||
1ad297ec7a | |||
68628e3304 | |||
1a6d7d5723 | |||
78a8b9c58e | |||
5e7abb66bd | |||
358c397bb9 | |||
3d41528059 | |||
79637b611a | |||
5de796b119 | |||
bf84341acf | |||
bbac1fdceb | |||
c5ee1ee33c | |||
c74eda90ed | |||
ef2fe95bd8 | |||
e2589b3730 | |||
ebad1677bc | |||
dab6ebfd82 | |||
dd61b5360a | |||
fced92a5a0 | |||
64db1a654e | |||
31830ee759 | |||
1c05846a4f | |||
1db9c2e420 | |||
c966f6766c | |||
65b6359fd8 | |||
a54476eede | |||
7c0354046c | |||
43cd1c7e52 | |||
f80c333361 | |||
cdbb264093 | |||
87b3bbe785 | |||
b92cf7298a | |||
93456b5f40 | |||
72f29bf402 | |||
f6fc384466 | |||
c5ab3fdfae | |||
78c5081a29 | |||
d0c181ee8c | |||
80c6bb6e8b | |||
786b3fd3b2 | |||
f0a22be731 | |||
ade60022fd | |||
7daba910ed | |||
a016d6d91a | |||
fcaa97ed35 | |||
bb7373a229 | |||
759dcc30e7 | |||
0e47f02a33 | |||
5fe90517e7 | |||
92128da381 | |||
1441fe3ae5 | |||
b0bc71cd66 | |||
e908e8bb34 | |||
d708a6c6d8 | |||
a630741098 | |||
01d148e47c | |||
dbd41ec439 | |||
fc9cbab974 | |||
36f8010ebc | |||
e80d8fb5c8 | |||
eabab26eef | |||
18dbb23168 | |||
9ad2a1e92e | |||
5475b081b1 | |||
ae9c295ce1 | |||
e0ef774692 | |||
0c1364593a | |||
1603a4bc73 | |||
8361cf9960 | |||
8273e7d150 | |||
5c49a8297f | |||
ee1e4bf699 | |||
f5a8e36e50 | |||
b38a7c1da2 | |||
fe2247329e | |||
9d459370ce |
37
.gitignore
vendored
37
.gitignore
vendored
@ -1,3 +1,40 @@
|
||||
node_modules/
|
||||
tests/sandbox/
|
||||
doc/
|
||||
docs/
|
||||
local/
|
||||
npm-debug.log
|
||||
|
||||
# Emacs detritus
|
||||
# -*- mode: gitignore; -*-
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
|
||||
# Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
# flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
# eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
|
||||
# elpa packages
|
||||
/elpa/
|
||||
|
||||
# reftex files
|
||||
*.rel
|
||||
|
||||
# AUCTeX auto folder
|
||||
/auto/
|
||||
|
||||
# cask packages
|
||||
.cask/
|
||||
|
9
.travis.yml
Normal file
9
.travis.yml
Normal file
@ -0,0 +1,9 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.11"
|
||||
- "0.12"
|
||||
- "4.0"
|
||||
- "4.1"
|
||||
- "4.2"
|
||||
- "5.0"
|
306
CHANGELOG.md
Normal file
306
CHANGELOG.md
Normal file
@ -0,0 +1,306 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
## v1.6.0
|
||||
|
||||
### Major Improvements
|
||||
|
||||
- Better consistency and coverage for all FRESH resumes and themes ([#45][i45]).
|
||||
|
||||
- Initial support for overridable fonts in FRESH themes. Like a particular
|
||||
theme, but want to change the typography? The specific fonts used by a theme
|
||||
can now be overridden by the user. (FRESH themes only).
|
||||
|
||||
- New resume sections! Support for `projects` and `affiliation` resume sections
|
||||
for technical and creative projects and memberships / clubs / associations,
|
||||
respectively ([#92][i92]).
|
||||
|
||||
- New command! `PEEK` at any arbitrary field or entry on your `.json` resume.
|
||||
|
||||
### Added
|
||||
|
||||
- Improved handling of start and end dates on `employment`, `projects`,
|
||||
`education`, and other sections with start/end dates.
|
||||
|
||||
- Support for an `.ignore` property on any FRESH or JSON Resume section or field.
|
||||
Ignored properties will be treated by HackMyResume as if they weren't present.
|
||||
|
||||
- Emit extended status and error info with the `--debug` or `-d` switch.
|
||||
|
||||
- The `-o` or `--options` switch can now handle either the path to a **JSON
|
||||
settings file** or **raw JSON/JavaScript**. Since the JSON double quote syntax
|
||||
is a bit cumbersome from the command line, HackMyResume accepts regular
|
||||
JavaScript object literal syntax:
|
||||
|
||||
hackmyresume build resume.json -o "{ theme: 'compact', silent: 'true' }"
|
||||
|
||||
- Ability to disable sorting of resume sections (employments, projects, etc.)
|
||||
with the `--no-sort` option. HMR will respect the order of items as they appear
|
||||
in your resume `.json` file.
|
||||
|
||||
- Improvements to the starter resume emitted by `hackmyresume new`.
|
||||
|
||||
- Theme Authoring: Annotated the HTML and MS Word (XML) formats of the Modern
|
||||
theme for FRESH theme authors.
|
||||
|
||||
- Theme Authoring: Support for templatized CSS files in FRESH themes. CSS files
|
||||
are now expanded via Handlebars or Underscore prior to copying to the
|
||||
destination.
|
||||
|
||||
- Added CHANGELOG.md (this file).
|
||||
|
||||
### Changed
|
||||
|
||||
- Rewrote the HackMyResume man/help page.
|
||||
|
||||
- Minor incremental updates to the [FRESCA][fresca] schema.
|
||||
|
||||
- PDF generation now uses asynchronous `spawn()` which has better compatibility
|
||||
with old or boutique versions of Node.js.
|
||||
|
||||
- Refactored colors in HackMyResume output. Errors will now display as red,
|
||||
warnings as yellow, successful operations as green, and informational messages
|
||||
as cyan.
|
||||
|
||||
- Theme messages and usage tips will no longer display during resume generation
|
||||
by default. Use the `--tips` option to view them.
|
||||
|
||||
- The `--no-tips` option (default: false) has been replaced with the `--tips`
|
||||
option, also defaulting to false.
|
||||
|
||||
- Removed the `hello-world` theme from the [prebuilt themes][themes] that ship
|
||||
with HackMyResume. It can be installed separately from NPM:
|
||||
|
||||
```bash
|
||||
npm install fresh-theme-hello-world
|
||||
hackmyresume resume.json -t node_modules/fresh-theme-hello-world
|
||||
```
|
||||
|
||||
- sd
|
||||
|
||||
### Fixed
|
||||
|
||||
- PDF generation issues on older versions of Node.
|
||||
|
||||
- Stack traces not being emitted correctly.
|
||||
|
||||
- Missing `speaking` section will now appear on generated resumes ([#101][i101]).
|
||||
|
||||
- Incomplete `education` details will now appear on generated resumes ([#65][i65]).
|
||||
|
||||
- Missing employment end date being interpreted as "employment ends today"
|
||||
([#84][i84]).
|
||||
|
||||
- Merging multiple source resumes during `BUILD` sometimes fails.
|
||||
|
||||
- Document `--pdf` flag in README ([#111][i111]).
|
||||
|
||||
### Internal
|
||||
|
||||
- Logging messages have been moved out of core HackMyResume code ahead of
|
||||
localization support.
|
||||
|
||||
- All HackMyResume console output is described in `msg.yml`.
|
||||
|
||||
- Relaxed pure JavaScript requirement. CoffeeScript will now start appearing
|
||||
in HackMyResume and FluentCV sources!
|
||||
|
||||
- Additional tests.
|
||||
|
||||
## v1.5.2
|
||||
|
||||
### Fixed
|
||||
|
||||
- Tweak stack trace under `--debug`.
|
||||
|
||||
## v1.5.1
|
||||
|
||||
### Added
|
||||
|
||||
- Preliminary support for `-d` or `--debug` flag. Forces HackMyResume to emit a stack trace under error conditions.
|
||||
|
||||
## v1.5.0
|
||||
|
||||
### Added
|
||||
|
||||
- HackMyResume now supports **CLI-based generation of PDF formats across multiple engines (Phantom, wkhtmltopdf, etc)**. Instead of talking to these engines over a programmatic API, as in prior versions, HackMyResume 1.5+ speaks to them over the same command-line interface (CLI) you'd use if you were using these tools directly.
|
||||
|
||||
- HackMyResume will now (attempt to) **generate a PDF output for JSON Resume themes** (in addition to HTML).
|
||||
|
||||
- Minor README and FAQ additions.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Cleaner, quicker installs**. Installing HackMyResume with `npm install hackmyresume -g` will no longer trigger a lengthy, potentially error-prone install for Phantom.js and/or wkhtmltopdf for PDF support. Instead, users can install these engines externally and HMR will use them when present.
|
||||
|
||||
- Minor error handling improvements.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed an error with generating specific formats with the `BUILD` command (#97).
|
||||
|
||||
- Fixed numerous latent/undocumented bugs and glitches.
|
||||
|
||||
## v1.4.2
|
||||
|
||||
### Added
|
||||
|
||||
- Introduced [FAQ](https://github.com/hacksalot/HackMyResume/blob/master/FAQ.md).
|
||||
- Additional README notes.
|
||||
|
||||
## v1.4.1
|
||||
|
||||
### Added
|
||||
|
||||
- `hackmyresume new` now generates a [valid starter resume with sample data](https://github.com/fluentdesk/fresh-resume-starter).
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed warning message when `hackmyresume new` is run without a filename.
|
||||
|
||||
## v1.4.0
|
||||
|
||||
### Added
|
||||
|
||||
- **"Projects" support**: FRESH resumes and themes can now store and display
|
||||
open source, commercial, private, personal, and creative projects.
|
||||
- **New command: ANALYZE**. Inspect your resume for gaps, keyword counts, and other metrics. (Experimental.)
|
||||
- **Side-by-side PDF generation** with Phantom and wkhtmltopdf. Use the `--pdf` or `-p` flag to pick between `phantom` and `wkhtmltopdf` generation.
|
||||
- **Disable PDF generation** with the `--pdf none` switch.
|
||||
- **Inherit formats between themes**. Themes can now inherit formats (Word, HTML, .txt, etc.) from other themes. (FRESH themes only.)
|
||||
- **Rename resume sections** to different languages or wordings.
|
||||
- **Specify complex options via external file**. Use with the `-o` or `--opts` option.
|
||||
- **Disable colors** with the `--no-color` flag.
|
||||
- **Theme messages and usage tips** instructions will now appear in the default HackMyResume output for the `build` command. Run `hackmyresume build resume.json -t awesome` for an example. Turn off with the `--no-tips` flag.
|
||||
- **Treat validation errors as warnings** with the `--assert` switch (VALIDATE command only).
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed a minor glitch in the FRESCA schema.
|
||||
- Fixed encoding issues in the `Highlights` section of certain resumes.
|
||||
- Fix behavior of `-s` and `--silent` flags.
|
||||
|
||||
### Changed
|
||||
|
||||
- PDF generation now defaults to Phantom for all platforms, with `wkhtmltopdf`
|
||||
accessible with `--pdf wkhtmltopdf`.
|
||||
- Resumes are now validated, by default, prior to generation. This
|
||||
behavior can be disabled with the `--novalidate` or `--force` switch.
|
||||
- Syntax errors in source FRESH and JSON Resumes are now captured for all
|
||||
commands.
|
||||
- Minor updates to README.
|
||||
- Most themes now inherit Markdown and Plain Text formats from the **Basis**
|
||||
theme.
|
||||
|
||||
### Internal
|
||||
|
||||
- Switched from color to chalk.
|
||||
- Command invocations now handled through commander.js.
|
||||
- Improved FRESH theme infrastructure (more partials, more DRY).
|
||||
|
||||
## v1.3.1
|
||||
|
||||
### Added
|
||||
|
||||
- Add additional Travis badges.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix extraneous console log output when generating a FRESH theme to MS Word.
|
||||
- Fix Travis tests on `dev`.
|
||||
|
||||
## v1.3.0
|
||||
|
||||
### Added
|
||||
|
||||
- **Local generation of JSON Resume themes**. To use a JSON Resume theme, first install it with `npm install jsonresume-theme-[blah]` (most JSON Resume themes are on NPM). Then pass it into HackMyResume via the `-t` parameter:
|
||||
|
||||
`hackmyresume BUILD resume.json TO out/somefile.all -t node_modules/jsonresume-theme-classy`
|
||||
- **Better Markdown support.** HackMyResume will start flowing basic Markdown styles to JSON Resume (HTML) themes. FRESH's existing Markdown support has also been improved.
|
||||
- **.PNG output formats** will start appearing in themes that declare an HTML output.
|
||||
- **Tweak CSS embedding / linking via the --css option** (`<style></style>` vs `<link>`). Only works for HTML (or HTML-driven) formats of FRESH themes. Use `--css=link` to link in CSS assets and `--css=embed` to embed the styles in the HTML document. For example `hackmyresume BUILD resume.json TO out/resume.all --css=link`.
|
||||
- **Improved Handlebars/Underscore helper support** for FRESH themes. Handlebars themes can access helpers via `{{helperName}}`. Underscore themes can access helpers via the `h` object.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Distinguish between validation errors and syntax errors** when validating a FRESH or JRS resume with `hackmyresume validate <blah>`.
|
||||
- **Emit line and column info** for syntax errors during validation of FRESH and JRS resumes.
|
||||
- **FRESH themes now embed CSS into HTML formats by default** so that the HTML resume output doesn't have an external CSS file dependency by default. Users can specify normal linked stylesheets by setting `--css=link`.
|
||||
- **Renamed fluent-themes repo to fresh-themes** in keeping with the other parts of the project.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix various encoding errors in MS Word outputs.
|
||||
- Fix assorted FRESH-to-JRS and JRS-to-FRESH conversion glitches.
|
||||
- Fix error when running HMR with no parameters.
|
||||
- Other minor fixes.
|
||||
|
||||
## v1.3.0-beta
|
||||
|
||||
- Numerous changes supporting v1.3.0.
|
||||
|
||||
## v1.2.2
|
||||
|
||||
### Fixed
|
||||
|
||||
- Various in-passing fixes.
|
||||
|
||||
## v1.2.1
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix `require('FRESCA')` error.
|
||||
- Fix `.history` and `.map` errors on loading incomplete or empty JRS resumes.
|
||||
|
||||
### Added
|
||||
|
||||
- Better test coverage of incomplete/empty resumes.
|
||||
|
||||
## v1.2.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed the `new` command: Generate a new FRESH-format resume with `hackmyresume new resume.json` or a new JSON Resume with `hackmyresume new resume.json -f jrs`.
|
||||
|
||||
### Added
|
||||
|
||||
- Introduced CLI tests.
|
||||
|
||||
## v1.1.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- MS Word formats: Fixed skill coloring/level bug.
|
||||
|
||||
### Changed
|
||||
|
||||
- Make the `TO` keyword optional. If no `TO` keyword is specified (for the `build` and `convert` commands), HMR will assume the last file passed in is the desired output file. So these are equivalent:
|
||||
|
||||
```shell
|
||||
hackmyresume BUILD resume.json TO out/resume.all
|
||||
hackmyresume BUILD resume.json out/resume.all
|
||||
```
|
||||
|
||||
`TO` only needs to be included if you have multipled output files:
|
||||
|
||||
```shell
|
||||
hackmyresume BUILD resume.json TO out1.doc out2.html out3.tex
|
||||
```
|
||||
|
||||
## v1.0.1
|
||||
|
||||
### Fixed
|
||||
|
||||
- Correctly generate MS Word hyperlinks from Markdown source data.
|
||||
|
||||
## v1.0.0
|
||||
|
||||
- Initial public 1.0 release.
|
||||
|
||||
[i45]: https://github.com/hacksalot/HackMyResume/issues/45
|
||||
[i65]: https://github.com/hacksalot/HackMyResume/issues/65
|
||||
[i84]: https://github.com/hacksalot/HackMyResume/issues/84
|
||||
[i92]: https://github.com/hacksalot/HackMyResume/issues/92
|
||||
[i101]: https://github.com/hacksalot/HackMyResume/issues/101
|
||||
[i111]: https://github.com/hacksalot/HackMyResume/issues/111
|
||||
[fresca]: https://github.com/fluentdesk/FRESCA
|
||||
[themes]: https://github.com/fluentdesk/fresh-themes
|
58
CONTRIBUTING.md
Normal file
58
CONTRIBUTING.md
Normal file
@ -0,0 +1,58 @@
|
||||
Contributing
|
||||
============
|
||||
|
||||
*Note: HackMyResume is also available as [FluentCV][fcv]. Contributors are
|
||||
credited in both.*
|
||||
|
||||
HackMyResume needs your help! Our contribution workflow is based on [GitHub
|
||||
Flow][flow] and we respond to all pull requests and issues, usually within 24
|
||||
hours. HackMyResume has no corporate affiliation and no commercial basis, which
|
||||
allows the project to maintain a strict user-first policy, rapid development
|
||||
velocity, and a liberal stance on contributions and exotic functionality in
|
||||
keeping with the spirit (and name) of the tool.
|
||||
|
||||
In short, your code is welcome here.
|
||||
|
||||
## How To Contribute
|
||||
|
||||
1. Optional: [**open an issue**][iss] identifying the feature or bug you'd like
|
||||
to implement or fix. This step isn't required — you can start hacking away on
|
||||
HackMyResume without clearing it with us — but helps avoid duplication of work
|
||||
and ensures that your changes will be accepted once submitted.
|
||||
2. **Fork and clone** the HackMyResume project.
|
||||
3. Ideally, **create a new feature branch** (eg, `feat/new-awesome-feature` or
|
||||
similar; call it whatever you like) to perform your work in.
|
||||
4. **Install dependencies** by running `npm install` in the top-level
|
||||
HackMyResume folder.
|
||||
5. Make your **commits** as usual.
|
||||
6. **Verify** your changes locally with `npm test`.
|
||||
7. **Push** your commits.
|
||||
7. **Submit a pull request** from your feature branch to the HackMyResume `dev`
|
||||
branch.
|
||||
8. We'll typically **respond** within 24 hours.
|
||||
9. Your awesome changes will be **merged** after verification.
|
||||
|
||||
## Project Maintainers
|
||||
|
||||
HackMyResume is currently maintained by [hacksalot][ha] with assistance from
|
||||
[tomheon][th] and our awesome [contributors][awesome]. Please direct all official
|
||||
or internal inquiries to:
|
||||
|
||||
```
|
||||
admin@hackmyresume.com
|
||||
```
|
||||
|
||||
You can reach hacksalot directly at:
|
||||
|
||||
```
|
||||
hacksalot@indevious.com
|
||||
```
|
||||
|
||||
Thanks! See you out there in the trenches.
|
||||
|
||||
[fcv]: https://github.com/fluentdesk/fluentcv
|
||||
[flow]: https://guides.github.com/introduction/flow/
|
||||
[iss]: https://github.com/hacksalot/HackMyResume/issues
|
||||
[ha]: https://github.com/hacksalot
|
||||
[th]: https://github.com/tomheon
|
||||
[awesome]: https://github.com/hacksalot/HackMyResume/graphs/contributors
|
228
FAQ.md
Normal file
228
FAQ.md
Normal file
@ -0,0 +1,228 @@
|
||||
Frequently Asked Questions (FAQ)
|
||||
================================
|
||||
|
||||
## How do I get started with HackMyResume?
|
||||
|
||||
1. Install with NPM: `[sudo] npm install hackmyresume -g`.
|
||||
|
||||
2. Create a new resume with: `hackmyresume NEW <resume-name>.json`.
|
||||
|
||||
3. Test with `hackmyresume BUILD <resume-name>.json`. Look in the `out/` folder.
|
||||
|
||||
4. Play around with different themes with the `-t` or `--theme` parameter.
|
||||
You can use any [FRESH](https://github.com/fluentdesk/fresh-themes) or
|
||||
[JSON Resume](https://jsonresume.org/themes) theme. The latter have to be
|
||||
installed first.
|
||||
|
||||
## What is FRESH?
|
||||
|
||||
FRESH is the **F**luent **R**esume and **E**mployment **S**ystem for **H**umans.
|
||||
It's an open-source, user-first workflow, schema, and set of practices for
|
||||
technical candidates and recruiters.
|
||||
|
||||
## What is FRESCA?
|
||||
|
||||
The **F**RESH **R**esume and **E**mployment **SC**hem**A**—an open-source,
|
||||
JSON-driven schema for resumes, CVs, and other employment artifacts. FRESCA is
|
||||
the recommended schema/format for FRESH, with optional support for JSON Resume.
|
||||
|
||||
## What is JSON Resume?
|
||||
|
||||
An [open resume standard](http://jsonresume.org/themes/) sponsored by Hired.com.
|
||||
Like FRESCA, JSON Resume is JSON-driven and open-source. Unlike FRESCA, JSON
|
||||
Resume targets a worldwide audience where FRESCA is optimized for technical
|
||||
candidates.
|
||||
|
||||
## Should I use the FRESH or JSON Resume format/schema for my resume?
|
||||
|
||||
Both! The workflow we like to use:
|
||||
|
||||
1. Create a resume in FRESH format for tooling and analysis.
|
||||
2. Convert it to JSON Resume format for additional themes/tools.
|
||||
3. Maintain both versions.
|
||||
|
||||
Both formats are open-source and both formats are JSON-driven. FRESH was
|
||||
designed as a universal container format and superset of existing formats, where
|
||||
the JSON Resume format is intended for a generic audience.
|
||||
|
||||
## How do I use a FRESH theme?
|
||||
|
||||
Several FRESH themes come preinstalled with HackMyResume; others can be
|
||||
installed from NPM and GitHub.
|
||||
|
||||
### To use a preinstalled FRESH theme:
|
||||
|
||||
1. Pass the theme name into HackMyResume via the `--theme` or `-t` parameter:
|
||||
|
||||
```bash
|
||||
hackmyresume build resume.json --theme compact
|
||||
```
|
||||
|
||||
### To use an external FRESH theme:
|
||||
|
||||
1. Install the theme locally. The easiest way to do that is with NPM.
|
||||
|
||||
```bash
|
||||
npm install fresh-theme-underscore
|
||||
```
|
||||
|
||||
2. Pass the theme folder into HackMyResume:
|
||||
|
||||
```bash
|
||||
hackmyresume BUILD resume.json --theme node_modules/fresh-theme-underscore
|
||||
```
|
||||
|
||||
3. Check your output folder. It's best to view HTML formats over a local web
|
||||
server connection.
|
||||
|
||||
## How do I use a JSON Resume theme?
|
||||
|
||||
JSON Resume (JRS) themes can be installed from NPM and GitHub and passed into
|
||||
HackMyResume via the `--theme` or `-t` parameter.
|
||||
|
||||
1. Install the theme locally. The easiest way to do that is with NPM.
|
||||
|
||||
```bash
|
||||
npm install jsonresume-theme-classy
|
||||
```
|
||||
|
||||
2. Pass the theme folder path into HackMyResume:
|
||||
|
||||
```bash
|
||||
hackmyresume BUILD resume.json --theme node_modules/jsonresume-theme-classy
|
||||
```
|
||||
|
||||
3. Check your output folder. It's best to view HTML formats over a local web
|
||||
server connection.
|
||||
|
||||
## Should I keep my resume in version control?
|
||||
|
||||
Absolutely! As text-based, JSON-driven documents, both FRESH and JSON Resume are
|
||||
ideal candidates for version control. Future versions of HackMyResume will have
|
||||
this functionality built in.
|
||||
|
||||
## Can I change the default section titles ("Employment", "Skills", etc.)?
|
||||
|
||||
If you're using a FRESH theme, yes. First, create a HackMyResume options file
|
||||
mapping resume sections to your preferred section title:
|
||||
|
||||
```javascript
|
||||
// myoptions.json
|
||||
{
|
||||
"sectionTitles": {
|
||||
"employment": "empleo",
|
||||
"skills": "habilidades",
|
||||
"education": "educación"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Then, pass the options file into the `-o` or `--opts` parameter:
|
||||
|
||||
```bash
|
||||
hackmyresume BUILD resume.json -o myoptions.json
|
||||
```
|
||||
|
||||
This ability is currently only supported for FRESH resume themes.
|
||||
|
||||
## How does resume merging work?
|
||||
|
||||
Resume merging is a way of storing your resume in separate files that
|
||||
HackMyResume will merge into a single "master" resume file prior to generating
|
||||
specific output formats like HTML or PDF. It's a way of producing flexible,
|
||||
configurable, targeted resumes with minimal duplication.
|
||||
|
||||
For example, a software developer who moonlights as a game programmer might
|
||||
create three FRESH or JRS resumes at different levels of specificity:
|
||||
|
||||
- **generic.json**: A generic technical resume, suitable for all audiences.
|
||||
- **game-developer.json**: Overrides and amendments for game developer
|
||||
positions.
|
||||
- **blizzard.json**: Overrides and amendments specific to a hypothetical
|
||||
position at Blizzard.
|
||||
|
||||
If you run `hackmyresume BUILD generic.json TO out/resume.all`, HMR will
|
||||
generate all available output formats for the `generic.json` as usual. But if
|
||||
you instead run...
|
||||
|
||||
```bash
|
||||
hackmyresume BUILD generic.json game-developer.json TO out/resume.all
|
||||
```
|
||||
|
||||
...HackMyResume will notice that multiple source resumes were specified and
|
||||
merge `game-developer.json` onto `generic.json` before generating, yielding a
|
||||
resume that's more suitable for game-developer-related positions.
|
||||
|
||||
You can take this a step further. Let's say you want to do a targeted resume
|
||||
submission to a game developer position at Blizzard, and `blizzard.json`
|
||||
contains the edits and revisions you'd like to show up in the targeted resume.
|
||||
In that case, merge again! Feed all three resumes to HackMyResume, in order
|
||||
from most generic to most specific, and HMR will merge them all prior to
|
||||
generating the final output format(s) for your resume.
|
||||
|
||||
```bash
|
||||
# Merge blizzard.json onto game-developer.json onto generic.json, then build
|
||||
hackmyresume BUILD generic.json game-developer.json blizzard.json TO out/resume.all
|
||||
```
|
||||
|
||||
There's no limit to the number of resumes you can merge this way.
|
||||
|
||||
You can also divide your resume into files containing different sections:
|
||||
|
||||
- **resume-a.json**: Contains `info`, `employment`, and `summary` sections.
|
||||
- **resume-b.json**: Contains all other sections except `references`.
|
||||
- **references.json**: Contains the private `references` section.
|
||||
|
||||
Under that scenario, `hackmyresume BUILD resume-a.json resume-b.json` would
|
||||
|
||||
|
||||
## The HackMyResume terminal color scheme is giving me a headache. Can I disable it?
|
||||
|
||||
Yes. Use the `--no-color` option to disable terminal colors:
|
||||
|
||||
`hackmyresume <somecommand> <someoptions> --no-color`
|
||||
|
||||
## What's the difference between a FRESH theme and a JSON Resume theme?
|
||||
|
||||
FRESH themes are multiformat (HTML, Word, PDF, etc.) and required to support
|
||||
Markdown formatting, configurable section titles, and various other features.
|
||||
|
||||
JSON Resume themes are typically HTML-driven, but capable of expansion to other
|
||||
formats through tools. JSON Resume themes don't support Markdown natively, but
|
||||
HMR does its best to apply your Markdown, when present, to any JSON Resume
|
||||
themes it encounters.
|
||||
|
||||
## Do I have to have a FRESH resume to use a FRESH theme or a JSON Resume to use a JSON Resume theme?
|
||||
|
||||
No. You can mix and match FRESH and JRS-format themes freely. HackMyResume will
|
||||
perform the necessary conversions on the fly.
|
||||
|
||||
## Can I build my own custom FRESH theme?
|
||||
|
||||
Yes. The easiest way is to copy an existing FRESH theme, like `modern` or
|
||||
`compact`, and make your changes there. You can test your theme with:
|
||||
|
||||
```bash
|
||||
hackmyresume build resume.json --theme path/to/my/theme/folder
|
||||
```
|
||||
|
||||
## Can I build my own custom JSON Resume theme?
|
||||
|
||||
Yes. The easiest way is to copy an existing JSON Rsume theme and make your
|
||||
changes there. You can test your theme with:
|
||||
|
||||
```bash
|
||||
hackmyresume build resume.json --theme path/to/my/theme/folder
|
||||
```
|
||||
|
||||
## Can I build my own tools / services / apps / websites around FRESH / FRESCA?
|
||||
|
||||
Yes! FRESH/FRESCA formats are 100% open source, permissively licensed under MIT,
|
||||
and 100% free from company-specific, tool-specific, or commercially oriented
|
||||
lock-in or cruft. These are clean formats designed for users and builders.
|
||||
|
||||
## Can I build my own tools / services / apps / websites around JSON Resume?
|
||||
|
||||
Yes! HackMyResume is not affiliated with JSON Resume, but like FRESH/FRESCA,
|
||||
JSON Resume is open-source, permissively licensed, and free of proprietary
|
||||
lock-in. See the JSON Resume website for details.
|
28
Gruntfile.js
28
Gruntfile.js
@ -14,9 +14,21 @@ module.exports = function (grunt) {
|
||||
ui: 'bdd',
|
||||
reporter: 'spec'
|
||||
},
|
||||
all: { src: ['tests/*.js'] }
|
||||
all: { src: ['test/*.js'] }
|
||||
},
|
||||
|
||||
jsdoc : {
|
||||
dist : {
|
||||
src: ['src/**/*.js'],
|
||||
options: {
|
||||
private: true,
|
||||
destination: 'doc'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
clean: ['test/sandbox'],
|
||||
|
||||
yuidoc: {
|
||||
compile: {
|
||||
name: '<%= pkg.name %>',
|
||||
@ -36,7 +48,7 @@ module.exports = function (grunt) {
|
||||
laxcomma: true,
|
||||
expr: true
|
||||
},
|
||||
all: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js']
|
||||
all: ['Gruntfile.js', 'src/**/*.js', 'test/*.js']
|
||||
}
|
||||
|
||||
};
|
||||
@ -45,12 +57,14 @@ module.exports = function (grunt) {
|
||||
|
||||
grunt.loadNpmTasks('grunt-simple-mocha');
|
||||
grunt.loadNpmTasks('grunt-contrib-yuidoc');
|
||||
grunt.loadNpmTasks('grunt-jsdoc');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
|
||||
grunt.registerTask('test', 'Test the FluentCV library.',
|
||||
function( config ) { grunt.task.run( ['simplemocha:all'] ); });
|
||||
grunt.registerTask('document', 'Generate FluentCV library documentation.',
|
||||
function( config ) { grunt.task.run( ['yuidoc'] ); });
|
||||
grunt.registerTask('default', [ 'jshint', 'test', 'yuidoc' ]);
|
||||
grunt.registerTask('test', 'Test the HackMyResume library.',
|
||||
function( config ) { grunt.task.run(['clean','jshint','simplemocha:all']); });
|
||||
grunt.registerTask('document', 'Generate HackMyResume library documentation.',
|
||||
function( config ) { grunt.task.run( ['jsdoc'] ); });
|
||||
grunt.registerTask('default', [ 'test', 'jsdoc' ]);
|
||||
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
The MIT License
|
||||
===============
|
||||
|
||||
Copyright (c) 2015 James M. Devlin (https://github.com/hacksalot)
|
||||
Copyright (c) 2016 hacksalot (https://github.com/hacksalot)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
479
README.md
479
README.md
@ -1,99 +1,175 @@
|
||||
fluentCV
|
||||
========
|
||||
*Create polished technical résumés and CVs in multiple formats from your command
|
||||
line or shell. See [FluentCV Desktop][7] for the desktop version. OS X ~ Windows
|
||||
~ Linux.*
|
||||
HackMyResume
|
||||
============
|
||||
|
||||

|
||||
[![Latest release][img-release]][latest-release]
|
||||
[![Build status (MASTER)][img-master]][travis-url-master]
|
||||
[![Build status (DEV)][img-dev]][travis-url-dev]
|
||||
|
||||
FluentCV is a dev-friendly Swiss Army knife for resumes and CVs. Use it to:
|
||||
*Create polished résumés and CVs in multiple formats from your command line or
|
||||
shell. Author in clean Markdown and JSON, export to Word, HTML, PDF, LaTeX,
|
||||
plain text, and other arbitrary formats. Fight the power, save trees. Compatible
|
||||
with [FRESH][fresca] and [JRS][6] resumes.*
|
||||
|
||||

|
||||
|
||||
HackMyResume is a dev-friendly, local-only Swiss Army knife for resumes and CVs.
|
||||
Use it to:
|
||||
|
||||
1. **Generate** HTML, Markdown, LaTeX, MS Word, PDF, plain text, JSON, XML,
|
||||
YAML, print, smoke signal, carrier pigeon, and other arbitrary-format resumes
|
||||
and CVs, from a single source of truth—without violating DRY.
|
||||
2. **Convert** resumes between [FRESH][fresca] and [JSON Resume][6] formats.
|
||||
3. **Validate** resumes against either format.
|
||||
2. **Analyze** your resume for keyword density, gaps/overlaps, and other
|
||||
metrics.
|
||||
3. **Convert** resumes between [FRESH][fresca] and [JSON Resume][6] formats.
|
||||
4. **Validate** resumes against either format.
|
||||
|
||||
FluentCV supports both the [FRESH][fresca] and [JSON Resume][6] source formats.
|
||||
HackMyResume is built with Node.js and runs on recent versions of OS X, Linux,
|
||||
or Windows. View the [FAQ](FAQ.md).
|
||||
|
||||
## Features
|
||||
|
||||
- OS X, Linux, and Windows.
|
||||
- Choose from dozens of FRESH or JSON Resume themes.
|
||||
- Private, local-only resume authoring and analysis.
|
||||
- Analyze your resume for keywords, gaps, and other metrics.
|
||||
- Store your resume data as a durable, versionable JSON or YAML document.
|
||||
- Generate polished resumes in multiple formats without violating [DRY][dry].
|
||||
- Output to HTML, Markdown, LaTeX, PDF, MS Word, JSON, YAML, plain text, or XML.
|
||||
- Compatible with [FRESH][fresh], [JSON Resume][6], [FRESCA][fresca], and
|
||||
[FCV Desktop][7].
|
||||
- Validate resumes against the FRESH or JSON Resume schema.
|
||||
- Support for multiple input and output resumes.
|
||||
- Convert between FRESH and JSON Resume resumes.
|
||||
- Use from your command line or [desktop][7].
|
||||
- Free and open-source through the MIT license.
|
||||
- Updated daily / weekly. Contributions are [welcome](CONTRIBUTING.md).
|
||||
|
||||
## Install
|
||||
|
||||
Install FluentCV with NPM:
|
||||
Install the latest stable version of HackMyResume with NPM:
|
||||
|
||||
```bash
|
||||
[sudo] npm install fluentcv -g
|
||||
[sudo] npm install hackmyresume -g
|
||||
```
|
||||
|
||||
Note: for PDF generation you'll need to install a copy of [wkhtmltopdf][3] for
|
||||
your platform. For LaTeX generation you'll need a valid LaTeX environment with
|
||||
access to `xelatex` and similar.
|
||||
Alternately, install the latest bleeding-edge version (updated daily):
|
||||
|
||||
```bash
|
||||
[sudo] npm install hacksalot/hackmyresume#dev -g
|
||||
```
|
||||
|
||||
## Installing PDF Support (optional)
|
||||
|
||||
HackMyResume tries not to impose a specific PDF engine requirement on
|
||||
the user, but will instead work with whatever PDF engines you have installed.
|
||||
|
||||
Currently, HackMyResume's PDF generation requires either [Phantom.js][2] or
|
||||
[wkhtmltopdf][3] to be installed on your system and the `phantomjs` and/or
|
||||
`wkhtmltopdf` binaries to be accessible on your PATH. This is an optional
|
||||
requirement for users who care about PDF formats. If you don't care about PDF
|
||||
formats, skip this step.
|
||||
|
||||
## Installing Themes
|
||||
|
||||
HackMyResume supports both [FRESH][fresh-themes] and [JSON Resume][jrst]-style
|
||||
résumé themes.
|
||||
|
||||
- FRESH themes currently come preinstalled with HackMyResume.
|
||||
- JSON Resume themes can be installed from NPM, GitHub, or manually.
|
||||
|
||||
To install a JSON Resume theme, just `cd` to the folder where you want to store
|
||||
your themes and run one of:
|
||||
|
||||
```bash
|
||||
# Install with NPM
|
||||
npm install jsonresume-theme-[theme-name]
|
||||
|
||||
# Install with GitHub
|
||||
git clone https://github.com/[user-or-org]/[repo-name]
|
||||
```
|
||||
|
||||
Then when you're ready to generate your resume, just reference the location of
|
||||
the theme folder as you installed it:
|
||||
|
||||
```bash
|
||||
hackmyresume BUILD resume.json TO out/resume.all -t node_modules/jsonresume-theme-classy
|
||||
```
|
||||
|
||||
Note: You can use install themes anywhere on your file system. You don't need a
|
||||
package.json or other NPM/Node infrastructure.
|
||||
|
||||
## Getting Started
|
||||
|
||||
To use FluentCV you'll need to create a valid resume in either [FRESH][fresca]
|
||||
or [JSON Resume][6] format. Then you can start using the command line tool.
|
||||
There are four basic commands you should be aware of:
|
||||
To use HackMyResume you'll need to create a valid resume in either
|
||||
[FRESH][fresca] or [JSON Resume][6] format. Then you can start using the command
|
||||
line tool. There are five basic commands you should be aware of:
|
||||
|
||||
- `build` generates resumes in HTML, Word, Markdown, PDF, and other formats. Use
|
||||
it when you need to submit, upload, print, or email resumes in specific formats.
|
||||
- **build** generates resumes in HTML, Word, Markdown, PDF, and other formats.
|
||||
Use it when you need to submit, upload, print, or email resumes in specific
|
||||
formats.
|
||||
|
||||
```bash
|
||||
# fluentcv BUILD <INPUTS> TO <OUTPUTS> [-t THEME]
|
||||
fluentcv BUILD resume.json TO out/resume.all
|
||||
fluentcv BUILD r1.json r2.json TO out/rez.html out/rez.md foo/rez.all
|
||||
# hackmyresume BUILD <INPUTS...> TO <OUTPUTS...> [-t THEME]
|
||||
hackmyresume BUILD resume.json TO out/resume.all
|
||||
hackmyresume 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.
|
||||
- **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
|
||||
# hackmyresume NEW <OUTPUTS...> [-f <FORMAT>]
|
||||
hackmyresume NEW resume.json
|
||||
hackmyresume NEW resume.json -f fresh
|
||||
hackmyresume NEW r1.json r2.json -f jrs
|
||||
```
|
||||
|
||||
- `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.
|
||||
- **analyze** inspects your resume for keywords, duration, and other metrics.
|
||||
|
||||
```bash
|
||||
# fluentcv CONVERT <INPUTS> TO <OUTPUTS>
|
||||
fluentcv CONVERT resume.json TO resume-jrs.json
|
||||
fluentcv CONVERT 1.json 2.json 3.json TO out/1.json out/2.json out/3.json
|
||||
# hackmyresume ANALYZE <INPUTS...>
|
||||
hackmyresume ANALYZE resume.json
|
||||
hackmyresume ANALYZE r1.json r2.json
|
||||
```
|
||||
|
||||
- `validate` validates the specified resume against either the FRESH or JSON
|
||||
- **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.
|
||||
|
||||
```bash
|
||||
# hackmyresume CONVERT <INPUTS...> TO <OUTPUTS...>
|
||||
hackmyresume CONVERT resume.json TO resume-jrs.json
|
||||
hackmyresume CONVERT 1.json 2.json 3.json TO out/1.json out/2.json out/3.json
|
||||
```
|
||||
|
||||
- **validate** validates the specified resume against either the FRESH or JSON
|
||||
Resume schema. Use it to make sure your resume data is sufficient and complete.
|
||||
|
||||
```bash
|
||||
# fluentcv VALIDATE <INPUTS>
|
||||
fluentcv VALIDATE resume.json
|
||||
fluentcv VALIDATE r1.json r2.json r3.json
|
||||
# hackmyresume VALIDATE <INPUTS...>
|
||||
hackmyresume VALIDATE resume.json
|
||||
hackmyresume VALIDATE r1.json r2.json r3.json
|
||||
```
|
||||
|
||||
- **peek** echoes your resume or any field, property, or object path on your
|
||||
resume to standard output.
|
||||
|
||||
```bash
|
||||
# hackmyresume PEEK <INPUTS...> [OBJECT-PATH]
|
||||
hackmyresume PEEK rez.json # Echo the whole resume
|
||||
hackmyresume PEEK rez.json info.brief # Echo the "info.brief" field
|
||||
hackmyresume PEEK rez.json employment.history[1] # Echo the 1st job
|
||||
hackmyresume PEEK rez.json rez2.json info.brief # Compare value
|
||||
```
|
||||
|
||||
## Supported Output Formats
|
||||
|
||||
FluentCV supports these output formats:
|
||||
HackMyResume supports these output formats:
|
||||
|
||||
Output Format | Ext | Notes
|
||||
------------- | --- | -----
|
||||
HTML | .html | A standard HTML 5 + CSS resume format that can be viewed in a browser, deployed to a website, etc.
|
||||
Markdown | .md | A structured Markdown document that can be used as-is or used to generate HTML.
|
||||
LaTeX | .tex | A structured LaTeX document (or collection of documents).
|
||||
MS Word | .doc | A Microsoft Word office document.
|
||||
Adobe Acrobat (PDF) | .pdf | A binary PDF document driven by an HTML theme.
|
||||
LaTeX | .tex | A structured LaTeX document (or collection of documents) that can be processed with pdflatex, xelatex, and similar tools.
|
||||
MS Word | .doc | A Microsoft Word office document (XML-driven; WordProcessingML).
|
||||
Adobe Acrobat (PDF) | .pdf | A binary PDF document driven by an HTML theme (through wkhtmltopdf).
|
||||
plain text | .txt | A formatted plain text document appropriate for emails or copy-paste.
|
||||
JSON | .json | A JSON representation of the resume.
|
||||
YAML | .yml | A YAML representation of the resume.
|
||||
@ -101,22 +177,13 @@ RTF | .rtf | Forthcoming.
|
||||
Textile | .textile | Forthcoming.
|
||||
image | .png, .bmp | Forthcoming.
|
||||
|
||||
## Install
|
||||
|
||||
FluentCV requires a recent version of [Node.js][4] and [NPM][5]. Then:
|
||||
|
||||
1. Install the latest official [wkhtmltopdf][3] binary for your platform.
|
||||
2. Optionally install an updated LaTeX environment (LaTeX resumes only).
|
||||
2. Install **fluentCV** with `[sudo] npm install fluentcv -g`.
|
||||
3. You're ready to go.
|
||||
|
||||
## Use
|
||||
|
||||
Assuming you've got a JSON-formatted resume handy, generating resumes in
|
||||
different formats and combinations easy. Just run:
|
||||
different formats and combinations is easy. Just run:
|
||||
|
||||
```bash
|
||||
fluentcv BUILD <INPUTS> <OUTPUTS> [-t theme].
|
||||
hackmyresume BUILD <INPUTS> <OUTPUTS> [-t theme].
|
||||
```
|
||||
|
||||
Where `<INPUTS>` is one or more .json resume files, separated by spaces;
|
||||
@ -125,25 +192,25 @@ theme (default to Modern). For example:
|
||||
|
||||
```bash
|
||||
# Generate all resume formats (HTML, PDF, DOC, TXT, YML, etc.)
|
||||
fluentcv build resume.json -o out/resume.all -t modern
|
||||
hackmyresume BUILD resume.json TO out/resume.all -t modern
|
||||
|
||||
# Generate a specific resume format
|
||||
fluentcv build resume.json TO out/resume.html
|
||||
fluentcv build resume.json TO out/resume.pdf
|
||||
fluentcv build resume.json TO out/resume.md
|
||||
fluentcv build resume.json TO out/resume.doc
|
||||
fluentcv build resume.json TO out/resume.json
|
||||
fluentcv build resume.json TO out/resume.txt
|
||||
fluentcv build resume.json TO out/resume.yml
|
||||
hackmyresume BUILD resume.json TO out/resume.html
|
||||
hackmyresume BUILD resume.json TO out/resume.pdf
|
||||
hackmyresume BUILD resume.json TO out/resume.md
|
||||
hackmyresume BUILD resume.json TO out/resume.doc
|
||||
hackmyresume BUILD resume.json TO out/resume.json
|
||||
hackmyresume BUILD resume.json TO out/resume.txt
|
||||
hackmyresume BUILD resume.json TO out/resume.yml
|
||||
|
||||
# Specify 2 inputs and 3 outputs
|
||||
fluentcv build in1.json in2.json TO out.html out.doc out.pdf
|
||||
hackmyresume BUILD in1.json in2.json TO out.html out.doc out.pdf
|
||||
```
|
||||
|
||||
You should see something to the effect of:
|
||||
|
||||
```
|
||||
*** FluentCV v0.9.0 ***
|
||||
*** HackMyResume v1.4.0 ***
|
||||
Reading JSON resume: foo/resume.json
|
||||
Applying MODERN Theme (7 formats)
|
||||
Generating HTML resume: out/resume.html
|
||||
@ -159,28 +226,56 @@ Generating YAML resume: out/resume.yml
|
||||
|
||||
### Applying a theme
|
||||
|
||||
You can specify a predefined or custom theme via the optional `-t` parameter. For a predefined theme, include the theme name. For a custom theme, include the path to the custom theme's folder.
|
||||
HackMyResume can work with any FRESH or JSON Resume theme (the latter must be
|
||||
installed first). To specify a theme when generating your resume, use the `-t`
|
||||
or `--theme` parameter:
|
||||
|
||||
```bash
|
||||
fluentcv build resume.json -t modern
|
||||
fluentcv build resume.json -t ~/foo/bar/my-custom-theme/
|
||||
hackmyresume BUILD resume.json TO out/rez.all -t [theme]
|
||||
```
|
||||
|
||||
As of v0.9.0, available predefined themes are `modern`, `minimist`, and `hello-world`, and `compact`.
|
||||
The `[theme]` parameter can be the name of a predefined theme OR the path to any
|
||||
FRESH or JSON Resume theme folder:
|
||||
|
||||
```bash
|
||||
hackmyresume BUILD resume.json TO out/rez.all -t modern
|
||||
hackmyresume BUILD resume.json TO OUT.rez.all -t ../some-folder/my-custom-theme/
|
||||
hackmyresume BUILD resume.json TO OUT.rez.all -t node_modules/jsonresume-theme-classy
|
||||
```
|
||||
|
||||
FRESH themes are currently pre-installed with HackMyResume. JSON Resume themes
|
||||
can be installed prior to use:
|
||||
|
||||
```bash
|
||||
# Install a JSON Resume theme into a local node_modules subfolder:
|
||||
npm install jsonresume-theme-[name]
|
||||
# Use it with HackMyResume
|
||||
hackmyresume build resume.json -t node_modules/jsonresume-theme-[name]
|
||||
```
|
||||
|
||||
As of v1.6.0, available predefined FRESH themes are `positive`, `modern`,
|
||||
`compact`, `minimist`, and `hello-world`. For a list of JSON Resume themes,
|
||||
check the [NPM Registry](https://www.npmjs.com/search?q=jsonresume-theme).
|
||||
|
||||
### Merging resumes
|
||||
|
||||
You can **merge multiple resumes together** by specifying them in order from most generic to most specific:
|
||||
You can **merge multiple resumes together** by specifying them in order from
|
||||
most generic to most specific:
|
||||
|
||||
```bash
|
||||
# Merge specific.json onto base.json and generate all formats
|
||||
fluentcv build base.json specific.json -o resume.all
|
||||
hackmyresume BUILD base.json specific.json TO resume.all
|
||||
```
|
||||
|
||||
This can be useful for overriding a base (generic) resume with information from a specific (targeted) resume. For example, you might override your generic catch-all "software developer" resume with specific details from your targeted "game developer" resume, or combine two partial resumes into a "complete" resume. Merging follows conventional [extend()][9]-style behavior and there's no arbitrary limit to how many resumes you can merge:
|
||||
This can be useful for overriding a base (generic) resume with information from
|
||||
a specific (targeted) resume. For example, you might override your generic
|
||||
catch-all "software developer" resume with specific details from your targeted
|
||||
"game developer" resume, or combine two partial resumes into a "complete"
|
||||
resume. Merging follows conventional [extend()][9]-style behavior and there's
|
||||
no arbitrary limit to how many resumes you can merge:
|
||||
|
||||
```bash
|
||||
fluentcv build in1.json in2.json in3.json in4.json TO out.html out.doc
|
||||
hackmyresume BUILD in1.json in2.json in3.json in4.json TO out.html out.doc
|
||||
Reading JSON resume: in1.json
|
||||
Reading JSON resume: in2.json
|
||||
Reading JSON resume: in3.json
|
||||
@ -192,72 +287,231 @@ Generating WORD resume: out.doc
|
||||
|
||||
### Multiple targets
|
||||
|
||||
You can specify **multiple output targets** and FluentCV will build them:
|
||||
You can specify **multiple output targets** and HackMyResume will build them:
|
||||
|
||||
```bash
|
||||
# Generate out1.doc, out1.pdf, and foo.txt from me.json.
|
||||
fluentcv build me.json -o out1.doc -o out1.pdf -o foo.txt
|
||||
```
|
||||
|
||||
You can also omit the output file(s) and/or theme completely:
|
||||
|
||||
```bash
|
||||
# Equivalent to "fluentcv resume.json resume.all -t modern"
|
||||
fluentcv build resume.json
|
||||
hackmyresume BUILD me.json TO out1.doc out1.pdf foo.txt
|
||||
```
|
||||
|
||||
### Using .all
|
||||
|
||||
The special `.all` extension tells FluentCV to generate all supported output formats for the given resume. For example, this...
|
||||
The special `.all` extension tells HackMyResume to generate all supported output
|
||||
formats for the given resume. For example, this...
|
||||
|
||||
```bash
|
||||
# Generate all resume formats (HTML, PDF, DOC, TXT, etc.)
|
||||
fluentcv build me.json -o out/resume.all
|
||||
hackmyresume BUILD me.json TO out/resume.all
|
||||
```
|
||||
|
||||
..tells FluentCV to read `me.json` and generate `out/resume.md`, `out/resume.doc`, `out/resume.html`, `out/resume.txt`, `out/resume.pdf`, and `out/resume.json`.
|
||||
..tells HackMyResume to read `me.json` and generate `out/resume.md`,
|
||||
`out/resume.doc`, `out/resume.html`, `out/resume.txt`, `out/resume.pdf`, and
|
||||
`out/resume.json`.
|
||||
|
||||
### Building PDFs
|
||||
|
||||
*Users who don't care about PDFs can turn off PDF generation across all themes
|
||||
and formats with the `--pdf none` switch.*
|
||||
|
||||
HackMyResume takes a unique approach to PDF generation. Instead of enforcing
|
||||
a specific PDF engine on users, HackMyResume will attempt to work with whatever
|
||||
PDF engine you have installed through the engine's command-line interface (CLI).
|
||||
Currently that means one or both of...
|
||||
|
||||
- [wkhtmltopdf][3]
|
||||
- [Phantom.js][3]
|
||||
|
||||
..with support for other engines planned in the future. But for now, **one or
|
||||
both of these engines must be installed and accessible on your PATH in order to
|
||||
generate PDF resumes with HackMyResume**. That means you should be able to
|
||||
invoke either of these tools directly from your shell or terminal without error:
|
||||
|
||||
```bash
|
||||
wkhtmltopdf input.html output.pdf
|
||||
phantomjs script.js input.html output.pdf
|
||||
```
|
||||
|
||||
Assuming you've installed one or both of these engines on your system, you can
|
||||
tell HackMyResume which flavor of PDF generation to use via the `--pdf` option
|
||||
(`-p` for short):
|
||||
|
||||
```bash
|
||||
hackmyresume BUILD resume.json TO out.all --pdf phantom
|
||||
hackmyresume BUILD resume.json TO out.all --pdf wkhtmltopdf
|
||||
hackmyresume BUILD resume.json TO out.all --pdf none
|
||||
```
|
||||
|
||||
### Analyzing
|
||||
|
||||
HackMyResume can analyze your resume for keywords, employment gaps, and other
|
||||
metrics. Run:
|
||||
|
||||
```bash
|
||||
hackmyresume ANALYZE <my-resume>.json
|
||||
```
|
||||
|
||||
Depending on the HackMyResume version, you should see output similar to:
|
||||
|
||||
|
||||
```
|
||||
*** HackMyResume v1.6.0 ***
|
||||
Reading resume: resume.json
|
||||
Analyzing FRESH resume: resume.json
|
||||
|
||||
SECTIONS (10):
|
||||
|
||||
employment: 12
|
||||
education: 2
|
||||
service: 1
|
||||
skills: 8
|
||||
writing: 1
|
||||
recognition: 0
|
||||
social: 4
|
||||
interests: 2
|
||||
references: 1
|
||||
languages: 2
|
||||
|
||||
COVERAGE (61.1%):
|
||||
|
||||
Total Days: 6034
|
||||
Employed: 3688
|
||||
Gaps: 8 [31, 1065, 273, 153, 671, 61, 61, 31]
|
||||
Overlaps: 1 [243]
|
||||
|
||||
KEYWORDS (61):
|
||||
|
||||
Node.js: 6 mentions
|
||||
JavaScript: 9 mentions
|
||||
SQL Server: 3 mentions
|
||||
Visual Studio: 6 mentions
|
||||
Web API: 1 mentions
|
||||
N-tier / 3-tier: 1 mentions
|
||||
HTML 5: 1 mentions
|
||||
JavaScript: 6 mentions
|
||||
CSS: 2 mentions
|
||||
Sass / LESS / SCSS: 1 mentions
|
||||
LAMP: 3 mentions
|
||||
WISC: 1 mentions
|
||||
HTTP: 21 mentions
|
||||
JSON: 1 mentions
|
||||
XML: 2 mentions
|
||||
REST: 1 mentions
|
||||
WebSockets: 2 mentions
|
||||
Backbone.js: 3 mentions
|
||||
Angular.js: 1 mentions
|
||||
Node.js: 4 mentions
|
||||
NPM: 1 mentions
|
||||
Bower: 1 mentions
|
||||
Grunt: 2 mentions
|
||||
Gulp: 1 mentions
|
||||
jQuery: 2 mentions
|
||||
Bootstrap: 3 mentions
|
||||
Underscore.js: 1 mentions
|
||||
PhantomJS: 1 mentions
|
||||
CoffeeScript: 1 mentions
|
||||
Python: 11 mentions
|
||||
Perl: 4 mentions
|
||||
PHP: 7 mentions
|
||||
MySQL: 12 mentions
|
||||
PostgreSQL: 4 mentions
|
||||
NoSQL: 2 mentions
|
||||
Apache: 2 mentions
|
||||
AWS: 2 mentions
|
||||
EC2: 2 mentions
|
||||
RDS: 3 mentions
|
||||
S3: 1 mentions
|
||||
Azure: 1 mentions
|
||||
Rackspace: 1 mentions
|
||||
C++: 23 mentions
|
||||
C++ 11: 1 mentions
|
||||
Boost: 1 mentions
|
||||
Xcode: 2 mentions
|
||||
gcc: 1 mentions
|
||||
OO&AD: 1 mentions
|
||||
.NET: 20 mentions
|
||||
Unity 5: 2 mentions
|
||||
Mono: 3 mentions
|
||||
MonoDevelop: 1 mentions
|
||||
Xamarin: 1 mentions
|
||||
TOTAL: 180 mentions
|
||||
```
|
||||
|
||||
### Validating
|
||||
|
||||
FluentCV can also validate your resumes against either the [FRESH /
|
||||
HackMyResume can also validate your resumes against either the [FRESH /
|
||||
FRESCA][fresca] or [JSON Resume][6] formats. To validate one or more existing
|
||||
resumes, use the `validate` command:
|
||||
|
||||
```bash
|
||||
# Validate myresume.json against either the FRESH or JSON Resume schema.
|
||||
fluentcv validate resumeA.json resumeB.json
|
||||
hackmyresume VALIDATE resumeA.json resumeB.json
|
||||
```
|
||||
|
||||
FluentCV will validate each specified resume in turn:
|
||||
HackMyResume will validate each specified resume in turn:
|
||||
|
||||
```bash
|
||||
*** FluentCV v0.9.0 ***
|
||||
*** HackMyResume v1.6.0 ***
|
||||
Validating JSON resume: resumeA.json (INVALID)
|
||||
Validating JSON resume: resumeB.json (VALID)
|
||||
```
|
||||
|
||||
### Converting
|
||||
|
||||
FluentCV can convert between the [FRESH][fresca] and [JSON Resume][6] formats.
|
||||
Just run:
|
||||
HackMyResume can convert between the [FRESH][fresca] and [JSON Resume][6]
|
||||
formats. Just run:
|
||||
|
||||
```bash
|
||||
fluentcv CONVERT <INPUTS> <OUTPUTS>
|
||||
hackmyresume CONVERT <INPUTS> <OUTPUTS>
|
||||
```
|
||||
|
||||
where <INPUTS> is one or more resumes in FRESH or JSON Resume format, and
|
||||
<OUTPUTS> is a corresponding list of output file names. FluentCV will autodetect
|
||||
the format (FRESH or JRS) of each input resume and convert it to the other
|
||||
format (JRS or FRESH).
|
||||
<OUTPUTS> is a corresponding list of output file names. HackMyResume will
|
||||
autodetect the format (FRESH or JRS) of each input resume and convert it to the
|
||||
other format (JRS or FRESH).
|
||||
|
||||
### File-based Options
|
||||
|
||||
You can pass options into HackMyResume via an external options or ".hackmyrc"
|
||||
file with the `--options` or `-o` switch:
|
||||
|
||||
```bash
|
||||
hackmyresume BUILD resume.json -o path/to/options.json
|
||||
```
|
||||
|
||||
The options file can contain any documented HackMyResume option, including
|
||||
`theme`, `silent`, `debug`, `pdf`, `css`, and other settings.
|
||||
|
||||
```javascript
|
||||
{
|
||||
// Set the default theme to "compact"
|
||||
"theme": "compact",
|
||||
// Change the "employment" section title text to "Work"
|
||||
"sectionTitles": {
|
||||
"employment": "Work"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If a particular option is specified both on the command line and in an external
|
||||
options file, the explicit command-line option takes precedence.
|
||||
|
||||
```bash
|
||||
# path/to/options.json specifes the POSITIVE theme
|
||||
# -t parameter specifies the COMPACT theme
|
||||
# The -t parameter wins.
|
||||
hackmyresume BUILD resume.json -o path/to/options.json -t compact
|
||||
> Reading resume: resume.json
|
||||
> Applying COMPACT theme (7 formats)
|
||||
```
|
||||
|
||||
### Prettifying
|
||||
|
||||
FluentCV applies [js-beautify][10]-style HTML prettification by default to
|
||||
HTML-formatted resumes. To disable prettification, the `--nopretty` or `-n` flag
|
||||
can be used:
|
||||
HackMyResume applies [js-beautify][10]-style HTML prettification by default to
|
||||
HTML-formatted resumes. To disable prettification, the `--no-prettify` or `-n`
|
||||
flag can be used:
|
||||
|
||||
```bash
|
||||
fluentcv generate resume.json out.all --nopretty
|
||||
hackmyresume BUILD resume.json out.all --no-prettify
|
||||
```
|
||||
|
||||
### Silent Mode
|
||||
@ -265,10 +519,26 @@ fluentcv generate resume.json out.all --nopretty
|
||||
Use `-s` or `--silent` to run in silent mode:
|
||||
|
||||
```bash
|
||||
fluentcv generate resume.json -o someFile.all -s
|
||||
fluentcv generate resume.json -o someFile.all --silent
|
||||
hackmyresume BUILD resume.json -o someFile.all -s
|
||||
hackmyresume BUILD resume.json -o someFile.all --silent
|
||||
```
|
||||
|
||||
### Debug Mode
|
||||
|
||||
Use `-d` or `--debug` to force HMR to emit a call stack when errors occur. In
|
||||
the future, this option will emit detailed error logging.
|
||||
|
||||
```bash
|
||||
hackmyresume BUILD resume.json -d
|
||||
hackmyresume ANALYZE resume.json --debug
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
HackMyResume is a community-driven free and open source project under the MIT
|
||||
License. Contributions are encouraged and we respond to all PRs and issues,
|
||||
usually within 24 hours. See [CONTRIBUTING.md][contribute] for details.
|
||||
|
||||
## License
|
||||
|
||||
MIT. Go crazy. See [LICENSE.md][1] for details.
|
||||
@ -286,3 +556,12 @@ MIT. Go crazy. See [LICENSE.md][1] for details.
|
||||
[fresh]: https://github.com/fluentdesk/FRESH
|
||||
[fresca]: https://github.com/fluentdesk/FRESCA
|
||||
[dry]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
|
||||
[img-release]: https://img.shields.io/github/release/hacksalot/HackMyResume.svg?label=version
|
||||
[img-master]: https://img.shields.io/travis/hacksalot/HackMyResume/master.svg
|
||||
[img-dev]: https://img.shields.io/travis/hacksalot/HackMyResume/dev.svg?label=dev
|
||||
[travis-url-master]: https://travis-ci.org/hacksalot/HackMyResume?branch=master
|
||||
[travis-url-dev]: https://travis-ci.org/hacksalot/HackMyResume?branch=dev
|
||||
[latest-release]: https://github.com/hacksalot/HackMyResume/releases/latest
|
||||
[contribute]: CONTRIBUTING.md
|
||||
[fresh-themes]: https://github.com/fluentdesk/fresh-themes
|
||||
[jrst]: https://www.npmjs.com/search?q=jsonresume-theme
|
||||
|
107
ROADMAP.md
Normal file
107
ROADMAP.md
Normal file
@ -0,0 +1,107 @@
|
||||
Development Roadmap
|
||||
===================
|
||||
|
||||
## Short-Term
|
||||
|
||||
### FluentCV Desktop: Beta 1
|
||||
|
||||
The **FluentCV Desktop 1.0 beta release** will present HackMyResume
|
||||
functionality in a cross-platform desktop application for OS X, Linux, and
|
||||
Windows.
|
||||
|
||||
### GitHub Integration
|
||||
|
||||
HackMyResume will offer GitHub integration for versioned resume storage and
|
||||
retrieval via the `COMMIT` or `STORE` command(s) starting in 1.7.0 or 1.8.0.
|
||||
|
||||
### fresh-themes 1.0.0
|
||||
|
||||
The **fresh-themes 1.0** release will bring 100% coverage of the FRESH and JRS
|
||||
object models—all resume sections and fields—along with
|
||||
documentation, theme developer's guide, new themes, and a freeze to the FRESH
|
||||
theme structure.
|
||||
|
||||
### Better LaTeX support
|
||||
|
||||
Including Markdown-to-LaTeX translation and more LaTeX-driven themes / formats.
|
||||
|
||||
### StackOverflow and LinkedIn support
|
||||
|
||||
Will start appearing in v1.7.0, with incremental improvements in 1.8.0 and
|
||||
beyond.
|
||||
|
||||
### Improved resume sorting and arranging
|
||||
|
||||
**Better resume sorting** of items and sections: ascending, descending, by
|
||||
date or other criteria ([#67][i67]).
|
||||
|
||||
### Remote resume / theme loading
|
||||
|
||||
Support remote loading of themes and resumes over `http`, `https`, and
|
||||
`git://`. Enable these usage patterns:
|
||||
|
||||
```bash
|
||||
hackmyresume build https://somesite.com/my-resume.json -t informatic
|
||||
|
||||
hackmyresume build resume.json -t npm:fresh-theme-ergonomic
|
||||
|
||||
hackmyresume analyze https://github.com/foo/my-resume
|
||||
```
|
||||
|
||||
### 100% code coverage
|
||||
|
||||
Should reduce certain classes of errors and allow HMR to display a nifty 100%
|
||||
code coverage badge.
|
||||
|
||||
### Improved **documentation and samples**
|
||||
|
||||
Expanded documentation and samples throughout.
|
||||
|
||||
## Mid-Term
|
||||
|
||||
### Cover letters and job descriptions
|
||||
|
||||
Add support for schema-driven **cover letters** and **job descriptions**.
|
||||
|
||||
### Character Sheets
|
||||
|
||||
HackMyResume 2.0 will ship with support for, yes, RPG-style character sheets.
|
||||
This will demonstrate the tool's ability to flow arbitrary JSON to concrete
|
||||
document(s) and provide unique albeit niche functionality around various games
|
||||
([#117][i117]).
|
||||
|
||||
### Rich text (.rtf) output formats
|
||||
|
||||
Basic support for **rich text** `.rtf` output formats.
|
||||
|
||||
### Investigate: groff support
|
||||
|
||||
Investigate adding [**groff**][groff] support, because that would, indeed, be
|
||||
[dope][d] ([#37][i37]).
|
||||
|
||||
### Investigate: org-mode support
|
||||
|
||||
Investigate adding [**org mode**][om] support ([#38][i38]).
|
||||
|
||||
### Investigate: Scribus
|
||||
|
||||
Investigate adding [**Scribus SLA**][scri] support ([#54][i54]).
|
||||
|
||||
### Support JSON Resume 1.0.0
|
||||
|
||||
When released.
|
||||
|
||||
## Long-Term
|
||||
|
||||
- TBD
|
||||
|
||||
[groff]: http://www.gnu.org/software/groff/
|
||||
[om]: http://orgmode.org/
|
||||
[scri]: https://en.wikipedia.org/wiki/Scribus
|
||||
[d]: https://github.com/hacksalot/HackMyResume/issues/37#issue-123818674
|
||||
[i37]: https://github.com/hacksalot/HackMyResume/issues/37
|
||||
[i38]: https://github.com/hacksalot/HackMyResume/issues/38
|
||||
[i54]: https://github.com/hacksalot/HackMyResume/issues/54
|
||||
[i67]: https://github.com/hacksalot/HackMyResume/issues/67
|
||||
[i107]: https://github.com/hacksalot/HackMyResume/issues/107
|
||||
[i117]: https://github.com/hacksalot/HackMyResume/issues/117
|
Binary file not shown.
Before Width: | Height: | Size: 53 KiB |
BIN
assets/hackmyresume.cli.1.6.0.png
Normal file
BIN
assets/hackmyresume.cli.1.6.0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
BIN
assets/hackmyresume_cli.png
Normal file
BIN
assets/hackmyresume_cli.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
BIN
assets/resume-bouqet.png
Normal file
BIN
assets/resume-bouqet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 170 KiB |
67
package.json
67
package.json
@ -1,10 +1,14 @@
|
||||
{
|
||||
"name": "fluentcv",
|
||||
"version": "0.10.1",
|
||||
"name": "hackmyresume",
|
||||
"version": "1.7.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",
|
||||
"url": "https://github.com/fluentdesk/fluentcv.git"
|
||||
"url": "https://github.com/hacksalot/HackMyResume.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "grunt clean && mocha",
|
||||
"grunt": "grunt"
|
||||
},
|
||||
"keywords": [
|
||||
"resume",
|
||||
@ -18,45 +22,60 @@
|
||||
"PDF",
|
||||
"YAML",
|
||||
"HTML",
|
||||
"CLI"
|
||||
"LaTeX",
|
||||
"CLI",
|
||||
"Handlebars",
|
||||
"Underscore",
|
||||
"template"
|
||||
],
|
||||
"author": "hacksalot <hacksalot@indevious.com> (https://github.com/hacksalot)",
|
||||
"contributors": [
|
||||
"aruberto (https://github.com/aruberto)",
|
||||
"jjanusch (https://github.com/driftdev)",
|
||||
"robertmain (https://github.com/robertmain)",
|
||||
"tomheon (https://github.com/tomheon)",
|
||||
"zhuangya (https://github.com/zhuangya)",
|
||||
"hacksalot <hacksalot@indevious.com> (https://github.com/hacksalot)"
|
||||
],
|
||||
"author": "James M. Devlin",
|
||||
"license": "MIT",
|
||||
"preferGlobal": "true",
|
||||
"bugs": {
|
||||
"url": "https://github.com/fluentdesk/fluentcv/issues"
|
||||
"url": "https://github.com/hacksalot/HackMyResume/issues"
|
||||
},
|
||||
"main": "src/fluentcmd.js",
|
||||
"bin": {
|
||||
"fluentcv": "src/index.js"
|
||||
"hackmyresume": "src/index.js"
|
||||
},
|
||||
"homepage": "https://github.com/fluentdesk/fluentcv",
|
||||
"homepage": "https://github.com/hacksalot/HackMyResume",
|
||||
"dependencies": {
|
||||
"fresca": "~0.2.1",
|
||||
"colors": "^1.1.2",
|
||||
"fluent-themes": "~0.6.1-beta",
|
||||
"fs-extra": "^0.24.0",
|
||||
"chalk": "^1.1.1",
|
||||
"commander": "^2.9.0",
|
||||
"copy": "^0.1.3",
|
||||
"extend": "^3.0.0",
|
||||
"fresca": "~0.6.0",
|
||||
"hackmycore": "^0.2.0",
|
||||
"handlebars": "^4.0.5",
|
||||
"html": "0.0.10",
|
||||
"is-my-json-valid": "^2.12.2",
|
||||
"jst": "0.0.13",
|
||||
"marked": "^0.3.5",
|
||||
"minimist": "^1.2.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"moment": "^2.10.6",
|
||||
"recursive-readdir-sync": "^1.0.6",
|
||||
"lodash": "^3.10.1",
|
||||
"printf": "^0.2.3",
|
||||
"string-padding": "^1.0.2",
|
||||
"string.prototype.startswith": "^0.2.0",
|
||||
"underscore": "^1.8.3",
|
||||
"wkhtmltopdf": "^0.1.5",
|
||||
"xml-escape": "^1.0.0",
|
||||
"word-wrap": "^1.1.0",
|
||||
"yamljs": "^0.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "*",
|
||||
"fresh-test-resumes": "^0.6.0",
|
||||
"grunt": "*",
|
||||
"grunt-cli": "^0.1.13",
|
||||
"grunt-contrib-clean": "^0.7.0",
|
||||
"grunt-contrib-jshint": "^0.11.3",
|
||||
"grunt-contrib-yuidoc": "^0.10.0",
|
||||
"grunt-jsdoc": "^1.1.0",
|
||||
"grunt-simple-mocha": "*",
|
||||
"is-my-json-valid": "^2.12.2",
|
||||
"jsonresume-theme-boilerplate": "^0.1.2",
|
||||
"jsonresume-theme-classy": "^1.0.9",
|
||||
"jsonresume-theme-modern": "0.0.18",
|
||||
"jsonresume-theme-sceptile": "^1.0.5",
|
||||
"mocha": "*",
|
||||
"resample": "fluentdesk/resample"
|
||||
}
|
||||
|
30
src/cli/analyze.hbs
Normal file
30
src/cli/analyze.hbs
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
{{style "SECTIONS (" "bold"}}{{style totals.numSections "white" }}{{style ")" "bold"}}
|
||||
|
||||
employment: {{v totals.totals.employment "-" 2 "bold" }}
|
||||
projects: {{v totals.totals.projects "-" 2 "bold" }}
|
||||
education: {{v totals.totals.education "-" 2 "bold" }}
|
||||
service: {{v totals.totals.service "-" 2 "bold" }}
|
||||
skills: {{v totals.totals.skills "-" 2 "bold" }}
|
||||
writing: {{v totals.totals.writing "-" 2 "bold" }}
|
||||
speaking: {{v totals.totals.speaking "-" 2 "bold" }}
|
||||
reading: {{v totals.totals.reading "-" 2 "bold" }}
|
||||
social: {{v totals.totals.social "-" 2 "bold" }}
|
||||
references: {{v totals.totals.references "-" 2 "bold" }}
|
||||
testimonials: {{v totals.totals.testimonials "-" 2 "bold" }}
|
||||
languages: {{v totals.totals.languages "-" 2 "bold" }}
|
||||
interests: {{v totals.totals.interests "-" 2 "bold" }}
|
||||
|
||||
{{style "COVERAGE (" "bold"}}{{style coverage.pct "white"}}{{style ")" "bold"}}
|
||||
|
||||
Total Days: {{v coverage.duration.total "-" 5 "bold" }}
|
||||
Employed: {{v coverage.duration.work "-" 5 "bold" }}
|
||||
Gaps: {{v coverage.gaps.length "-" 5 "bold" }} [{{#if coverage.gaps.length }}{{#each coverage.gaps }}{{#unless @first}} {{/unless}}{{gapLength duration }}{{/each}}{{/if}}]
|
||||
Overlaps: {{v coverage.overlaps.length "-" 5 "bold" }} [{{#if coverage.overlaps.length }}{{#each coverage.overlaps }}{{#unless @first}} {{/unless}}{{gapLength duration }}{{/each}}{{/if}}]
|
||||
|
||||
{{style "KEYWORDS (" "bold"}}{{style keywords.length "white" }}{{style ")" "bold"}}
|
||||
|
||||
{{#each keywords }}{{{pad name 18}}}: {{v count "-" 5 "bold"}} mention{{#isPlural count}}s{{/isPlural}}
|
||||
{{/each}}
|
||||
-------------------------------
|
||||
{{v keywords.length "0" 9 "bold"}} {{style "KEYWORDS" "bold"}} {{v keywords.totalKeywords "0" 5 "bold"}} {{style "mentions" "bold"}}
|
280
src/cli/error.js
Normal file
280
src/cli/error.js
Normal file
@ -0,0 +1,280 @@
|
||||
/**
|
||||
Error-handling routines for HackMyResume.
|
||||
@module cli/error
|
||||
@license MIT. See LICENSE.md for details.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
|
||||
var HMSTATUS = require('hackmycore/src/core/status-codes')
|
||||
, PKG = require('../../package.json')
|
||||
, FS = require('fs')
|
||||
, FCMD = require('hackmycore')
|
||||
, PATH = require('path')
|
||||
, WRAP = require('word-wrap')
|
||||
, M2C = require('hackmycore/src/utils/md2chalk.js')
|
||||
, chalk = require('chalk')
|
||||
, extend = require('extend')
|
||||
, YAML = require('yamljs')
|
||||
, printf = require('printf')
|
||||
, SyntaxErrorEx = require('hackmycore/src/utils/syntax-error-ex');
|
||||
require('string.prototype.startswith');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Error handler for HackMyResume. All errors are handled here.
|
||||
@class ErrorHandler
|
||||
*/
|
||||
var ErrorHandler = module.exports = {
|
||||
|
||||
|
||||
|
||||
init: function( debug, assert, silent ) {
|
||||
this.debug = debug;
|
||||
this.assert = assert;
|
||||
this.silent = silent;
|
||||
this.msgs = require('./msg.js').errors;
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
|
||||
err: function( ex, shouldExit ) {
|
||||
|
||||
// Short-circuit logging output if --silent is on
|
||||
var o = this.silent ? function() { } : _defaultLog;
|
||||
|
||||
// Special case; can probably be removed.
|
||||
if( ex.pass ) throw ex;
|
||||
|
||||
// Load error messages
|
||||
this.msgs = this.msgs || require('./msg.js').errors;
|
||||
|
||||
// Handle packaged HMR exceptions
|
||||
if( ex.fluenterror ) {
|
||||
|
||||
// Output the error message
|
||||
var objError = assembleError.call( this, ex );
|
||||
o( this[ 'format_' + objError.etype ]( objError.msg ));
|
||||
|
||||
// Output the stack (sometimes)
|
||||
if( objError.withStack ) {
|
||||
var stack = ex.stack || (ex.inner && ex.inner.stack);
|
||||
stack && o( chalk.gray( stack ) );
|
||||
}
|
||||
|
||||
// Quit if necessary
|
||||
if( ex.quit || objError.quit ) {
|
||||
this.debug && o(
|
||||
chalk.cyan('Exiting with error code ' + ex.fluenterror.toString()));
|
||||
if( this.assert ) { ex.pass = true; throw ex; }
|
||||
process.exit( ex.fluenterror );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Handle raw exceptions
|
||||
else {
|
||||
o( ex );
|
||||
var stackTrace = ex.stack || (ex.inner && ex.inner.stack);
|
||||
if( stackTrace && this.debug )
|
||||
o( M2C(ex.stack || ex.inner.stack, 'gray') );
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
format_error: function( msg ) {
|
||||
msg = msg || '';
|
||||
return chalk.red.bold(
|
||||
msg.toUpperCase().startsWith('ERROR:') ? msg : 'Error: ' + msg );
|
||||
},
|
||||
|
||||
|
||||
|
||||
format_warning: function( brief, msg ) {
|
||||
return chalk.yellow(brief) + chalk.yellow(msg || '');
|
||||
},
|
||||
|
||||
|
||||
format_custom: function( msg ) {
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
function _defaultLog() {
|
||||
console.log.apply( console.log, arguments );
|
||||
}
|
||||
|
||||
|
||||
|
||||
function assembleError( ex ) {
|
||||
|
||||
var msg = '', withStack = false, quit = false, etype = 'warning';
|
||||
if( this.debug ) withStack = true;
|
||||
|
||||
switch( ex.fluenterror ) {
|
||||
|
||||
case HMSTATUS.themeNotFound:
|
||||
msg = printf( M2C( this.msgs.themeNotFound.msg, 'yellow' ), ex.data);
|
||||
break;
|
||||
|
||||
case HMSTATUS.copyCSS:
|
||||
msg = M2C( this.msgs.copyCSS.msg, 'red' );
|
||||
quit = false;
|
||||
break;
|
||||
|
||||
case HMSTATUS.resumeNotFound:
|
||||
msg = M2C( this.msgs.resumeNotFound.msg, 'yellow' );
|
||||
break;
|
||||
|
||||
case HMSTATUS.missingCommand:
|
||||
msg = M2C( this.msgs.missingCommand.msg + " (", 'yellow');
|
||||
msg += Object.keys( FCMD.verbs ).map( function(v, idx, ar) {
|
||||
return (idx === ar.length - 1 ? chalk.yellow('or ') : '') +
|
||||
chalk.yellow.bold(v.toUpperCase());
|
||||
}).join( chalk.yellow(', ')) + chalk.yellow(").\n\n");
|
||||
|
||||
msg += chalk.gray(FS.readFileSync(
|
||||
PATH.resolve(__dirname, '../cli/use.txt'), 'utf8' ));
|
||||
break;
|
||||
|
||||
case HMSTATUS.invalidCommand:
|
||||
msg = printf( M2C( this.msgs.invalidCommand.msg, 'yellow'), ex.attempted );
|
||||
break;
|
||||
|
||||
case HMSTATUS.resumeNotFoundAlt:
|
||||
msg = M2C( this.msgs.resumeNotFoundAlt.msg, 'yellow' );
|
||||
break;
|
||||
|
||||
case HMSTATUS.inputOutputParity:
|
||||
msg = M2C( this.msgs.inputOutputParity.msg );
|
||||
break;
|
||||
|
||||
case HMSTATUS.createNameMissing:
|
||||
msg = M2C( this.msgs.createNameMissing.msg );
|
||||
break;
|
||||
|
||||
case HMSTATUS.pdfGeneration:
|
||||
msg = M2C( this.msgs.pdfGeneration.msg, 'bold' );
|
||||
if( ex.inner ) msg += chalk.red('\n' + ex.inner);
|
||||
withStack = true; quit = false; etype = 'error';
|
||||
break;
|
||||
|
||||
case HMSTATUS.invalid:
|
||||
msg = M2C( this.msgs.invalid.msg, 'red' );
|
||||
etype = 'error';
|
||||
break;
|
||||
|
||||
case HMSTATUS.generateError:
|
||||
msg = (ex.inner && ex.inner.toString()) || ex;
|
||||
quit = false;
|
||||
etype = 'error';
|
||||
break;
|
||||
|
||||
case HMSTATUS.fileSaveError:
|
||||
msg = printf( M2C( this.msgs.fileSaveError.msg ), (ex.inner || ex).toString() );
|
||||
etype = 'error';
|
||||
quit = false;
|
||||
break;
|
||||
|
||||
case HMSTATUS.invalidFormat:
|
||||
ex.data.forEach(function(d){
|
||||
msg += printf( M2C( this.msgs.invalidFormat.msg, 'bold' ),
|
||||
ex.theme.name.toUpperCase(), d.format.toUpperCase());
|
||||
}, this);
|
||||
break;
|
||||
|
||||
case HMSTATUS.missingParam:
|
||||
msg = printf( M2C( this.msgs.missingParam.msg ), ex.expected, ex.helper );
|
||||
break;
|
||||
|
||||
case HMSTATUS.invalidHelperUse:
|
||||
msg = printf( M2C( this.msgs.invalidHelperUse.msg ), ex.helper );
|
||||
if( ex.error ) {
|
||||
msg += '\n--> ' + assembleError.call( this, extend( true, {}, ex, {fluenterror: ex.error} )).msg;
|
||||
//msg += printf( '\n--> ' + M2C( this.msgs.invalidParamCount.msg ), ex.expected );
|
||||
}
|
||||
quit = false;
|
||||
etype = 'warning';
|
||||
break;
|
||||
|
||||
case HMSTATUS.notOnPath:
|
||||
msg = printf( M2C(this.msgs.notOnPath.msg, 'bold'), ex.engine);
|
||||
quit = false;
|
||||
etype = 'error';
|
||||
break;
|
||||
|
||||
case HMSTATUS.readError:
|
||||
if( !ex.quiet )
|
||||
console.error(printf( M2C(this.msgs.readError.msg, 'red'), ex.file));
|
||||
msg = ex.inner.toString();
|
||||
etype = 'error';
|
||||
break;
|
||||
|
||||
case HMSTATUS.mixedMerge:
|
||||
msg = M2C( this.msgs.mixedMerge.msg );
|
||||
quit = false;
|
||||
break;
|
||||
|
||||
case HMSTATUS.invokeTemplate:
|
||||
msg = M2C( this.msgs.invokeTemplate.msg, 'red' );
|
||||
msg += M2C( '\n' + WRAP(ex.inner.toString(), { width: 60, indent: ' ' }), 'gray' );
|
||||
etype = 'custom';
|
||||
break;
|
||||
|
||||
case HMSTATUS.compileTemplate:
|
||||
etype = 'error';
|
||||
break;
|
||||
|
||||
case HMSTATUS.themeLoad:
|
||||
msg = M2C( printf( this.msgs.themeLoad.msg, ex.attempted.toUpperCase() ), 'red');
|
||||
if( ex.inner && ex.inner.fluenterror ) {
|
||||
msg += M2C('\nError: ', 'red') + assembleError.call( this, ex.inner ).msg;
|
||||
}
|
||||
quit = true;
|
||||
etype = 'custom';
|
||||
break;
|
||||
|
||||
case HMSTATUS.parseError:
|
||||
if( SyntaxErrorEx.is( ex.inner )) {
|
||||
console.error( printf( M2C(this.msgs.readError.msg, 'red'), ex.file ) );
|
||||
var se = new SyntaxErrorEx( ex, ex.raw );
|
||||
msg = printf( M2C( this.msgs.parseError.msg, 'red' ),
|
||||
se.line, se.col);
|
||||
}
|
||||
else if( ex.inner && ex.inner.line !== undefined && ex.inner.col !== undefined ) {
|
||||
msg = printf( M2C( this.msgs.parseError.msg, 'red' ),
|
||||
ex.inner.line, ex.inner.col);
|
||||
}
|
||||
else {
|
||||
msg = ex;
|
||||
}
|
||||
etype = 'error';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
msg: msg, // The error message to display
|
||||
withStack: withStack, // Whether to include the stack
|
||||
quit: quit,
|
||||
etype: etype
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}());
|
331
src/cli/main.js
Normal file
331
src/cli/main.js
Normal file
@ -0,0 +1,331 @@
|
||||
/**
|
||||
Definition of the `main` function.
|
||||
@module cli/main
|
||||
@license MIT. See LICENSE.md for details.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
(function(){
|
||||
|
||||
|
||||
|
||||
var HMR = require( 'hackmycore')
|
||||
, PKG = require('../../package.json')
|
||||
, FS = require('fs')
|
||||
, EXTEND = require('extend')
|
||||
, chalk = require('chalk')
|
||||
, PATH = require('path')
|
||||
, HMSTATUS = require('hackmycore/src/core/status-codes')
|
||||
, HME = require('hackmycore/src/core/event-codes')
|
||||
, safeLoadJSON = require('hackmycore/src/utils/safe-json-loader')
|
||||
, StringUtils = require('hackmycore/src/utils/string.js')
|
||||
, _ = require('underscore')
|
||||
, OUTPUT = require('./out')
|
||||
, PAD = require('string-padding')
|
||||
, Command = require('commander').Command;
|
||||
|
||||
var _opts = { };
|
||||
var _title = chalk.white.bold('\n*** HackMyResume v' +PKG.version+ ' ***');
|
||||
var _out = new OUTPUT( _opts );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
A callable implementation of the HackMyResume CLI. Encapsulates the command
|
||||
line interface as a single method accepting a parameter array.
|
||||
@alias module:cli/main.main
|
||||
@param rawArgs {Array} An array of command-line parameters. Will either be
|
||||
process.argv (in production) or custom parameters (in test).
|
||||
*/
|
||||
var main = module.exports = function( rawArgs ) {
|
||||
|
||||
var initInfo = initialize( rawArgs );
|
||||
var args = initInfo.args;
|
||||
|
||||
// Create the top-level (application) command...
|
||||
var program = new Command('hackmyresume')
|
||||
.version(PKG.version)
|
||||
.description(chalk.yellow.bold('*** HackMyResume ***'))
|
||||
.option('-s --silent', 'Run in silent mode')
|
||||
.option('--no-color', 'Disable colors')
|
||||
.option('--color', 'Enable colors')
|
||||
.option('-d --debug', 'Enable diagnostics', false)
|
||||
.option('-a --assert', 'Treat warnings as errors', false)
|
||||
.option('-v --version', 'Show the version')
|
||||
.allowUnknownOption();
|
||||
program.jsonArgs = initInfo.options;
|
||||
|
||||
// Create the NEW command
|
||||
program
|
||||
.command('new')
|
||||
.arguments('<sources...>')
|
||||
.option('-f --format <fmt>', 'FRESH or JRS format', 'FRESH')
|
||||
.alias('create')
|
||||
.description('Create resume(s) in FRESH or JSON RESUME format.')
|
||||
.action(function( sources ) {
|
||||
execute.call( this, sources, [], this.opts(), logMsg);
|
||||
});
|
||||
|
||||
// Create the VALIDATE command
|
||||
program
|
||||
.command('validate')
|
||||
.arguments('<sources...>')
|
||||
.description('Validate a resume in FRESH or JSON RESUME format.')
|
||||
.action(function(sources) {
|
||||
execute.call( this, sources, [], this.opts(), logMsg);
|
||||
});
|
||||
|
||||
// Create the CONVERT command
|
||||
program
|
||||
.command('convert')
|
||||
.description('Convert a resume to/from FRESH or JSON RESUME format.')
|
||||
.action(function() {
|
||||
var x = splitSrcDest.call( this );
|
||||
execute.call( this, x.src, x.dst, this.opts(), logMsg);
|
||||
});
|
||||
|
||||
// Create the ANALYZE command
|
||||
program
|
||||
.command('analyze')
|
||||
.arguments('<sources...>')
|
||||
.description('Analyze one or more resumes.')
|
||||
.action(function( sources ) {
|
||||
execute.call( this, sources, [], this.opts(), logMsg);
|
||||
});
|
||||
|
||||
// Create the PEEK command
|
||||
program
|
||||
.command('peek')
|
||||
.arguments('<sources...>')
|
||||
.description('Peek at a resume field or section')
|
||||
.action(function( sources, sectionOrField ) {
|
||||
var dst = (sources && sources.length > 1) ? [sources.pop()] : [];
|
||||
execute.call( this, sources, dst, this.opts(), logMsg);
|
||||
});
|
||||
|
||||
// Create the BUILD command
|
||||
program
|
||||
.command('build')
|
||||
.alias('generate')
|
||||
.option('-t --theme <theme>', 'Theme name or path')
|
||||
.option('-n --no-prettify', 'Disable HTML prettification', true)
|
||||
.option('-c --css <option>', 'CSS linking / embedding')
|
||||
.option('-p --pdf <engine>', 'PDF generation engine')
|
||||
.option('--no-sort', 'Sort resume sections by date', false)
|
||||
.option('--tips', 'Display theme tips and warnings.', false)
|
||||
.description('Generate resume to multiple formats')
|
||||
.action(function( sources, targets, options ) {
|
||||
var x = splitSrcDest.call( this );
|
||||
execute.call( this, x.src, x.dst, this.opts(), logMsg);
|
||||
});
|
||||
|
||||
program.parse( args );
|
||||
|
||||
if (!program.args.length) { throw { fluenterror: 4 }; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** Massage command-line args and setup Commander.js. */
|
||||
function initialize( ar ) {
|
||||
|
||||
var o = initOptions( ar );
|
||||
|
||||
o.silent || logMsg( _title );
|
||||
|
||||
// Emit debug prelude if --debug was specified
|
||||
if( o.debug ) {
|
||||
_out.log(chalk.cyan('The -d or --debug switch was specified. DEBUG mode engaged.'));
|
||||
_out.log('');
|
||||
_out.log(chalk.cyan(PAD(' Platform:',25, null, PAD.RIGHT)) + chalk.cyan.bold( process.platform === 'win32' ? 'windows' : process.platform ));
|
||||
_out.log(chalk.cyan(PAD(' Node.js:',25, null, PAD.RIGHT)) + chalk.cyan.bold( process.version ));
|
||||
_out.log(chalk.cyan(PAD(' HackMyResume:',25, null, PAD.RIGHT)) + chalk.cyan.bold('v' + PKG.version ));
|
||||
_out.log(chalk.cyan(PAD(' FRESCA:',25, null, PAD.RIGHT)) + chalk.cyan.bold( PKG.dependencies.fresca ));
|
||||
//_out.log(chalk.cyan(PAD(' fresh-themes:',25, null, PAD.RIGHT)) + chalk.cyan.bold( PKG.dependencies['fresh-themes'] ));
|
||||
//_out.log(chalk.cyan(PAD(' fresh-jrs-converter:',25, null, PAD.RIGHT)) + chalk.cyan.bold( PKG.dependencies['fresh-jrs-converter'] ));
|
||||
_out.log('');
|
||||
}
|
||||
|
||||
// Handle invalid verbs here (a bit easier here than in commander.js)...
|
||||
if( o.verb && !HMR.verbs[ o.verb ] && !HMR.alias[ o.verb ] ) {
|
||||
throw { fluenterror: HMSTATUS.invalidCommand, quit: true,
|
||||
attempted: o.orgVerb };
|
||||
}
|
||||
|
||||
// Override the .missingArgument behavior
|
||||
Command.prototype.missingArgument = function(name) {
|
||||
if( this.name() !== 'new' ) {
|
||||
throw { fluenterror: HMSTATUS.resumeNotFound, quit: true };
|
||||
}
|
||||
};
|
||||
|
||||
// Override the .helpInformation behavior
|
||||
Command.prototype.helpInformation = function() {
|
||||
var manPage = FS.readFileSync(
|
||||
PATH.join(__dirname, 'use.txt'), 'utf8' );
|
||||
return chalk.green.bold(manPage);
|
||||
};
|
||||
|
||||
return {
|
||||
args: o.args,
|
||||
options: o.json
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Init options prior to setting up command infrastructure. */
|
||||
function initOptions( ar ) {
|
||||
var oVerb, verb = '', args = ar.slice(), cleanArgs = args.slice(2), oJSON;
|
||||
if( cleanArgs.length ) {
|
||||
|
||||
// Support case-insensitive sub-commands (build, generate, validate, etc)
|
||||
var vidx = _.findIndex( cleanArgs, function(v){ return v[0] !== '-'; });
|
||||
if( vidx !== -1 ) {
|
||||
oVerb = cleanArgs[ vidx ];
|
||||
verb = args[ vidx + 2 ] = oVerb.trim().toLowerCase();
|
||||
}
|
||||
|
||||
// Remove --options --opts -o and process separately
|
||||
var optsIdx = _.findIndex( cleanArgs, function(v){
|
||||
return v === '-o' || v === '--options' || v === '--opts';
|
||||
});
|
||||
if(optsIdx !== -1) {
|
||||
var optStr = cleanArgs[ optsIdx + 1];
|
||||
args.splice( optsIdx + 2, 2 );
|
||||
if( optStr && (optStr = optStr.trim()) ) {
|
||||
//var myJSON = JSON.parse(optStr);
|
||||
if( optStr[0] === '{')
|
||||
oJSON = eval('(' + optStr + ')'); // jshint ignore:line
|
||||
else {
|
||||
var inf = safeLoadJSON( optStr );
|
||||
if( !inf.ex )
|
||||
oJSON = inf.json;
|
||||
// TODO: Error handling
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Grab the --debug flag
|
||||
var isDebug = _.some( args, function(v) {
|
||||
return v === '-d' || v === '--debug';
|
||||
});
|
||||
|
||||
// Grab the --silent flag
|
||||
var isSilent = _.some( args, function(v) {
|
||||
return v === '-s' || v === '--silent';
|
||||
});
|
||||
|
||||
return {
|
||||
debug: isDebug,
|
||||
silent: isSilent,
|
||||
orgVerb: oVerb,
|
||||
verb: verb,
|
||||
json: oJSON,
|
||||
args: args
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Invoke a HackMyResume verb. */
|
||||
function execute( src, dst, opts, log ) {
|
||||
|
||||
loadOptions.call( this, opts, this.parent.jsonArgs );
|
||||
var hand = require( './error' );
|
||||
hand.init( _opts.debug, _opts.assert, _opts.silent );
|
||||
var v = new HMR.verbs[ this.name() ]();
|
||||
_opts.errHandler = v;
|
||||
_out.init( _opts );
|
||||
v.on( 'hmr:status', function() { _out.do.apply( _out, arguments ); });
|
||||
v.on( 'hmr:error', function() {
|
||||
hand.err.apply( hand, arguments );
|
||||
});
|
||||
v.invoke.call( v, src, dst, _opts, log );
|
||||
if( v.errorCode )
|
||||
process.exit(v.errorCode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Initialize HackMyResume options.
|
||||
TODO: Options loading is a little hacky, for two reasons:
|
||||
- Commander.js idiosyncracies
|
||||
- Need to accept JSON inputs from the command line.
|
||||
*/
|
||||
function loadOptions( o, cmdO ) {
|
||||
|
||||
// o and this.opts() seem to be the same (command-specific options)
|
||||
|
||||
// Load the specified options file (if any) and apply options
|
||||
if( cmdO )
|
||||
o = EXTEND(true, o, cmdO);
|
||||
|
||||
// Merge in command-line options
|
||||
o = EXTEND( true, o, this.opts() );
|
||||
|
||||
// Kludge parent-level options until piping issue is resolved
|
||||
if( this.parent.silent !== undefined && this.parent.silent !== null)
|
||||
o.silent = this.parent.silent;
|
||||
if( this.parent.debug !== undefined && this.parent.debug !== null)
|
||||
o.debug = this.parent.debug;
|
||||
if( this.parent.assert !== undefined && this.parent.assert !== null)
|
||||
o.assert = this.parent.assert;
|
||||
|
||||
if( o.debug ) {
|
||||
logMsg(chalk.cyan('OPTIONS:') + '\n');
|
||||
_.each(o, function(val, key) {
|
||||
logMsg(chalk.cyan(' %s') + chalk.cyan.bold(' %s'),
|
||||
PAD(key,22,null,PAD.RIGHT), val);
|
||||
});
|
||||
logMsg('');
|
||||
}
|
||||
|
||||
// Cache
|
||||
EXTEND(true, _opts, o);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Split multiple command-line filenames by the 'TO' keyword */
|
||||
function splitSrcDest() {
|
||||
|
||||
var params = this.parent.args.filter(function(j) { return String.is(j); });
|
||||
if( params.length === 0 )
|
||||
throw { fluenterror: HMSTATUS.resumeNotFound, quit: true };
|
||||
|
||||
// Find the TO keyword, if any
|
||||
var splitAt = _.findIndex( params, function(p) {
|
||||
return p.toLowerCase() === 'to';
|
||||
});
|
||||
|
||||
// TO can't be the last keyword
|
||||
if( splitAt === params.length - 1 && splitAt !== -1 ) {
|
||||
logMsg(chalk.yellow('Please ') +
|
||||
chalk.yellow.bold('specify an output file') +
|
||||
chalk.yellow(' for this operation or ') +
|
||||
chalk.yellow.bold('omit the TO keyword') +
|
||||
chalk.yellow('.') );
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
src: params.slice(0, splitAt === -1 ? undefined : splitAt ),
|
||||
dst: splitAt === -1 ? [] : params.slice( splitAt + 1 )
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Simple logging placeholder. */
|
||||
function logMsg() {
|
||||
_opts.silent || console.log.apply( console.log, arguments );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}());
|
18
src/cli/msg.js
Normal file
18
src/cli/msg.js
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
Message-handling routines for HackMyResume.
|
||||
@module msg.js
|
||||
@license MIT. See LICENSE.md for details.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
var PATH = require('path');
|
||||
var YAML = require('yamljs');
|
||||
|
||||
var cache = module.exports = function() {
|
||||
return cache ? cache : YAML.load( PATH.join(__dirname, 'msg.yml') );
|
||||
}();
|
||||
|
||||
}());
|
98
src/cli/msg.yml
Normal file
98
src/cli/msg.yml
Normal file
@ -0,0 +1,98 @@
|
||||
events:
|
||||
begin:
|
||||
msg: Invoking **%s** command.
|
||||
beforeCreate:
|
||||
msg: Creating new **%s** resume: **%s**
|
||||
afterRead:
|
||||
msg: Reading **%s** resume: **%s**
|
||||
beforeTheme:
|
||||
msg: Verifying **%s** theme.
|
||||
afterTheme:
|
||||
msg: Verifying outputs: ???
|
||||
beforeMerge:
|
||||
msg:
|
||||
- "Merging **%s**"
|
||||
- " onto **%s**"
|
||||
applyTheme:
|
||||
msg: Applying **%s** theme (**%s** format%s)
|
||||
afterBuild:
|
||||
msg:
|
||||
- "The **%s** theme says:"
|
||||
- |
|
||||
"For best results view JSON Resume themes over a
|
||||
local or remote HTTP connection. For example:
|
||||
|
||||
npm install http-server -g
|
||||
http-server <resume-folder>
|
||||
|
||||
For more information, see the README."
|
||||
afterGenerate:
|
||||
msg:
|
||||
- " (with %s)"
|
||||
- "Skipping %s resume: %s"
|
||||
- "Generating **%s** resume: **%s**"
|
||||
beforeAnalyze:
|
||||
msg: "Analyzing **%s** resume: **%s**"
|
||||
beforeConvert:
|
||||
msg: "Converting **%s** (**%s**) to **%s** (**%s**)"
|
||||
afterValidate:
|
||||
msg:
|
||||
- "Validating **%s** against the **%s** schema: "
|
||||
- "VALID!"
|
||||
- "INVALID"
|
||||
- "BROKEN"
|
||||
beforePeek:
|
||||
msg:
|
||||
- Peeking at **%s** in **%s**
|
||||
- Peeking at **%s**
|
||||
afterPeek:
|
||||
msg: "The specified key **%s** was not found in **%s**."
|
||||
afterInlineConvert:
|
||||
msg: Converting **%s** to **%s** format.
|
||||
errors:
|
||||
themeNotFound:
|
||||
msg: >
|
||||
**Couldn't find the '%s' theme.** Please specify the name of a preinstalled
|
||||
FRESH theme or the path to a locally installed FRESH or JSON Resume theme.
|
||||
copyCSS:
|
||||
msg: Couldn't copy CSS file to destination folder.
|
||||
resumeNotFound:
|
||||
msg: Please **feed me a resume** in FRESH or JSON Resume format.
|
||||
missingCommand:
|
||||
msg: Please **give me a command**
|
||||
invalidCommand:
|
||||
msg: Invalid command: '%s'
|
||||
resumeNotFoundAlt:
|
||||
msg: Please **feed me a resume** in either FRESH or JSON Resume format.
|
||||
inputOutputParity:
|
||||
msg: Please **specify an output file name** for every input file you wish to convert.
|
||||
createNameMissing:
|
||||
msg: Please **specify the filename** of the resume to create.
|
||||
pdfGeneration:
|
||||
msg: PDF generation failed. Make sure wkhtmltopdf is installed and accessible from your path.
|
||||
invalid:
|
||||
msg: Validation failed and the --assert option was specified.
|
||||
invalidFormat:
|
||||
msg: The **%s** theme doesn't support the **%s** format.
|
||||
notOnPath:
|
||||
msg: %s wasn't found on your system path or is inaccessible. PDF not generated.
|
||||
readError:
|
||||
msg: Reading **???** resume: **%s**
|
||||
parseError:
|
||||
msg: Invalid or corrupt JSON on line %s column %s.
|
||||
invalidHelperUse:
|
||||
msg: "**Warning**: Incorrect use of the **%s** theme helper."
|
||||
fileSaveError:
|
||||
msg: An error occurred while writing %s to disk: %s.
|
||||
mixedMerge:
|
||||
msg: "**Warning:** merging mixed resume types. Errors may occur."
|
||||
invokeTemplate:
|
||||
msg: "An error occurred during template invocation."
|
||||
compileTemplate:
|
||||
msg: "An error occurred during template compilation."
|
||||
themeLoad:
|
||||
msg: "Applying **%s** theme (? formats)"
|
||||
invalidParamCount:
|
||||
msg: "Invalid number of parameters. Expected: **%s**."
|
||||
missingParam:
|
||||
msg: The '**%s**' parameter was needed but not supplied.
|
229
src/cli/out.js
Normal file
229
src/cli/out.js
Normal file
@ -0,0 +1,229 @@
|
||||
/**
|
||||
Output routines for HackMyResume.
|
||||
@license MIT. See LICENSE.md for details.
|
||||
@module out.js
|
||||
*/
|
||||
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
|
||||
var chalk = require('chalk')
|
||||
, HME = require('hackmycore/src/core/event-codes')
|
||||
, _ = require('underscore')
|
||||
, Class = require('hackmycore/src/utils/class.js')
|
||||
, M2C = require('hackmycore/src/utils/md2chalk.js')
|
||||
, PATH = require('path')
|
||||
, LO = require('lodash')
|
||||
, FS = require('fs')
|
||||
, EXTEND = require('extend')
|
||||
, HANDLEBARS = require('handlebars')
|
||||
, YAML = require('yamljs')
|
||||
, printf = require('printf')
|
||||
, pad = require('string-padding')
|
||||
, dbgStyle = 'cyan';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
A stateful output module. All HMR console output handled here.
|
||||
*/
|
||||
var OutputHandler = module.exports = Class.extend({
|
||||
|
||||
|
||||
|
||||
init: function( opts ) {
|
||||
this.opts = EXTEND( true, this.opts || { }, opts );
|
||||
this.msgs = YAML.load(PATH.join( __dirname, 'msg.yml' )).events;
|
||||
},
|
||||
|
||||
|
||||
|
||||
log: function( msg ) {
|
||||
msg = msg || '';
|
||||
var printf = require('printf');
|
||||
var finished = printf.apply( printf, arguments );
|
||||
this.opts.silent || console.log( finished );
|
||||
},
|
||||
|
||||
|
||||
|
||||
do: function( evt ) {
|
||||
|
||||
var that = this;
|
||||
function L() {
|
||||
that.log.apply( that, arguments );
|
||||
}
|
||||
|
||||
switch( evt.sub ) {
|
||||
|
||||
case HME.begin:
|
||||
this.opts.debug &&
|
||||
L( M2C( this.msgs.begin.msg, dbgStyle), evt.cmd.toUpperCase() );
|
||||
break;
|
||||
|
||||
case HME.error:
|
||||
break;
|
||||
|
||||
case HME.beforeCreate:
|
||||
L( M2C( this.msgs.beforeCreate.msg, 'green' ), evt.fmt, evt.file );
|
||||
break;
|
||||
|
||||
case HME.beforeRead:
|
||||
break;
|
||||
|
||||
case HME.afterRead:
|
||||
break;
|
||||
|
||||
case HME.beforeTheme:
|
||||
this.opts.debug &&
|
||||
L( M2C( this.msgs.beforeTheme.msg, dbgStyle), evt.theme.toUpperCase() );
|
||||
break;
|
||||
|
||||
case HME.afterParse:
|
||||
L(
|
||||
M2C( this.msgs.afterRead.msg, 'gray', 'white.dim'), evt.fmt.toUpperCase(), evt.file
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case HME.afterTheme:
|
||||
break;
|
||||
|
||||
case HME.beforeMerge:
|
||||
var msg = '';
|
||||
evt.f.reverse().forEach( function( a, idx ) {
|
||||
msg += printf(
|
||||
((idx === 0) ?
|
||||
this.msgs.beforeMerge.msg[0] :
|
||||
this.msgs.beforeMerge.msg[1] ), a.file
|
||||
);
|
||||
}, this);
|
||||
L( M2C(msg, evt.mixed ? 'yellow' : 'gray', 'white.dim') );
|
||||
break;
|
||||
|
||||
case HME.afterMerge:
|
||||
break;
|
||||
|
||||
case HME.applyTheme:
|
||||
this.theme = evt.theme;
|
||||
var numFormats = Object.keys( evt.theme.formats ).length;
|
||||
L( M2C(this.msgs.applyTheme.msg, evt.status === 'error' ? 'red' : 'gray', evt.status === 'error' ? 'bold' : 'white.dim'),
|
||||
evt.theme.name.toUpperCase(),
|
||||
numFormats, ( numFormats === 1 ? '' : 's') );
|
||||
break;
|
||||
|
||||
case HME.end:
|
||||
if( evt.cmd === 'build' ) {
|
||||
var themeName = this.theme.name.toUpperCase();
|
||||
if( this.opts.tips && (this.theme.message || this.theme.render) ) {
|
||||
var WRAP = require('word-wrap');
|
||||
if( this.theme.message ) {
|
||||
L( M2C( this.msgs.afterBuild.msg[0], 'cyan' ), themeName );
|
||||
L( M2C( this.theme.message, 'white' ));
|
||||
}
|
||||
else if ( this.theme.render ) {
|
||||
L( M2C( this.msgs.afterBuild.msg[0], 'cyan'), themeName);
|
||||
L( M2C( this.msgs.afterBuild.msg[1], 'white'));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case HME.afterGenerate:
|
||||
var suffix = '';
|
||||
if( evt.fmt === 'pdf' ) {
|
||||
if( this.opts.pdf ) {
|
||||
if( this.opts.pdf !== 'none' ) {
|
||||
suffix = printf( M2C( this.msgs.afterGenerate.msg[0], evt.error ? 'red' : 'green' ), this.opts.pdf );
|
||||
}
|
||||
else {
|
||||
L( M2C( this.msgs.afterGenerate.msg[1], 'gray' ),
|
||||
evt.fmt.toUpperCase(), evt.file );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
L( M2C( this.msgs.afterGenerate.msg[2] + suffix, evt.error ? 'red' : 'green' ),
|
||||
pad(evt.fmt.toUpperCase(),4,null,pad.RIGHT),
|
||||
PATH.relative(process.cwd(), evt.file ));
|
||||
break;
|
||||
|
||||
case HME.beforeAnalyze:
|
||||
L( M2C( this.msgs.beforeAnalyze.msg, 'green' ), evt.fmt, evt.file);
|
||||
break;
|
||||
|
||||
case HME.afterAnalyze:
|
||||
var info = evt.info;
|
||||
var rawTpl = FS.readFileSync( PATH.join( __dirname, 'analyze.hbs' ), 'utf8');
|
||||
HANDLEBARS.registerHelper( require('../helpers/console-helpers') );
|
||||
var template = HANDLEBARS.compile(rawTpl, { strict: false, assumeObjects: false });
|
||||
var tot = 0;
|
||||
info.keywords.forEach(function(g) { tot += g.count; });
|
||||
info.keywords.totalKeywords = tot;
|
||||
var output = template( info );
|
||||
this.log( chalk.cyan(output) );
|
||||
break;
|
||||
|
||||
case HME.beforeConvert:
|
||||
L( M2C( this.msgs.beforeConvert.msg, 'green' ),
|
||||
evt.srcFile, evt.srcFmt, evt.dstFile, evt.dstFmt
|
||||
);
|
||||
break;
|
||||
|
||||
case HME.afterInlineConvert:
|
||||
L( M2C( this.msgs.afterInlineConvert.msg, 'gray', 'white.dim' ),
|
||||
evt.file, evt.fmt );
|
||||
break;
|
||||
|
||||
case HME.afterValidate:
|
||||
var style = evt.isValid ? 'green' : 'yellow';
|
||||
L(
|
||||
M2C( this.msgs.afterValidate.msg[0], 'white' ) +
|
||||
chalk[style].bold( evt.isValid ?
|
||||
this.msgs.afterValidate.msg[1] :
|
||||
this.msgs.afterValidate.msg[2] ),
|
||||
evt.file, evt.fmt
|
||||
);
|
||||
|
||||
if( evt.errors ) {
|
||||
_.each(evt.errors, function(err,idx) {
|
||||
L( chalk.yellow.bold('--> ') +
|
||||
chalk.yellow(err.field.replace('data.','resume.').toUpperCase() + ' ' +
|
||||
err.message) );
|
||||
}, this);
|
||||
}
|
||||
break;
|
||||
|
||||
case HME.beforePeek:
|
||||
// if( evt.target )
|
||||
// L(M2C(this.msgs.beforePeek.msg[0], evt.isError ? 'red' : 'green'), evt.target, evt.file);
|
||||
// else
|
||||
// L(M2C(this.msgs.beforePeek.msg[1], evt.isError ? 'red' : 'green'), evt.file);
|
||||
break;
|
||||
|
||||
case HME.afterPeek:
|
||||
var sty = evt.error ? 'red' : ( evt.target !== undefined ? 'green' : 'yellow' );
|
||||
if( evt.requested )
|
||||
L(M2C(this.msgs.beforePeek.msg[0], sty), evt.requested, evt.file);
|
||||
else
|
||||
L(M2C(this.msgs.beforePeek.msg[1], sty), evt.file);
|
||||
|
||||
if( evt.target !== undefined )
|
||||
console.dir( evt.target, { depth: null, colors: true } );
|
||||
else if( !evt.error )
|
||||
L(M2C( this.msgs.afterPeek.msg, 'yellow'), evt.requested, evt.file);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}());
|
51
src/cli/use.txt
Normal file
51
src/cli/use.txt
Normal file
@ -0,0 +1,51 @@
|
||||
Usage:
|
||||
|
||||
hackmyresume <command> <sources> [TO <targets>] [<options>]
|
||||
|
||||
Available commands:
|
||||
|
||||
BUILD Build your resume to the destination format(s).
|
||||
ANALYZE Analyze your resume for keywords, gaps, and metrics.
|
||||
VALIDATE Validate your resume for errors and typos.
|
||||
CONVERT Convert your resume between FRESH and JSON Resume.
|
||||
NEW Create a new resume in FRESH or JSON Resume format.
|
||||
PEEK View a specific field or element on your resume.
|
||||
|
||||
Available options:
|
||||
|
||||
--theme -t Path to a FRESH or JSON Resume theme.
|
||||
--pdf -p Specify the PDF engine to use (wkhtmltopdf or phantom).
|
||||
--options -o Load options from an external JSON file.
|
||||
--format -f The format (FRESH or JSON Resume) to use.
|
||||
--debug -d Emit extended debugging info.
|
||||
--assert -a Treat resume validation warnings as errors.
|
||||
--no-colors Disable terminal colors.
|
||||
--tips Display theme messages and tips.
|
||||
--help -h Display help documentation.
|
||||
--version -v Display the current version.
|
||||
|
||||
Not all options are supported for all commands. For example, the
|
||||
--theme option is only supported for the BUILD command.
|
||||
|
||||
Examples:
|
||||
|
||||
hackmyresume BUILD resume.json TO out/resume.all --theme modern
|
||||
hackmyresume ANALYZE resume.json
|
||||
hackmyresume NEW my-new-resume.json --format JRS
|
||||
hackmyresume CONVERT resume-fresh.json TO resume-jrs.json
|
||||
hackmyresume VALIDATE resume.json
|
||||
hackmyresume PEEK resume.json employment[2].summary
|
||||
|
||||
Tips:
|
||||
|
||||
- You can specify multiple sources and/or targets for all commands.
|
||||
- You can use any FRESH or JSON Resume theme with HackMyResume.
|
||||
- Specify a file extension of .all to generate your resume to all
|
||||
available formats supported by the theme. (BUILD command.)
|
||||
- The --theme parameter can specify either the name of a preinstalled
|
||||
theme, or the path to a local FRESH or JSON Resume theme.
|
||||
- Visit https://www.npmjs.com/search?q=jsonresume-theme for a full
|
||||
listing of all available JSON Resume themes.
|
||||
- Visit https://github.com/fluentdesk/fresh-themes for a complete
|
||||
listing of all available FRESH themes.
|
||||
- Report bugs to https://githut.com/hacksalot/HackMyResume/issues.
|
@ -1,291 +0,0 @@
|
||||
/**
|
||||
FRESH to JSON Resume conversion routiens.
|
||||
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk
|
||||
*/
|
||||
|
||||
(function(){
|
||||
|
||||
/**
|
||||
Convert between FRESH and JRS resume/CV formats.
|
||||
@class FRESHConverter
|
||||
*/
|
||||
var FRESHConverter = module.exports = {
|
||||
|
||||
|
||||
/**
|
||||
Convert from JSON Resume format to FRESH.
|
||||
*/
|
||||
toFRESH: function( src, foreign ) {
|
||||
|
||||
foreign = (foreign === undefined || foreign === null) ? true : foreign;
|
||||
|
||||
return {
|
||||
|
||||
name: src.basics.name,
|
||||
|
||||
info: {
|
||||
label: src.basics.label,
|
||||
class: src.basics.class, // <--> round-trip
|
||||
image: src.basics.picture,
|
||||
brief: src.basics.summary
|
||||
},
|
||||
|
||||
contact: {
|
||||
email: src.basics.email,
|
||||
phone: src.basics.phone,
|
||||
website: src.basics.website,
|
||||
other: src.basics.other // <--> round-trip
|
||||
},
|
||||
|
||||
meta: meta( true, src.meta ),
|
||||
|
||||
location: {
|
||||
city: src.basics.location.city,
|
||||
region: src.basics.location.region,
|
||||
country: src.basics.location.countryCode,
|
||||
code: src.basics.location.postalCode,
|
||||
address: src.basics.location.address
|
||||
},
|
||||
|
||||
employment: {
|
||||
history: src.work.map( function( job ) {
|
||||
return {
|
||||
position: job.position,
|
||||
employer: job.company,
|
||||
summary: job.summary,
|
||||
current: (!job.endDate || !job.endDate.trim() || job.endDate.trim().toLowerCase() === 'current') || undefined,
|
||||
start: job.startDate,
|
||||
end: job.endDate,
|
||||
url: job.website,
|
||||
keywords: "",
|
||||
highlights: job.highlights
|
||||
};
|
||||
})
|
||||
},
|
||||
|
||||
education: {
|
||||
history: src.education.map(function(edu){
|
||||
return {
|
||||
institution: edu.institution,
|
||||
start: edu.startDate,
|
||||
end: edu.endDate,
|
||||
grade: edu.gpa,
|
||||
curriculum: edu.courses,
|
||||
url: edu.website || edu.url || null,
|
||||
summary: null,
|
||||
area: edu.area,
|
||||
studyType: edu.studyType
|
||||
};
|
||||
})
|
||||
},
|
||||
|
||||
service: {
|
||||
history: src.volunteer.map(function(vol) {
|
||||
return {
|
||||
type: 'volunteer',
|
||||
position: vol.position,
|
||||
organization: vol.organization,
|
||||
start: vol.startDate,
|
||||
end: vol.endDate,
|
||||
url: vol.website,
|
||||
summary: vol.summary,
|
||||
highlights: vol.highlights
|
||||
};
|
||||
})
|
||||
},
|
||||
|
||||
skills: skillsToFRESH( src.skills ),
|
||||
|
||||
writing: src.publications.map(function(pub){
|
||||
return {
|
||||
title: pub.name,
|
||||
flavor: undefined,
|
||||
publisher: pub.publisher,
|
||||
url: pub.website,
|
||||
date: pub.releaseDate,
|
||||
summary: pub.summary
|
||||
};
|
||||
}),
|
||||
|
||||
recognition: src.awards.map(function(awd){
|
||||
return {
|
||||
title: awd.title,
|
||||
date: awd.date,
|
||||
summary: awd.summary,
|
||||
from: awd.awarder,
|
||||
url: null
|
||||
};
|
||||
}),
|
||||
|
||||
social: src.basics.profiles.map(function(pro){
|
||||
return {
|
||||
label: pro.network,
|
||||
network: pro.network,
|
||||
url: pro.url,
|
||||
user: pro.username
|
||||
};
|
||||
}),
|
||||
|
||||
interests: src.interests,
|
||||
references: src.references,
|
||||
languages: src.languages,
|
||||
disposition: src.disposition // <--> round-trip
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
Convert from FRESH format to JSON Resume.
|
||||
@param foreign True if non-JSON-Resume properties should be included in
|
||||
the result, false if those properties should be excluded.
|
||||
*/
|
||||
toJRS: function( src, foreign ) {
|
||||
|
||||
foreign = (foreign === undefined || foreign === null) ? false : foreign;
|
||||
|
||||
return {
|
||||
|
||||
basics: {
|
||||
name: src.name,
|
||||
label: src.info.label,
|
||||
class: foreign ? src.info.class : undefined,
|
||||
summary: src.info.brief,
|
||||
website: src.contact.website,
|
||||
phone: src.contact.phone,
|
||||
email: src.contact.email,
|
||||
picture: src.info.image,
|
||||
location: {
|
||||
address: src.location.address,
|
||||
postalCode: src.location.code,
|
||||
city: src.location.city,
|
||||
countryCode: src.location.country,
|
||||
region: src.location.region
|
||||
},
|
||||
profiles: src.social.map(function(soc){
|
||||
return {
|
||||
network: soc.network,
|
||||
username: soc.user,
|
||||
url: soc.url
|
||||
};
|
||||
})
|
||||
},
|
||||
|
||||
work: src.employment.history.map(function(emp){
|
||||
return {
|
||||
company: emp.employer,
|
||||
website: emp.url,
|
||||
position: emp.position,
|
||||
startDate: emp.start,
|
||||
endDate: emp.end,
|
||||
summary: emp.summary,
|
||||
highlights: emp.highlights
|
||||
};
|
||||
}),
|
||||
|
||||
education: src.education.history.map(function(edu){
|
||||
return {
|
||||
institution: edu.institution,
|
||||
gpa: edu.grade,
|
||||
courses: edu.curriculum,
|
||||
startDate: edu.start,
|
||||
endDate: edu.end,
|
||||
area: edu.area,
|
||||
studyType: edu.studyType
|
||||
};
|
||||
}),
|
||||
|
||||
skills: skillsToJRS( src.skills ),
|
||||
|
||||
volunteer: src.service.history.map(function(srv){
|
||||
return {
|
||||
flavor: foreign ? srv.flavor : undefined,
|
||||
organization: srv.organization,
|
||||
position: srv.position,
|
||||
startDate: srv.start,
|
||||
endDate: srv.end,
|
||||
website: srv.url,
|
||||
summary: srv.summary,
|
||||
highlights: srv.highlights
|
||||
};
|
||||
}),
|
||||
|
||||
awards: src.recognition.map(function(awd){
|
||||
return {
|
||||
flavor: foreign ? awd.flavor : undefined,
|
||||
url: foreign ? awd.url: undefined,
|
||||
title: awd.title,
|
||||
date: awd.date,
|
||||
awarder: awd.from,
|
||||
summary: awd.summary
|
||||
};
|
||||
}),
|
||||
|
||||
publications: src.writing.map(function(pub){
|
||||
return {
|
||||
name: pub.title,
|
||||
publisher: pub.publisher,
|
||||
releaseDate: pub.date,
|
||||
website: pub.url,
|
||||
summary: pub.summary
|
||||
};
|
||||
}),
|
||||
|
||||
interests: src.interests,
|
||||
references: src.references,
|
||||
samples: foreign ? src.samples : undefined,
|
||||
disposition: foreign ? src.disposition : undefined,
|
||||
languages: src.languages
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function meta( direction, obj ) {
|
||||
if( direction ) {
|
||||
obj = obj || { };
|
||||
obj.format = obj.format || "FRESH@0.1.0";
|
||||
obj.version = obj.version || "0.1.0";
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
function skillsToFRESH( skills ) {
|
||||
|
||||
return {
|
||||
sets: skills.map(function(set) {
|
||||
return {
|
||||
name: set.name,
|
||||
level: set.level,
|
||||
skills: set.keywords
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
function skillsToJRS( skills ) {
|
||||
var ret = [];
|
||||
if( skills.sets && skills.sets.length ) {
|
||||
ret = skills.sets.map(function(set){
|
||||
return {
|
||||
name: set.name,
|
||||
level: set.level,
|
||||
keywords: set.skills
|
||||
};
|
||||
});
|
||||
}
|
||||
else if( skills.list ) {
|
||||
ret = skills.list.map(function(sk){
|
||||
return {
|
||||
name: sk.name,
|
||||
level: sk.level,
|
||||
keywords: sk.keywords
|
||||
};
|
||||
});
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}());
|
@ -1,182 +0,0 @@
|
||||
{
|
||||
|
||||
"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": []
|
||||
}
|
||||
]
|
||||
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
{
|
||||
"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": [""]
|
||||
}]
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/**
|
||||
The FluentCV date representation.
|
||||
@license Copyright (c) 2015 by James M. Devlin. All rights reserved.
|
||||
*/
|
||||
|
||||
var moment = require('moment');
|
||||
|
||||
/**
|
||||
Create a FluentDate from a string or Moment date object. There are a few date
|
||||
formats to be aware of here.
|
||||
1. The words "Present" and "Now", referring to the current date
|
||||
2. The default "YYYY-MM-DD" format used in JSON Resume ("2015-02-10")
|
||||
3. Year-and-month only ("2015-04")
|
||||
4. Year-only "YYYY" ("2015")
|
||||
5. The friendly FluentCV "mmm YYYY" format ("Mar 2015" or "Dec 2008")
|
||||
6. Empty dates ("", " ")
|
||||
7. Any other date format that Moment.js can parse from
|
||||
Note: Moment can transparently parse all or most of these, without requiring us
|
||||
to specify a date format...but for maximum parsing safety and to avoid Moment
|
||||
deprecation warnings, it's recommended to either a) explicitly specify the date
|
||||
format or b) use an ISO format. For clarity, we handle these cases explicitly.
|
||||
@class FluentDate
|
||||
*/
|
||||
function FluentDate( dt ) {
|
||||
this.rep = this.fmt( dt );
|
||||
}
|
||||
|
||||
FluentDate/*.prototype*/.fmt = function( dt ) {
|
||||
if( (typeof dt === 'string' || dt instanceof String) ) {
|
||||
dt = dt.toLowerCase().trim();
|
||||
if( /^(present|now|current)$/.test(dt) ) { // "Present", "Now"
|
||||
return moment();
|
||||
}
|
||||
else if( /^\D+\s+\d{4}$/.test(dt) ) { // "Mar 2015"
|
||||
var parts = dt.split(' ');
|
||||
var month = (months[parts[0]] || abbr[parts[0]]);
|
||||
var temp = parts[1] + '-' + (month < 10 ? '0' + month : month.toString());
|
||||
return moment( temp, 'YYYY-MM' );
|
||||
}
|
||||
else if( /^\d{4}-\d{1,2}$/.test(dt) ) { // "2015-03", "1998-4"
|
||||
return moment( dt, 'YYYY-MM' );
|
||||
}
|
||||
else if( /^\s*\d{4}\s*$/.test(dt) ) { // "2015"
|
||||
return moment( dt, 'YYYY' );
|
||||
}
|
||||
else if( /^\s*$/.test(dt) ) { // "", " "
|
||||
var defTime = {
|
||||
isNull: true,
|
||||
isBefore: function( other ) {
|
||||
return( other && !other.isNull ) ? true : false;
|
||||
},
|
||||
isAfter: function( other ) {
|
||||
return( other && !other.isNull ) ? false : false;
|
||||
},
|
||||
unix: function() { return 0; },
|
||||
format: function() { return ''; },
|
||||
diff: function() { return 0; }
|
||||
};
|
||||
return defTime;
|
||||
}
|
||||
else {
|
||||
var mt = moment( dt );
|
||||
if(mt.isValid())
|
||||
return mt;
|
||||
throw 'Invalid date format encountered.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
if( dt.isValid && dt.isValid() )
|
||||
return dt;
|
||||
throw 'Unknown date object encountered.';
|
||||
}
|
||||
};
|
||||
|
||||
var months = {}, abbr = {};
|
||||
moment.months().forEach(function(m,idx){months[m.toLowerCase()]=idx+1;});
|
||||
moment.monthsShort().forEach(function(m,idx){abbr[m.toLowerCase()]=idx+1;});
|
||||
abbr.sept = 9;
|
||||
|
||||
module.exports = FluentDate;
|
@ -1,397 +0,0 @@
|
||||
/**
|
||||
Definition of the FRESHResume class.
|
||||
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var FS = require('fs')
|
||||
, extend = require('../utils/extend')
|
||||
, validator = require('is-my-json-valid')
|
||||
, _ = require('underscore')
|
||||
, PATH = require('path')
|
||||
, moment = require('moment')
|
||||
, MD = require('marked')
|
||||
, CONVERTER = require('./convert');
|
||||
|
||||
/**
|
||||
A FRESH-style resume in JSON or YAML.
|
||||
@class FreshResume
|
||||
*/
|
||||
function FreshResume() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Open and parse the specified FRESH resume sheet. Merge the JSON object model
|
||||
onto this Sheet instance with extend() and convert sheet dates to a safe &
|
||||
consistent format. Then sort each section by startDate descending.
|
||||
*/
|
||||
FreshResume.prototype.open = function( file, title ) {
|
||||
this.imp = { fileName: file };
|
||||
this.imp.raw = FS.readFileSync( file, 'utf8' );
|
||||
return this.parse( this.imp.raw, title );
|
||||
};
|
||||
|
||||
/**
|
||||
Save the sheet to disk (for environments that have disk access).
|
||||
*/
|
||||
FreshResume.prototype.save = function( filename ) {
|
||||
this.imp.fileName = filename || this.imp.fileName;
|
||||
FS.writeFileSync( this.imp.fileName, this.stringify(), 'utf8' );
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
Save the sheet to disk in a specific format, either FRESH or JSON Resume.
|
||||
*/
|
||||
FreshResume.prototype.saveAs = function( filename, format ) {
|
||||
this.imp.fileName = filename || this.imp.fileName;
|
||||
if( format !== 'JRS' ) {
|
||||
FS.writeFileSync( this.imp.fileName, this.stringify(), 'utf8' );
|
||||
}
|
||||
else {
|
||||
var newRep = CONVERTER.toJRS( this );
|
||||
FS.writeFileSync( this.imp.fileName, FreshResume.stringify( newRep ), 'utf8' );
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
FreshResume.prototype.dupe = function() {
|
||||
var rnew = new FreshResume();
|
||||
rnew.parse( this.stringify(), { } );
|
||||
return rnew;
|
||||
};
|
||||
|
||||
/**
|
||||
Convert the supplied object to a JSON string, sanitizing meta-properties along
|
||||
the way.
|
||||
*/
|
||||
FreshResume.stringify = function( obj ) {
|
||||
function replacer( key,value ) { // Exclude these keys from stringification
|
||||
return _.some(['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index',
|
||||
'safe', 'result', 'isModified', 'htmlPreview', 'display_progress_bar'],
|
||||
function( val ) { return key.trim() === val; }
|
||||
) ? undefined : value;
|
||||
}
|
||||
return JSON.stringify( obj, replacer, 2 );
|
||||
};
|
||||
|
||||
/**
|
||||
Create a copy of this resume in which all fields have been interpreted as
|
||||
Markdown.
|
||||
*/
|
||||
FreshResume.prototype.markdownify = function() {
|
||||
|
||||
var that = this;
|
||||
var ret = this.dupe();
|
||||
|
||||
function MDIN(txt){
|
||||
return MD(txt || '' ).replace(/^\s*<p>|<\/p>\s*$/gi, '');
|
||||
}
|
||||
|
||||
// TODO: refactor recursion
|
||||
function markdownifyStringsInObject( obj, inline ) {
|
||||
|
||||
if( !obj ) return;
|
||||
|
||||
inline = inline === undefined || inline;
|
||||
|
||||
if( Object.prototype.toString.call( obj ) === '[object Array]' ) {
|
||||
obj.forEach(function(elem, idx, ar){
|
||||
if( typeof elem === 'string' || elem instanceof String )
|
||||
ar[idx] = inline ? MDIN(elem) : MD( elem );
|
||||
else
|
||||
markdownifyStringsInObject( elem );
|
||||
});
|
||||
}
|
||||
else if (typeof obj === 'object') {
|
||||
Object.keys( obj ).forEach(function(key) {
|
||||
var sub = obj[key];
|
||||
if( typeof sub === 'string' || sub instanceof String ) {
|
||||
if( _.contains(['skills','url','start','end','date'], key) )
|
||||
return;
|
||||
if( key === 'summary' )
|
||||
obj[key] = MD( obj[key] );
|
||||
else
|
||||
obj[key] = inline ? MDIN( obj[key] ) : MD( obj[key] );
|
||||
}
|
||||
else
|
||||
markdownifyStringsInObject( sub );
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Object.keys( ret ).forEach(function(member){
|
||||
markdownifyStringsInObject( ret[ member ] );
|
||||
});
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
Convert this object to a JSON string, sanitizing meta-properties along the
|
||||
way. Don't override .toString().
|
||||
*/
|
||||
FreshResume.prototype.stringify = function() {
|
||||
return FreshResume.stringify( this );
|
||||
};
|
||||
|
||||
/**
|
||||
Open and parse the specified JSON resume sheet. Merge the JSON object model
|
||||
onto this Sheet instance with extend() and convert sheet dates to a safe &
|
||||
consistent format. Then sort each section by startDate descending.
|
||||
*/
|
||||
FreshResume.prototype.parse = function( stringData, opts ) {
|
||||
|
||||
// Parse the incoming JSON representation
|
||||
var rep = JSON.parse( stringData );
|
||||
|
||||
// Convert JSON Resume to FRESH if necessary
|
||||
if( rep.basics ) {
|
||||
rep = CONVERTER.toFRESH( rep );
|
||||
rep.imp = rep.imp || { };
|
||||
rep.imp.orgFormat = 'JRS';
|
||||
}
|
||||
|
||||
// Now apply the resume representation onto this object
|
||||
extend( true, this, rep );
|
||||
|
||||
// Set up metadata
|
||||
opts = opts || { };
|
||||
if( opts.imp === undefined || opts.imp ) {
|
||||
this.imp = this.imp || { };
|
||||
this.imp.title = (opts.title || this.imp.title) || this.name;
|
||||
}
|
||||
// Parse dates, sort dates, and calculate computed values
|
||||
(opts.date === undefined || opts.date) && _parseDates.call( this );
|
||||
(opts.sort === undefined || opts.sort) && this.sort();
|
||||
(opts.compute === undefined || opts.compute) && (this.computed = {
|
||||
numYears: this.duration(),
|
||||
keywords: this.keywords()
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
Return a unique list of all keywords across all skills.
|
||||
*/
|
||||
FreshResume.prototype.keywords = function() {
|
||||
var flatSkills = [];
|
||||
this.skills && this.skills.length &&
|
||||
(flatSkills = this.skills.map(function(sk) { return sk.name; }));
|
||||
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.
|
||||
*/
|
||||
FreshResume.prototype.clear = function( clearMeta ) {
|
||||
clearMeta = ((clearMeta === undefined) && true) || clearMeta;
|
||||
clearMeta && (delete this.imp);
|
||||
delete this.computed; // Don't use Object.keys() here
|
||||
delete this.employment;
|
||||
delete this.service;
|
||||
delete this.education;
|
||||
delete this.recognition;
|
||||
delete this.reading;
|
||||
delete this.writing;
|
||||
delete this.interests;
|
||||
delete this.skills;
|
||||
delete this.social;
|
||||
};
|
||||
|
||||
/**
|
||||
Get the default (empty) sheet.
|
||||
*/
|
||||
FreshResume.default = function() {
|
||||
return new FreshResume().open(
|
||||
PATH.join( __dirname, 'empty-fresh.json'), 'Empty' );
|
||||
};
|
||||
|
||||
/**
|
||||
Add work experience to the sheet.
|
||||
*/
|
||||
FreshResume.prototype.add = function( moniker ) {
|
||||
var defSheet = FreshResume.default();
|
||||
var newObject = $.extend( true, {}, defSheet[ moniker ][0] );
|
||||
this[ moniker ] = this[ moniker ] || [];
|
||||
this[ moniker ].push( newObject );
|
||||
return newObject;
|
||||
};
|
||||
|
||||
/**
|
||||
Determine if the sheet includes a specific social profile (eg, GitHub).
|
||||
*/
|
||||
FreshResume.prototype.hasProfile = function( socialNetwork ) {
|
||||
socialNetwork = socialNetwork.trim().toLowerCase();
|
||||
return this.social && _.some( this.social, function(p) {
|
||||
return p.network.trim().toLowerCase() === socialNetwork;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
Return the specified network profile.
|
||||
*/
|
||||
FreshResume.prototype.getProfile = function( socialNetwork ) {
|
||||
socialNetwork = socialNetwork.trim().toLowerCase();
|
||||
return this.social && _.find( this.social, function(sn) {
|
||||
return sn.network.trim().toLowerCase() === socialNetwork;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
Return an array of profiles for the specified network, for when the user
|
||||
has multiple eg. GitHub accounts.
|
||||
*/
|
||||
FreshResume.prototype.getProfiles = function( socialNetwork ) {
|
||||
socialNetwork = socialNetwork.trim().toLowerCase();
|
||||
return this.social && _.filter( this.social, function(sn){
|
||||
return sn.network.trim().toLowerCase() === socialNetwork;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
Determine if the sheet includes a specific skill.
|
||||
*/
|
||||
FreshResume.prototype.hasSkill = function( skill ) {
|
||||
skill = skill.trim().toLowerCase();
|
||||
return this.skills && _.some( this.skills, function(sk) {
|
||||
return sk.keywords && _.some( sk.keywords, function(kw) {
|
||||
return kw.trim().toLowerCase() === skill;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
Validate the sheet against the FRESH Resume schema.
|
||||
*/
|
||||
FreshResume.prototype.isValid = function( info ) {
|
||||
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})?)?$/ }
|
||||
});
|
||||
var ret = validate( this );
|
||||
if( !ret ) {
|
||||
this.imp = this.imp || { };
|
||||
this.imp.validationErrors = validate.errors;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
Calculate the total duration of the sheet. Assumes this.work has been sorted
|
||||
by start date descending, perhaps via a call to Sheet.sort().
|
||||
@returns The total duration of the sheet's work history, that is, the number
|
||||
of years between the start date of the earliest job on the resume and the
|
||||
*latest end date of all jobs in the work history*. This last condition is for
|
||||
sheets that have overlapping jobs.
|
||||
*/
|
||||
FreshResume.prototype.duration = function() {
|
||||
if( this.employment.history && this.employment.history.length ) {
|
||||
var careerStart = this.employment.history[ this.employment.history.length - 1].safe.start;
|
||||
if ((typeof careerStart === 'string' || careerStart instanceof String) &&
|
||||
!careerStart.trim())
|
||||
return 0;
|
||||
var careerLast = _.max( this.employment.history, function( w ) {
|
||||
return w.safe.end.unix();
|
||||
}).safe.end;
|
||||
return careerLast.diff( careerStart, 'years' );
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
Sort dated things on the sheet by start date descending. Assumes that dates
|
||||
on the sheet have been processed with _parseDates().
|
||||
*/
|
||||
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 );
|
||||
|
||||
// this.awards && this.awards.sort( function(a, b) {
|
||||
// return( a.safeDate.isBefore(b.safeDate) ) ? 1
|
||||
// : ( a.safeDate.isAfter(b.safeDate) && -1 ) || 0;
|
||||
// });
|
||||
this.writing && this.writing.sort( function(a, b) {
|
||||
return( a.safe.date.isBefore(b.safe.date) ) ? 1
|
||||
: ( a.safe.date.isAfter(b.safe.date) && -1 ) || 0;
|
||||
});
|
||||
|
||||
function byDateDesc(a,b) {
|
||||
return( a.safe.start.isBefore(b.safe.start) ) ? 1
|
||||
: ( a.safe.start.isAfter(b.safe.start) && -1 ) || 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
Convert human-friendly dates into formal Moment.js dates for all collections.
|
||||
We don't want to lose the raw textual date as entered by the user, so we store
|
||||
the Moment-ified date as a separate property with a prefix of .safe. For ex:
|
||||
job.startDate is the date as entered by the user. job.safeStartDate is the
|
||||
parsed Moment.js date that we actually use in processing.
|
||||
*/
|
||||
function _parseDates() {
|
||||
|
||||
var _fmt = require('./fluent-date').fmt;
|
||||
var that = this;
|
||||
|
||||
// TODO: refactor recursion
|
||||
function replaceDatesInObject( obj ) {
|
||||
|
||||
if( !obj ) return;
|
||||
if( Object.prototype.toString.call( obj ) === '[object Array]' ) {
|
||||
obj.forEach(function(elem){
|
||||
replaceDatesInObject( elem );
|
||||
});
|
||||
}
|
||||
else if (typeof obj === 'object') {
|
||||
if( obj._isAMomentObject || obj.safe )
|
||||
return;
|
||||
Object.keys( obj ).forEach(function(key) {
|
||||
replaceDatesInObject( obj[key] );
|
||||
});
|
||||
['start','end','date'].forEach( function(val) {
|
||||
if( obj[val] && (!obj.safe || !obj.safe[val] )) {
|
||||
obj.safe = obj.safe || { };
|
||||
obj.safe[ val ] = _fmt( obj[val] );
|
||||
if( obj[val] && (val === 'start') && !obj.end ) {
|
||||
obj.safe.end = _fmt('current');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Object.keys( this ).forEach(function(member){
|
||||
replaceDatesInObject( that[ member ] );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Export the Sheet function/ctor.
|
||||
*/
|
||||
module.exports = FreshResume;
|
||||
|
||||
}());
|
||||
|
||||
// Note 1: Adjust default date validation to allow YYYY and YYYY-MM formats
|
||||
// in addition to YYYY-MM-DD. The original regex:
|
||||
//
|
||||
// /^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-[0-9]{2}$/
|
||||
//
|
@ -1,260 +0,0 @@
|
||||
/**
|
||||
Definition of the JRSResume class.
|
||||
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var FS = require('fs')
|
||||
, extend = require('../utils/extend')
|
||||
, validator = require('is-my-json-valid')
|
||||
, _ = require('underscore')
|
||||
, PATH = require('path')
|
||||
, moment = require('moment');
|
||||
|
||||
/**
|
||||
The JRSResume class represent a specific JSON character sheet. When Sheet.open
|
||||
is called, we merge the loaded JSON sheet properties onto the Sheet instance
|
||||
via extend(), so a full-grown sheet object will have all of the methods here,
|
||||
plus a complement of JSON properties from the backing JSON file. That allows
|
||||
us to treat Sheet objects interchangeably with the loaded JSON model.
|
||||
@class JRSResume
|
||||
*/
|
||||
function JRSResume() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Open and parse the specified JSON resume sheet. Merge the JSON object model
|
||||
onto this Sheet instance with extend() and convert sheet dates to a safe &
|
||||
consistent format. Then sort each section by startDate descending.
|
||||
*/
|
||||
JRSResume.prototype.open = function( file, title ) {
|
||||
this.imp = { fileName: file };
|
||||
this.imp.raw = FS.readFileSync( file, 'utf8' );
|
||||
return this.parse( this.imp.raw, title );
|
||||
};
|
||||
|
||||
/**
|
||||
Save the sheet to disk (for environments that have disk access).
|
||||
*/
|
||||
JRSResume.prototype.save = function( filename ) {
|
||||
this.imp.fileName = filename || this.imp.fileName;
|
||||
FS.writeFileSync( this.imp.fileName, this.stringify(), 'utf8' );
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
Convert this object to a JSON string, sanitizing meta-properties along the
|
||||
way. Don't override .toString().
|
||||
*/
|
||||
JRSResume.prototype.stringify = function() {
|
||||
function replacer( key,value ) { // Exclude these keys from stringification
|
||||
return _.some(['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index',
|
||||
'safeStartDate', 'safeEndDate', 'safeDate', 'safeReleaseDate', 'result',
|
||||
'isModified', 'htmlPreview', 'display_progress_bar'],
|
||||
function( val ) { return key.trim() === val; }
|
||||
) ? undefined : value;
|
||||
}
|
||||
return JSON.stringify( this, replacer, 2 );
|
||||
};
|
||||
|
||||
/**
|
||||
Open and parse the specified JSON resume sheet. Merge the JSON object model
|
||||
onto this Sheet instance with extend() and convert sheet dates to a safe &
|
||||
consistent format. Then sort each section by startDate descending.
|
||||
*/
|
||||
JRSResume.prototype.parse = function( stringData, opts ) {
|
||||
opts = opts || { };
|
||||
var rep = JSON.parse( stringData );
|
||||
extend( true, this, rep );
|
||||
// Set up metadata
|
||||
if( opts.imp === undefined || opts.imp ) {
|
||||
this.imp = this.imp || { };
|
||||
this.imp.title = (opts.title || this.imp.title) || this.basics.name;
|
||||
}
|
||||
// Parse dates, sort dates, and calculate computed values
|
||||
(opts.date === undefined || opts.date) && _parseDates.call( this );
|
||||
(opts.sort === undefined || opts.sort) && this.sort();
|
||||
(opts.compute === undefined || opts.compute) && (this.computed = {
|
||||
numYears: this.duration(),
|
||||
keywords: this.keywords()
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
Return a unique list of all keywords across all skills.
|
||||
*/
|
||||
JRSResume.prototype.keywords = function() {
|
||||
var flatSkills = [];
|
||||
if( this.skills && this.skills.length ) {
|
||||
this.skills.forEach( function( s ) {
|
||||
flatSkills = _.union( flatSkills, s.keywords );
|
||||
});
|
||||
}
|
||||
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.
|
||||
*/
|
||||
JRSResume.prototype.clear = function( clearMeta ) {
|
||||
clearMeta = ((clearMeta === undefined) && true) || clearMeta;
|
||||
clearMeta && (delete this.imp);
|
||||
delete this.computed; // Don't use Object.keys() here
|
||||
delete this.work;
|
||||
delete this.volunteer;
|
||||
delete this.education;
|
||||
delete this.awards;
|
||||
delete this.publications;
|
||||
delete this.interests;
|
||||
delete this.skills;
|
||||
delete this.basics.profiles;
|
||||
};
|
||||
|
||||
/**
|
||||
Get the default (empty) sheet.
|
||||
*/
|
||||
JRSResume.default = function() {
|
||||
return new JRSResume().open( PATH.join( __dirname, 'empty-jrs.json'), 'Empty' );
|
||||
};
|
||||
|
||||
/**
|
||||
Add work experience to the sheet.
|
||||
*/
|
||||
JRSResume.prototype.add = function( moniker ) {
|
||||
var defSheet = JRSResume.default();
|
||||
var newObject = $.extend( true, {}, defSheet[ moniker ][0] );
|
||||
this[ moniker ] = this[ moniker ] || [];
|
||||
this[ moniker ].push( newObject );
|
||||
return newObject;
|
||||
};
|
||||
|
||||
/**
|
||||
Determine if the sheet includes a specific social profile (eg, GitHub).
|
||||
*/
|
||||
JRSResume.prototype.hasProfile = function( socialNetwork ) {
|
||||
socialNetwork = socialNetwork.trim().toLowerCase();
|
||||
return this.basics.profiles && _.some( this.basics.profiles, function(p) {
|
||||
return p.network.trim().toLowerCase() === socialNetwork;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
Determine if the sheet includes a specific skill.
|
||||
*/
|
||||
JRSResume.prototype.hasSkill = function( skill ) {
|
||||
skill = skill.trim().toLowerCase();
|
||||
return this.skills && _.some( this.skills, function(sk) {
|
||||
return sk.keywords && _.some( sk.keywords, function(kw) {
|
||||
return kw.trim().toLowerCase() === skill;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
Validate the sheet against the JSON Resume schema.
|
||||
*/
|
||||
JRSResume.prototype.isValid = function( ) { // TODO: ↓ fix this path ↓
|
||||
var schema = FS.readFileSync( PATH.join( __dirname, 'resume.json' ), 'utf8' );
|
||||
var schemaObj = JSON.parse( schema );
|
||||
var validator = require('is-my-json-valid');
|
||||
var validate = validator( schemaObj );
|
||||
return validate( this );
|
||||
};
|
||||
|
||||
/**
|
||||
Calculate the total duration of the sheet. Assumes this.work has been sorted
|
||||
by start date descending, perhaps via a call to Sheet.sort().
|
||||
@returns The total duration of the sheet's work history, that is, the number
|
||||
of years between the start date of the earliest job on the resume and the
|
||||
*latest end date of all jobs in the work history*. This last condition is for
|
||||
sheets that have overlapping jobs.
|
||||
*/
|
||||
JRSResume.prototype.duration = function() {
|
||||
if( this.work && this.work.length ) {
|
||||
var careerStart = this.work[ this.work.length - 1].safeStartDate;
|
||||
if ((typeof careerStart === 'string' || careerStart instanceof String) &&
|
||||
!careerStart.trim())
|
||||
return 0;
|
||||
var careerLast = _.max( this.work, function( w ) {
|
||||
return w.safeEndDate.unix();
|
||||
}).safeEndDate;
|
||||
return careerLast.diff( careerStart, 'years' );
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
Sort dated things on the sheet by start date descending. Assumes that dates
|
||||
on the sheet have been processed with _parseDates().
|
||||
*/
|
||||
JRSResume.prototype.sort = function( ) {
|
||||
|
||||
this.work && this.work.sort( byDateDesc );
|
||||
this.education && this.education.sort( byDateDesc );
|
||||
this.volunteer && this.volunteer.sort( byDateDesc );
|
||||
|
||||
this.awards && this.awards.sort( function(a, b) {
|
||||
return( a.safeDate.isBefore(b.safeDate) ) ? 1
|
||||
: ( a.safeDate.isAfter(b.safeDate) && -1 ) || 0;
|
||||
});
|
||||
this.publications && this.publications.sort( function(a, b) {
|
||||
return( a.safeReleaseDate.isBefore(b.safeReleaseDate) ) ? 1
|
||||
: ( a.safeReleaseDate.isAfter(b.safeReleaseDate) && -1 ) || 0;
|
||||
});
|
||||
|
||||
function byDateDesc(a,b) {
|
||||
return( a.safeStartDate.isBefore(b.safeStartDate) ) ? 1
|
||||
: ( a.safeStartDate.isAfter(b.safeStartDate) && -1 ) || 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
Convert human-friendly dates into formal Moment.js dates for all collections.
|
||||
We don't want to lose the raw textual date as entered by the user, so we store
|
||||
the Moment-ified date as a separate property with a prefix of .safe. For ex:
|
||||
job.startDate is the date as entered by the user. job.safeStartDate is the
|
||||
parsed Moment.js date that we actually use in processing.
|
||||
*/
|
||||
function _parseDates() {
|
||||
|
||||
var _fmt = require('./fluent-date').fmt;
|
||||
|
||||
this.work && this.work.forEach( function(job) {
|
||||
job.safeStartDate = _fmt( job.startDate );
|
||||
job.safeEndDate = _fmt( job.endDate );
|
||||
});
|
||||
this.education && this.education.forEach( function(edu) {
|
||||
edu.safeStartDate = _fmt( edu.startDate );
|
||||
edu.safeEndDate = _fmt( edu.endDate );
|
||||
});
|
||||
this.volunteer && this.volunteer.forEach( function(vol) {
|
||||
vol.safeStartDate = _fmt( vol.startDate );
|
||||
vol.safeEndDate = _fmt( vol.endDate );
|
||||
});
|
||||
this.awards && this.awards.forEach( function(awd) {
|
||||
awd.safeDate = _fmt( awd.date );
|
||||
});
|
||||
this.publications && this.publications.forEach( function(pub) {
|
||||
pub.safeReleaseDate = _fmt( pub.releaseDate );
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
Export the JRSResume function/ctor.
|
||||
*/
|
||||
module.exports = JRSResume;
|
||||
|
||||
}());
|
@ -1,380 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "Resume Schema",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"basics": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"label": {
|
||||
"type": "string",
|
||||
"description": "e.g. Web Developer"
|
||||
},
|
||||
"picture": {
|
||||
"type": "string",
|
||||
"description": "URL (as per RFC 3986) to a picture in JPEG or PNG format"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"description": "e.g. thomas@gmail.com",
|
||||
"format": "email"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string",
|
||||
"description": "Phone numbers are stored as strings so use any format you like, e.g. 712-117-2923"
|
||||
},
|
||||
"website": {
|
||||
"type": "string",
|
||||
"description": "URL (as per RFC 3986) to your website, e.g. personal homepage",
|
||||
"format": "uri"
|
||||
},
|
||||
"summary": {
|
||||
"type": "string",
|
||||
"description": "Write a short 2-3 sentence biography about yourself"
|
||||
},
|
||||
"location": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"address": {
|
||||
"type": "string",
|
||||
"description": "To add multiple address lines, use \n. For example, 1234 Glücklichkeit Straße\nHinterhaus 5. Etage li."
|
||||
},
|
||||
"postalCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"countryCode": {
|
||||
"type": "string",
|
||||
"description": "code as per ISO-3166-1 ALPHA-2, e.g. US, AU, IN"
|
||||
},
|
||||
"region": {
|
||||
"type": "string",
|
||||
"description": "The general region where you live. Can be a US state, or a province, for instance."
|
||||
}
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"type": "array",
|
||||
"description": "Specify any number of social networks that you participate in",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"network": {
|
||||
"type": "string",
|
||||
"description": "e.g. Facebook or Twitter"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"description": "e.g. neutralthoughts"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"description": "e.g. http://twitter.com/neutralthoughts"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"work": {
|
||||
"type": "array",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"company": {
|
||||
"type": "string",
|
||||
"description": "e.g. Facebook"
|
||||
},
|
||||
"position": {
|
||||
"type": "string",
|
||||
"description": "e.g. Software Engineer"
|
||||
},
|
||||
"website": {
|
||||
"type": "string",
|
||||
"description": "e.g. http://facebook.com",
|
||||
"format": "uri"
|
||||
},
|
||||
"startDate": {
|
||||
"type": "string",
|
||||
"description": "resume.json uses the ISO 8601 date standard e.g. 2014-06-29",
|
||||
"format": "date"
|
||||
},
|
||||
"endDate": {
|
||||
"type": "string",
|
||||
"description": "e.g. 2012-06-29",
|
||||
"format": "date"
|
||||
},
|
||||
"summary": {
|
||||
"type": "string",
|
||||
"description": "Give an overview of your responsibilities at the company"
|
||||
},
|
||||
"highlights": {
|
||||
"type": "array",
|
||||
"description": "Specify multiple accomplishments",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "e.g. Increased profits by 20% from 2011-2012 through viral advertising"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
"volunteer": {
|
||||
"type": "array",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"organization": {
|
||||
"type": "string",
|
||||
"description": "e.g. Facebook"
|
||||
},
|
||||
"position": {
|
||||
"type": "string",
|
||||
"description": "e.g. Software Engineer"
|
||||
},
|
||||
"website": {
|
||||
"type": "string",
|
||||
"description": "e.g. http://facebook.com",
|
||||
"format": "uri"
|
||||
},
|
||||
"startDate": {
|
||||
"type": "string",
|
||||
"description": "resume.json uses the ISO 8601 date standard e.g. 2014-06-29",
|
||||
"format": "date"
|
||||
},
|
||||
"endDate": {
|
||||
"type": "string",
|
||||
"description": "e.g. 2012-06-29",
|
||||
"format": "date"
|
||||
},
|
||||
"summary": {
|
||||
"type": "string",
|
||||
"description": "Give an overview of your responsibilities at the company"
|
||||
},
|
||||
"highlights": {
|
||||
"type": "array",
|
||||
"description": "Specify multiple accomplishments",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "e.g. Increased profits by 20% from 2011-2012 through viral advertising"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
"education": {
|
||||
"type": "array",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"institution": {
|
||||
"type": "string",
|
||||
"description": "e.g. Massachusetts Institute of Technology"
|
||||
},
|
||||
"area": {
|
||||
"type": "string",
|
||||
"description": "e.g. Arts"
|
||||
},
|
||||
"studyType": {
|
||||
"type": "string",
|
||||
"description": "e.g. Bachelor"
|
||||
},
|
||||
"startDate": {
|
||||
"type": "string",
|
||||
"description": "e.g. 2014-06-29",
|
||||
"format": "date"
|
||||
},
|
||||
"endDate": {
|
||||
"type": "string",
|
||||
"description": "e.g. 2012-06-29",
|
||||
"format": "date"
|
||||
},
|
||||
"gpa": {
|
||||
"type": "string",
|
||||
"description": "grade point average, e.g. 3.67/4.0"
|
||||
},
|
||||
"courses": {
|
||||
"type": "array",
|
||||
"description": "List notable courses/subjects",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "e.g. H1302 - Introduction to American history"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
"awards": {
|
||||
"type": "array",
|
||||
"description": "Specify any awards you have received throughout your professional career",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"description": "e.g. One of the 100 greatest minds of the century"
|
||||
},
|
||||
"date": {
|
||||
"type": "string",
|
||||
"description": "e.g. 1989-06-12",
|
||||
"format": "date"
|
||||
},
|
||||
"awarder": {
|
||||
"type": "string",
|
||||
"description": "e.g. Time Magazine"
|
||||
},
|
||||
"summary": {
|
||||
"type": "string",
|
||||
"description": "e.g. Received for my work with Quantum Physics"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"publications": {
|
||||
"type": "array",
|
||||
"description": "Specify your publications through your career",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "e.g. The World Wide Web"
|
||||
},
|
||||
"publisher": {
|
||||
"type": "string",
|
||||
"description": "e.g. IEEE, Computer Magazine"
|
||||
},
|
||||
"releaseDate": {
|
||||
"type": "string",
|
||||
"description": "e.g. 1990-08-01"
|
||||
},
|
||||
"website": {
|
||||
"type": "string",
|
||||
"description": "e.g. http://www.computer.org/csdl/mags/co/1996/10/rx069-abs.html"
|
||||
},
|
||||
"summary": {
|
||||
"type": "string",
|
||||
"description": "Short summary of publication. e.g. Discussion of the World Wide Web, HTTP, HTML."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"skills": {
|
||||
"type": "array",
|
||||
"description": "List out your professional skill-set",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "e.g. Web Development"
|
||||
},
|
||||
"level": {
|
||||
"type": "string",
|
||||
"description": "e.g. Master"
|
||||
},
|
||||
"keywords": {
|
||||
"type": "array",
|
||||
"description": "List some keywords pertaining to this skill",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "e.g. HTML"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"languages": {
|
||||
"type": "array",
|
||||
"description": "List any other languages you speak",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"language": {
|
||||
"type": "string",
|
||||
"description": "e.g. English, Spanish"
|
||||
},
|
||||
"fluency": {
|
||||
"type": "string",
|
||||
"description": "e.g. Fluent, Beginner"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"interests": {
|
||||
"type": "array",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "e.g. Philosophy"
|
||||
},
|
||||
"keywords": {
|
||||
"type": "array",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "e.g. Friedrich Nietzsche"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
"references": {
|
||||
"type": "array",
|
||||
"description": "List references you have received",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "e.g. Timothy Cook"
|
||||
},
|
||||
"reference": {
|
||||
"type": "string",
|
||||
"description": "e.g. Joe blogs was a great employee, who turned up to work at least once a week. He exceeded my expectations when it came to doing nothing."
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,263 +0,0 @@
|
||||
/**
|
||||
Abstract theme representation.
|
||||
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var FS = require('fs')
|
||||
, extend = require('../utils/extend')
|
||||
, validator = require('is-my-json-valid')
|
||||
, _ = require('underscore')
|
||||
, PATH = require('path')
|
||||
, EXTEND = require('../utils/extend')
|
||||
, moment = require('moment')
|
||||
, RECURSIVE_READ_DIR = require('recursive-readdir-sync');
|
||||
|
||||
/**
|
||||
The Theme class is a representation of a FluentCV theme asset.
|
||||
@class Theme
|
||||
*/
|
||||
function Theme() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Open and parse the specified theme.
|
||||
*/
|
||||
Theme.prototype.open = function( themeFolder ) {
|
||||
|
||||
// Open the [theme-name].json file; should have the same name as folder
|
||||
this.folder = themeFolder;
|
||||
var pathInfo = PATH.parse( themeFolder );
|
||||
var themeFile = PATH.join( themeFolder, pathInfo.base + '.json' );
|
||||
var themeInfo = JSON.parse( FS.readFileSync( themeFile, 'utf8' ) );
|
||||
var that = this;
|
||||
|
||||
// Move properties from the theme JSON file to the theme object
|
||||
EXTEND( true, this, themeInfo );
|
||||
|
||||
// Set up a formats has for the theme
|
||||
var formatsHash = { };
|
||||
|
||||
// Check for an explicit "formats" entry in the theme JSON. If it has one,
|
||||
// then this theme declares its files explicitly.
|
||||
if( !!this.formats ) {
|
||||
formatsHash = loadExplicit.call( this );
|
||||
this.explicit = true;
|
||||
}
|
||||
else {
|
||||
formatsHash = loadImplicit.call( this );
|
||||
}
|
||||
|
||||
// Add freebie formats every theme gets
|
||||
formatsHash.json = { title: 'json', outFormat: 'json', pre: 'json', ext: 'json', path: null, data: null };
|
||||
formatsHash.yml = { title: 'yaml', outFormat: 'yml', pre: 'yml', ext: 'yml', path: null, data: null };
|
||||
|
||||
// Cache
|
||||
this.formats = formatsHash;
|
||||
|
||||
// Set the official theme name
|
||||
this.name = PATH.parse( this.folder ).name;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
Determine if the theme supports the specified output format.
|
||||
*/
|
||||
Theme.prototype.hasFormat = function( fmt ) {
|
||||
return _.has( this.formats, fmt );
|
||||
};
|
||||
|
||||
/**
|
||||
Determine if the theme supports the specified output format.
|
||||
*/
|
||||
Theme.prototype.getFormat = function( fmt ) {
|
||||
return this.formats[ fmt ];
|
||||
};
|
||||
|
||||
function loadImplicit() {
|
||||
|
||||
// Set up a hash of formats supported by this theme.
|
||||
var formatsHash = { };
|
||||
var that = this;
|
||||
var major = false;
|
||||
|
||||
// Establish the base theme folder
|
||||
var tplFolder = PATH.join( this.folder, 'src' );
|
||||
|
||||
// Iterate over all files in the theme folder, producing an array, fmts,
|
||||
// containing info for each file. While we're doing that, also build up
|
||||
// the formatsHash object.
|
||||
var fmts = RECURSIVE_READ_DIR( tplFolder ).map( function( absPath ) {
|
||||
|
||||
// If this file lives in a specific format folder within the theme,
|
||||
// such as "/latex" or "/html", then that format is the output format
|
||||
// for all files within the folder.
|
||||
var pathInfo = PATH.parse(absPath);
|
||||
var outFmt = '', isMajor = false;
|
||||
var portion = pathInfo.dir.replace(tplFolder,'');
|
||||
if( portion && portion.trim() ) {
|
||||
var reg = /^(?:\/|\\)(html|latex|doc|pdf)(?:\/|\\)?/ig;
|
||||
var res = reg.exec( portion );
|
||||
res && (outFmt = res[1]);
|
||||
}
|
||||
|
||||
// Otherwise, the output format is inferred from the filename, as in
|
||||
// compact-[outputformat].[extension], for ex, compact-pdf.html.
|
||||
if( !outFmt ) {
|
||||
var idx = pathInfo.name.lastIndexOf('-');
|
||||
outFmt = ( idx === -1 ) ? pathInfo.name : pathInfo.name.substr( idx + 1 );
|
||||
isMajor = true;
|
||||
}
|
||||
|
||||
// We should have a valid output format now.
|
||||
formatsHash[ outFmt ] = formatsHash[outFmt] || {
|
||||
outFormat: outFmt,
|
||||
files: []
|
||||
};
|
||||
|
||||
// Create the file representation object.
|
||||
var obj = {
|
||||
action: 'transform',
|
||||
path: absPath,
|
||||
major: isMajor,
|
||||
orgPath: PATH.relative(that.folder, absPath),
|
||||
ext: pathInfo.ext.slice(1),
|
||||
title: friendlyName( outFmt ),
|
||||
pre: outFmt,
|
||||
// outFormat: outFmt || pathInfo.name,
|
||||
data: FS.readFileSync( absPath, 'utf8' ),
|
||||
css: null
|
||||
};
|
||||
|
||||
// Add this file to the list of files for this format type.
|
||||
formatsHash[ outFmt ].files.push( obj );
|
||||
return obj;
|
||||
});
|
||||
|
||||
// Now, get all the CSS files...
|
||||
(this.cssFiles = fmts.filter(function( fmt ){ return fmt.ext === 'css'; }))
|
||||
.forEach(function( cssf ) {
|
||||
// For each CSS file, get its corresponding HTML file
|
||||
var idx = _.findIndex(fmts, function( fmt ) {
|
||||
return fmt.pre === cssf.pre && fmt.ext === 'html';
|
||||
});
|
||||
cssf.action = null;
|
||||
fmts[ idx ].css = cssf.data;
|
||||
fmts[ idx ].cssPath = cssf.path;
|
||||
});
|
||||
|
||||
// Remove CSS files from the formats array
|
||||
fmts = fmts.filter( function( fmt) {
|
||||
return fmt.ext !== 'css';
|
||||
});
|
||||
|
||||
return formatsHash;
|
||||
}
|
||||
|
||||
function loadExplicit() {
|
||||
|
||||
var that = this;
|
||||
// Set up a hash of formats supported by this theme.
|
||||
var formatsHash = { };
|
||||
|
||||
// Establish the base theme folder
|
||||
var tplFolder = PATH.join( this.folder, 'src' );
|
||||
|
||||
var act = null;
|
||||
|
||||
// Iterate over all files in the theme folder, producing an array, fmts,
|
||||
// containing info for each file. While we're doing that, also build up
|
||||
// the formatsHash object.
|
||||
var fmts = RECURSIVE_READ_DIR( tplFolder ).map( function( absPath ) {
|
||||
|
||||
act = null;
|
||||
// If this file is mentioned in the theme's JSON file under "transforms"
|
||||
var pathInfo = PATH.parse(absPath);
|
||||
var absPathSafe = absPath.trim().toLowerCase();
|
||||
var outFmt = _.find( Object.keys( that.formats ), function( fmtKey ) {
|
||||
var fmtVal = that.formats[ fmtKey ];
|
||||
return _.some( fmtVal.transform, function( fpath ) {
|
||||
var absPathB = PATH.join( that.folder, fpath ).trim().toLowerCase();
|
||||
return absPathB === absPathSafe;
|
||||
});
|
||||
});
|
||||
if( outFmt ) {
|
||||
act = 'transform';
|
||||
}
|
||||
|
||||
// If this file lives in a specific format folder within the theme,
|
||||
// such as "/latex" or "/html", then that format is the output format
|
||||
// for all files within the folder.
|
||||
if( !outFmt ) {
|
||||
var portion = pathInfo.dir.replace(tplFolder,'');
|
||||
if( portion && portion.trim() ) {
|
||||
var reg = /^(?:\/|\\)(html|latex|doc|pdf)(?:\/|\\)?/ig;
|
||||
var res = reg.exec( portion );
|
||||
res && (outFmt = res[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, the output format is inferred from the filename, as in
|
||||
// compact-[outputformat].[extension], for ex, compact-pdf.html.
|
||||
if( !outFmt ) {
|
||||
var idx = pathInfo.name.lastIndexOf('-');
|
||||
outFmt = ( idx === -1 ) ? pathInfo.name : pathInfo.name.substr( idx + 1 );
|
||||
}
|
||||
|
||||
// We should have a valid output format now.
|
||||
formatsHash[ outFmt ] =
|
||||
formatsHash[ outFmt ] || {
|
||||
outFormat: outFmt,
|
||||
files: [],
|
||||
symLinks: that.formats[ outFmt ].symLinks
|
||||
};
|
||||
|
||||
// Create the file representation object.
|
||||
var obj = {
|
||||
action: act,
|
||||
orgPath: PATH.relative(that.folder, absPath),
|
||||
path: absPath,
|
||||
ext: pathInfo.ext.slice(1),
|
||||
title: friendlyName( outFmt ),
|
||||
pre: outFmt,
|
||||
// outFormat: outFmt || pathInfo.name,
|
||||
data: FS.readFileSync( absPath, 'utf8' ),
|
||||
css: null
|
||||
};
|
||||
|
||||
// Add this file to the list of files for this format type.
|
||||
formatsHash[ outFmt ].files.push( obj );
|
||||
return obj;
|
||||
});
|
||||
|
||||
// Now, get all the CSS files...
|
||||
(this.cssFiles = fmts.filter(function( fmt ){ return fmt.ext === 'css'; }))
|
||||
.forEach(function( cssf ) {
|
||||
// For each CSS file, get its corresponding HTML file
|
||||
var idx = _.findIndex(fmts, function( fmt ) {
|
||||
return fmt.pre === cssf.pre && fmt.ext === 'html';
|
||||
});
|
||||
fmts[ idx ].css = cssf.data;
|
||||
fmts[ idx ].cssPath = cssf.path;
|
||||
});
|
||||
|
||||
// Remove CSS files from the formats array
|
||||
fmts = fmts.filter( function( fmt) {
|
||||
return fmt.ext !== 'css';
|
||||
});
|
||||
|
||||
return formatsHash;
|
||||
}
|
||||
|
||||
function friendlyName( val ) {
|
||||
val = val.trim().toLowerCase();
|
||||
var friendly = { yml: 'yaml', md: 'markdown', txt: 'text' };
|
||||
return friendly[val] || val;
|
||||
}
|
||||
|
||||
module.exports = Theme;
|
||||
|
||||
}());
|
@ -1,18 +0,0 @@
|
||||
/**
|
||||
Handlebars template generate for FluentCV.
|
||||
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var _ = require('underscore');
|
||||
var HANDLEBARS = require('handlebars');
|
||||
|
||||
module.exports = function( json, jst, format, cssInfo, opts ) {
|
||||
|
||||
var template = HANDLEBARS.compile(jst);
|
||||
return template( { r: json, filt: opts.filters, cssInfo: cssInfo, headFragment: opts.headFragment || '' } );
|
||||
|
||||
};
|
||||
|
||||
}());
|
@ -1,37 +0,0 @@
|
||||
/**
|
||||
Underscore template generate for FluentCV.
|
||||
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var _ = require('underscore');
|
||||
|
||||
module.exports = function( json, jst, format, cssInfo, opts ) {
|
||||
|
||||
// Tweak underscore's default template delimeters
|
||||
var delims = (opts.themeObj && opts.themeObj.delimeters) || opts.template;
|
||||
if( opts.themeObj && opts.themeObj.delimeters ) {
|
||||
delims = _.mapObject( delims, function(val,key) {
|
||||
return new RegExp( val, "ig");
|
||||
});
|
||||
}
|
||||
_.templateSettings = delims;
|
||||
|
||||
// Strip {# comments #}
|
||||
jst = jst.replace( delims.comment, '');
|
||||
// Compile and run the template. TODO: avoid unnecessary recompiles.
|
||||
var compiled = _.template(jst);
|
||||
var ret = compiled({
|
||||
r: format === 'html' || format === 'pdf' ? json.markdownify() : json,
|
||||
filt: opts.filters,
|
||||
XML: require('xml-escape'),
|
||||
RAW: json,
|
||||
cssInfo: cssInfo,
|
||||
headFragment: opts.headFragment || ''
|
||||
});
|
||||
return ret;
|
||||
|
||||
};
|
||||
|
||||
}());
|
348
src/fluentcmd.js
348
src/fluentcmd.js
@ -1,348 +0,0 @@
|
||||
/**
|
||||
Internal resume generation logic for FluentCV.
|
||||
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk
|
||||
@module fluentcmd.js
|
||||
*/
|
||||
|
||||
(function() {
|
||||
module.exports = function () {
|
||||
|
||||
var path = require( 'path' )
|
||||
, extend = require( './utils/extend' )
|
||||
, unused = require('./utils/string')
|
||||
, FS = require('fs')
|
||||
, _ = require('underscore')
|
||||
, FLUENT = require('./fluentlib')
|
||||
, PATH = require('path')
|
||||
, MKDIRP = require('mkdirp')
|
||||
//, COLORS = require('colors')
|
||||
, rez, _log, _err;
|
||||
|
||||
/**
|
||||
Given a source JSON resume, a destination resume path, and a theme file,
|
||||
generate 0..N resumes in the desired formats.
|
||||
@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 theme Friendly name of the resume theme. Defaults to "modern".
|
||||
@param logger Optional logging override.
|
||||
*/
|
||||
function generate( src, dst, opts, logger, errHandler ) {
|
||||
|
||||
_log = logger || console.log;
|
||||
_err = errHandler || error;
|
||||
|
||||
//_opts = extend( true, _opts, opts );
|
||||
_opts.theme = (opts.theme && opts.theme.toLowerCase().trim())|| 'modern';
|
||||
_opts.prettify = opts.prettify === true ? _opts.prettify : false;
|
||||
|
||||
// Load input resumes...
|
||||
if(!src || !src.length) { throw { fluenterror: 3 }; }
|
||||
var sheets = loadSourceResumes( src );
|
||||
|
||||
// Merge input resumes...
|
||||
var msg = '';
|
||||
rez = _.reduceRight( sheets, function( a, b, idx ) {
|
||||
msg += ((idx == sheets.length - 2) ?
|
||||
'Merging '.gray+ a.imp.fileName : '') + ' onto '.gray + b.imp.fileName;
|
||||
return extend( true, b, a );
|
||||
});
|
||||
msg && _log(msg);
|
||||
|
||||
// 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');
|
||||
if (!exists( tFolder )) {
|
||||
tFolder = PATH.resolve( _opts.theme );
|
||||
if (!exists( tFolder )) {
|
||||
throw { fluenterror: 1, data: _opts.theme };
|
||||
}
|
||||
}
|
||||
|
||||
// Load the theme
|
||||
var theTheme = new FLUENT.Theme().open( tFolder );
|
||||
_opts.themeObj = theTheme;
|
||||
_log( 'Applying '.info + theTheme.name.toUpperCase().infoBold +
|
||||
(' theme (' +Object.keys(theTheme.formats).length + ' formats)').info);
|
||||
|
||||
// Expand output resumes... (can't use map() here)
|
||||
var targets = [], that = this;
|
||||
( (dst && dst.length && dst) || ['resume.all'] ).forEach( function(t) {
|
||||
|
||||
var to = path.resolve(t),
|
||||
pa = path.parse(to),
|
||||
fmat = pa.ext || '.all';
|
||||
|
||||
targets.push.apply(targets, fmat === '.all' ?
|
||||
Object.keys( theTheme.formats ).map(function(k){
|
||||
var z = theTheme.formats[k];
|
||||
return { file: to.replace(/all$/g,z.outFormat), fmt: z };
|
||||
}) : [{ file: to, fmt: theTheme.getFormat( fmat.slice(1) ) }]);
|
||||
|
||||
});
|
||||
|
||||
// Run the transformation!
|
||||
var finished = targets.map( function(t) { return single(t, theTheme); });
|
||||
|
||||
// Don't send the client back empty-handed
|
||||
return { sheet: rez, targets: targets, processed: finished };
|
||||
}
|
||||
|
||||
/**
|
||||
Generate a single resume of a specific format.
|
||||
@param f Full path to the destination resume to generate, for example,
|
||||
"/foo/bar/resume.pdf" or "c:\foo\bar\resume.txt".
|
||||
*/
|
||||
function single( targInfo, theme ) {
|
||||
try {
|
||||
var f = targInfo.file
|
||||
, fType = targInfo.fmt.outFormat
|
||||
, fName = path.basename(f, '.' + fType)
|
||||
, theFormat;
|
||||
|
||||
// If targInfo.fmt.files exists, this theme has an explicit "files"
|
||||
// section in its theme.json file.
|
||||
if( targInfo.fmt.files && targInfo.fmt.files.length ) {
|
||||
|
||||
_log( 'Generating '.useful +
|
||||
targInfo.fmt.outFormat.toUpperCase().useful.bold +
|
||||
' resume: '.useful + path.relative(process.cwd(), f ).useful.bold);
|
||||
|
||||
theFormat = _fmts.filter(
|
||||
function(fmt) { return fmt.name === targInfo.fmt.outFormat; })[0];
|
||||
MKDIRP.sync( path.dirname( f ) ); // Ensure dest folder exists;
|
||||
theFormat.gen.generate( rez, f, _opts );
|
||||
|
||||
// targInfo.fmt.files.forEach( function( form ) {
|
||||
//
|
||||
// if( form.action === 'transform' ) {
|
||||
// var theFormat = _fmts.filter( function( fmt ) {
|
||||
// return fmt.name === targInfo.fmt.outFormat;
|
||||
// })[0];
|
||||
// MKDIRP.sync( path.dirname( f ) ); // Ensure dest folder exists;
|
||||
// theFormat.gen.generate( rez, f, _opts );
|
||||
// }
|
||||
// else if( form.action === null ) {
|
||||
// // Copy the file
|
||||
// }
|
||||
//
|
||||
// });
|
||||
|
||||
}
|
||||
// Otherwise the theme has no files section
|
||||
else {
|
||||
_log( 'Generating '.useful +
|
||||
targInfo.fmt.outFormat.toUpperCase().useful.bold +
|
||||
' resume: '.useful + path.relative(process.cwd(), f ).useful.bold);
|
||||
|
||||
theFormat = _fmts.filter(
|
||||
function(fmt) { return fmt.name === targInfo.fmt.outFormat; })[0];
|
||||
MKDIRP.sync( path.dirname( f ) ); // Ensure dest folder exists;
|
||||
theFormat.gen.generate( rez, f, _opts );
|
||||
}
|
||||
}
|
||||
catch( ex ) {
|
||||
_err( ex );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Handle an exception.
|
||||
*/
|
||||
function error( ex ) {
|
||||
throw ex;
|
||||
}
|
||||
|
||||
/**
|
||||
Validate 1 to N resumes in either FRESH or JSON Resume format.
|
||||
*/
|
||||
function validate( src, unused, opts, logger ) {
|
||||
_log = logger || console.log;
|
||||
if( !src || !src.length ) { throw { fluenterror: 6 }; }
|
||||
var isValid = true;
|
||||
|
||||
var validator = require('is-my-json-valid');
|
||||
var schemas = {
|
||||
fresh: require('FRESCA'),
|
||||
jars: require('./core/resume.json')
|
||||
};
|
||||
|
||||
// Load input resumes...
|
||||
var sheets = loadSourceResumes(src, function( res ) {
|
||||
try {
|
||||
return {
|
||||
file: res,
|
||||
raw: FS.readFileSync( res, 'utf8' )
|
||||
};
|
||||
}
|
||||
catch( ex ) {
|
||||
throw ex;
|
||||
}
|
||||
});
|
||||
|
||||
sheets.forEach( function( rep ) {
|
||||
|
||||
var rez;
|
||||
try {
|
||||
rez = JSON.parse( rep.raw );
|
||||
}
|
||||
catch( ex ) {
|
||||
_log('Validating '.info + rep.file.infoBold +
|
||||
' against FRESH/JRS schema: '.info + 'ERROR!'.error.bold);
|
||||
|
||||
if (ex instanceof SyntaxError) {
|
||||
// Invalid JSON
|
||||
_log( '--> '.bold.red + rep.file.toUpperCase().red +
|
||||
' contains invalid JSON. Unable to validate.'.red );
|
||||
_log( (' INTERNAL: ' + ex).red );
|
||||
}
|
||||
else {
|
||||
|
||||
_log(('ERROR: ' + ex.toString()).red.bold);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var isValid = false;
|
||||
var style = 'useful';
|
||||
var errors = [];
|
||||
var fmt = rez.meta &&
|
||||
(rez.meta.format === 'FRESH@0.1.0') ? 'fresh':'jars';
|
||||
|
||||
try {
|
||||
|
||||
var validate = validator( schemas[ fmt ], { // Note [1]
|
||||
formats: {
|
||||
date: /^\d{4}(?:-(?:0[0-9]{1}|1[0-2]{1})(?:-[0-9]{2})?)?$/
|
||||
}
|
||||
});
|
||||
|
||||
isValid = validate( rez );
|
||||
if( !isValid ) {
|
||||
style = 'warn';
|
||||
errors = validate.errors;
|
||||
}
|
||||
|
||||
}
|
||||
catch(ex) {
|
||||
|
||||
}
|
||||
|
||||
_log( 'Validating '.info + rep.file.infoBold + ' against '.info +
|
||||
fmt.replace('jars','JSON Resume').toUpperCase().infoBold +
|
||||
' schema: '.info + (isValid ? 'VALID!' : 'INVALID')[style].bold );
|
||||
|
||||
errors.forEach(function(err,idx) {
|
||||
_log( '--> '.bold.yellow +
|
||||
(err.field.replace('data.','resume.').toUpperCase() + ' ' +
|
||||
err.message).yellow );
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
Convert between FRESH and JRS formats.
|
||||
*/
|
||||
function convert( src, dst, opts, logger ) {
|
||||
_log = logger || console.log;
|
||||
if( !src || !src.length ) { throw { fluenterror: 6 }; }
|
||||
if( !dst || !dst.length ) {
|
||||
if( src.length === 1 ) { throw { fluenterror: 5 }; }
|
||||
else if( src.length === 2 ) { dst = [ src[1] ]; src = [ src[0] ]; }
|
||||
else { throw { fluenterror: 5 }; }
|
||||
}
|
||||
if( src && dst && src.length && dst.length && src.length !== dst.length ) {
|
||||
throw { fluenterror: 7 };
|
||||
}
|
||||
var sheets = loadSourceResumes( src );
|
||||
sheets.forEach(function(sheet, idx){
|
||||
var sourceFormat = sheet.imp.orgFormat === 'JRS' ? 'JRS' : 'FRESH';
|
||||
var targetFormat = sourceFormat === 'JRS' ? 'FRESH' : 'JRS';
|
||||
_log( 'Converting '.useful + sheet.imp.fileName.useful.bold + (' (' +
|
||||
sourceFormat + ') to ').useful + dst[0].useful.bold +
|
||||
(' (' + targetFormat + ').').useful );
|
||||
sheet.saveAs( dst[idx], targetFormat );
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
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 new '.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.
|
||||
*/
|
||||
function help() {
|
||||
console.log( FS.readFileSync( PATH.join(__dirname, 'use.txt'), 'utf8' )
|
||||
.useful.bold );
|
||||
}
|
||||
|
||||
function loadSourceResumes( src, fn ) {
|
||||
return src.map( function( res ) {
|
||||
_log( 'Reading '.info + 'SOURCE'.infoBold + ' resume: '.info +
|
||||
res.cyan.bold );
|
||||
return (fn && fn(res)) || (new FLUENT.FRESHResume()).open( res );
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
Supported resume formats.
|
||||
*/
|
||||
var _fmts = [
|
||||
{ name: 'html', ext: 'html', gen: new FLUENT.HtmlGenerator() },
|
||||
{ name: 'txt', ext: 'txt', gen: new FLUENT.TextGenerator() },
|
||||
{ name: 'doc', ext: 'doc', fmt: 'xml', gen: new FLUENT.WordGenerator() },
|
||||
{ name: 'pdf', ext: 'pdf', fmt: 'html', is: false, gen: new FLUENT.HtmlPdfGenerator() },
|
||||
{ name: 'md', ext: 'md', fmt: 'txt', gen: new FLUENT.MarkdownGenerator() },
|
||||
{ name: 'json', ext: 'json', gen: new FLUENT.JsonGenerator() },
|
||||
{ name: 'yml', ext: 'yml', fmt: 'yml', gen: new FLUENT.JsonYamlGenerator() },
|
||||
{ name: 'latex', ext: 'tex', fmt: 'latex', gen: new FLUENT.LaTeXGenerator() }
|
||||
];
|
||||
|
||||
/**
|
||||
Default FluentCV options.
|
||||
*/
|
||||
var _opts = {
|
||||
theme: 'modern',
|
||||
prettify: { // ← See https://github.com/beautify-web/js-beautify#options
|
||||
indent_size: 2,
|
||||
unformatted: ['em','strong'],
|
||||
max_char: 80, // ← See lib/html.js in above-linked repo
|
||||
//wrap_line_length: 120, ← Don't use this
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
Internal module interface. Used by FCV Desktop and HMR.
|
||||
*/
|
||||
return {
|
||||
verbs: {
|
||||
build: generate,
|
||||
validate: validate,
|
||||
convert: convert,
|
||||
new: create,
|
||||
help: help
|
||||
},
|
||||
lib: require('./fluentlib'),
|
||||
options: _opts,
|
||||
formats: _fmts
|
||||
};
|
||||
|
||||
}();
|
||||
|
||||
}());
|
||||
|
||||
// [1]: JSON.parse throws SyntaxError on invalid JSON. See:
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
|
@ -1,21 +0,0 @@
|
||||
/**
|
||||
External API surface for FluentCV:CLI.
|
||||
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
Sheet: require('./core/fresh-resume'),
|
||||
FRESHResume: require('./core/fresh-resume'),
|
||||
JRSResume: require('./core/jrs-resume'),
|
||||
Theme: require('./core/theme'),
|
||||
FluentDate: require('./core/fluent-date'),
|
||||
HtmlGenerator: require('./gen/html-generator'),
|
||||
TextGenerator: require('./gen/text-generator'),
|
||||
HtmlPdfGenerator: require('./gen/html-pdf-generator'),
|
||||
WordGenerator: require('./gen/word-generator'),
|
||||
MarkdownGenerator: require('./gen/markdown-generator'),
|
||||
JsonGenerator: require('./gen/json-generator'),
|
||||
YamlGenerator: require('./gen/yaml-generator'),
|
||||
JsonYamlGenerator: require('./gen/json-yaml-generator'),
|
||||
LaTeXGenerator: require('./gen/latex-generator')
|
||||
};
|
@ -1,45 +0,0 @@
|
||||
/**
|
||||
Base resume generator for FluentCV.
|
||||
@license Copyright (c) 2015 | James M. Devlin
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
// Use J. Resig's nifty class implementation
|
||||
var Class = require( '../utils/class' );
|
||||
|
||||
/**
|
||||
The BaseGenerator class is the root of the generator hierarchy. Functionality
|
||||
common to ALL generators lives here.
|
||||
*/
|
||||
|
||||
var BaseGenerator = module.exports = Class.extend({
|
||||
|
||||
/**
|
||||
Base-class initialize.
|
||||
*/
|
||||
init: function( outputFormat ) {
|
||||
this.format = outputFormat;
|
||||
},
|
||||
|
||||
/**
|
||||
Status codes.
|
||||
*/
|
||||
codes: {
|
||||
success: 0,
|
||||
themeNotFound: 1,
|
||||
copyCss: 2,
|
||||
resumeNotFound: 3,
|
||||
missingCommand: 4,
|
||||
invalidCommand: 5
|
||||
},
|
||||
|
||||
/**
|
||||
Generator options.
|
||||
*/
|
||||
opts: {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}());
|
@ -1,40 +0,0 @@
|
||||
/**
|
||||
HTML resume generator for FluentCV.
|
||||
@license Copyright (c) 2015 James M. Devlin / FluentDesk
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var TemplateGenerator = require('./template-generator')
|
||||
, FS = require('fs-extra')
|
||||
, HTML = require( 'html' )
|
||||
, PATH = require('path');
|
||||
|
||||
var HtmlGenerator = module.exports = TemplateGenerator.extend({
|
||||
|
||||
init: function() {
|
||||
this._super( 'html' );
|
||||
},
|
||||
|
||||
/**
|
||||
Copy satellite CSS files to the destination and optionally pretty-print
|
||||
the HTML resume prior to saving.
|
||||
*/
|
||||
onBeforeSave: function( info ) {
|
||||
var cssSrc = PATH.join( info.theme.folder, 'src', '*.css' )
|
||||
, outFolder = PATH.parse( info.outputFile ).dir, that = this;
|
||||
|
||||
info.theme.cssFiles.forEach( function( f ) {
|
||||
var fi = PATH.parse( f.path );
|
||||
FS.copySync( f.path, PATH.join( outFolder, fi.base ), { clobber: true }, function( e ) {
|
||||
throw { fluenterror: that.codes.copyCss, data: [cssSrc,cssDst] };
|
||||
});
|
||||
});
|
||||
|
||||
return this.opts.prettify ?
|
||||
HTML.prettyPrint( info.mk, this.opts.prettify ) : info.mk;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}());
|
@ -1,71 +0,0 @@
|
||||
/**
|
||||
Definition of the HtmlPdfGenerator class.
|
||||
@license Copyright (c) 2015 James M. Devlin / FluentDesk
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var TemplateGenerator = require('./template-generator')
|
||||
, FS = require('fs-extra')
|
||||
, HTML = require( 'html' );
|
||||
|
||||
/**
|
||||
An HTML-based PDF resume generator for FluentCV.
|
||||
*/
|
||||
var HtmlPdfGenerator = module.exports = TemplateGenerator.extend({
|
||||
|
||||
init: function() {
|
||||
this._super( 'pdf', 'html' );
|
||||
},
|
||||
|
||||
/**
|
||||
Generate the binary PDF.
|
||||
*/
|
||||
onBeforeSave: function( info ) {
|
||||
pdf(info.mk, info.outputFile);
|
||||
return info.mk;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
Generate a PDF from HTML.
|
||||
*/
|
||||
function pdf( markup, fOut ) {
|
||||
|
||||
var pdfCount = 0;
|
||||
if( false ) { //( _opts.pdf === 'phantom' || _opts.pdf == 'all' ) {
|
||||
pdfCount++;
|
||||
require('phantom').create( function( ph ) {
|
||||
ph.createPage( function( page ) {
|
||||
page.setContent( markup );
|
||||
page.set('paperSize', {
|
||||
format: 'A4',
|
||||
orientation: 'portrait',
|
||||
margin: '1cm'
|
||||
});
|
||||
page.set("viewportSize", {
|
||||
width: 1024, // TODO: option-ify
|
||||
height: 768 // TODO: Use "A" sizes
|
||||
});
|
||||
page.set('onLoadFinished', function(success) {
|
||||
page.render( fOut );
|
||||
pdfCount++;
|
||||
ph.exit();
|
||||
});
|
||||
},
|
||||
{ dnodeOpts: { weak: false } } );
|
||||
});
|
||||
}
|
||||
if( true ) { // _opts.pdf === 'wkhtmltopdf' || _opts.pdf == 'all' ) {
|
||||
var fOut2 = fOut;
|
||||
if( pdfCount == 1 ) {
|
||||
fOut2 = fOut2.replace(/\.pdf$/g, '.b.pdf');
|
||||
}
|
||||
require('wkhtmltopdf')( markup, { pageSize: 'letter' } )
|
||||
.pipe( FS.createWriteStream( fOut2 ) );
|
||||
pdfCount++;
|
||||
}
|
||||
}
|
||||
|
||||
}());
|
@ -1,35 +0,0 @@
|
||||
/**
|
||||
Definition of the JsonGenerator class.
|
||||
@license Copyright (c) 2015 | James M. Devlin
|
||||
*/
|
||||
|
||||
var BaseGenerator = require('./base-generator');
|
||||
var FS = require('fs');
|
||||
var _ = require('underscore');
|
||||
|
||||
/**
|
||||
The JsonGenerator generates a JSON resume directly.
|
||||
*/
|
||||
var JsonGenerator = module.exports = BaseGenerator.extend({
|
||||
|
||||
init: function(){
|
||||
this._super( 'json' );
|
||||
},
|
||||
|
||||
invoke: function( rez ) {
|
||||
// TODO: merge with FCVD
|
||||
function replacer( key,value ) { // Exclude these keys from stringification
|
||||
return _.some(['imp', 'warnings', 'computed', 'filt', 'ctrl', 'index',
|
||||
'safeStartDate', 'safeEndDate', 'safeDate', 'safeReleaseDate', 'result',
|
||||
'isModified', 'htmlPreview', 'safe' ],
|
||||
function( val ) { return key.trim() === val; }
|
||||
) ? undefined : value;
|
||||
}
|
||||
return JSON.stringify( rez, replacer, 2 );
|
||||
},
|
||||
|
||||
generate: function( rez, f ) {
|
||||
FS.writeFileSync( f, this.invoke(rez), 'utf8' );
|
||||
}
|
||||
|
||||
});
|
@ -1,37 +0,0 @@
|
||||
/**
|
||||
A JSON-driven YAML resume generator for FluentLib.
|
||||
@module json-yaml-generator.js
|
||||
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var BaseGenerator = require('./base-generator');
|
||||
var FS = require('fs');
|
||||
var YAML = require('yamljs');
|
||||
|
||||
/**
|
||||
JsonYamlGenerator takes a JSON resume object and translates it directly to
|
||||
JSON without a template, producing an equivalent YAML-formatted resume. See
|
||||
also YamlGenerator (yaml-generator.js).
|
||||
*/
|
||||
|
||||
var JsonYamlGenerator = module.exports = BaseGenerator.extend({
|
||||
|
||||
init: function(){
|
||||
this._super( 'yml' );
|
||||
},
|
||||
|
||||
invoke: function( rez, themeMarkup, cssInfo, opts ) {
|
||||
return YAML.stringify( JSON.parse( rez.stringify() ), Infinity, 2 );
|
||||
},
|
||||
|
||||
generate: function( rez, f, opts ) {
|
||||
var data = YAML.stringify( JSON.parse( rez.stringify() ), Infinity, 2 );
|
||||
FS.writeFileSync( f, data, 'utf8' );
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}());
|
@ -1,17 +0,0 @@
|
||||
/**
|
||||
LaTeX resume generator for FluentCV.
|
||||
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk
|
||||
*/
|
||||
|
||||
var TemplateGenerator = require('./template-generator');
|
||||
|
||||
/**
|
||||
LaTeXGenerator generates a LaTeX resume via TemplateGenerator.
|
||||
*/
|
||||
var LaTeXGenerator = module.exports = TemplateGenerator.extend({
|
||||
|
||||
init: function(){
|
||||
this._super( 'latex', 'tex' );
|
||||
}
|
||||
|
||||
});
|
@ -1,17 +0,0 @@
|
||||
/**
|
||||
Markdown resume generator for FluentCV.
|
||||
@license Copyright (c) 2015 by James M. Devlin. All rights reserved.
|
||||
*/
|
||||
|
||||
var TemplateGenerator = require('./template-generator');
|
||||
|
||||
/**
|
||||
MarkdownGenerator generates a Markdown-formatted resume via TemplateGenerator.
|
||||
*/
|
||||
var MarkdownGenerator = module.exports = TemplateGenerator.extend({
|
||||
|
||||
init: function(){
|
||||
this._super( 'md', 'txt' );
|
||||
}
|
||||
|
||||
});
|
@ -1,244 +0,0 @@
|
||||
/**
|
||||
Template-based resume generator base for FluentCV.
|
||||
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
|
||||
var FS = require( 'fs-extra' )
|
||||
, _ = require( 'underscore' )
|
||||
, MD = require( 'marked' )
|
||||
, XML = require( 'xml-escape' )
|
||||
, PATH = require('path')
|
||||
, MKDIRP = require('mkdirp')
|
||||
, BaseGenerator = require( './base-generator' )
|
||||
, EXTEND = require('../utils/extend')
|
||||
, Theme = require('../core/theme');
|
||||
|
||||
|
||||
|
||||
// Default options.
|
||||
var _defaultOpts = {
|
||||
engine: 'underscore',
|
||||
keepBreaks: true,
|
||||
freezeBreaks: false,
|
||||
nSym: '&newl;', // newline entity
|
||||
rSym: '&retn;', // return entity
|
||||
template: {
|
||||
interpolate: /\{\{(.+?)\}\}/g,
|
||||
escape: /\{\{\=(.+?)\}\}/g,
|
||||
evaluate: /\{\%(.+?)\%\}/g,
|
||||
comment: /\{\#(.+?)\#\}/g
|
||||
},
|
||||
filters: {
|
||||
out: function( txt ) { return txt; },
|
||||
raw: function( txt ) { return txt; },
|
||||
xml: function( txt ) { return XML(txt); },
|
||||
md: function( txt ) { return MD( txt || '' ); },
|
||||
mdin: function( txt ) { return MD(txt || '' ).replace(/^\s*<p>|<\/p>\s*$/gi, ''); },
|
||||
lower: function( txt ) { return txt.toLowerCase(); },
|
||||
link: function( name, url ) { return url ?
|
||||
'<a href="' + url + '">' + name + '</a>' : name; }
|
||||
},
|
||||
prettify: { // ← See https://github.com/beautify-web/js-beautify#options
|
||||
indent_size: 2,
|
||||
unformatted: ['em','strong','a'],
|
||||
max_char: 80, // ← See lib/html.js in above-linked repo
|
||||
//wrap_line_length: 120, <-- Don't use this
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
TemplateGenerator performs resume generation via local Handlebar or Underscore
|
||||
style template expansion and is appropriate for text-based formats like HTML,
|
||||
plain text, and XML versions of Microsoft Word, Excel, and OpenOffice.
|
||||
@class TemplateGenerator
|
||||
*/
|
||||
var TemplateGenerator = module.exports = BaseGenerator.extend({
|
||||
|
||||
|
||||
|
||||
init: function( outputFormat, templateFormat, cssFile ){
|
||||
this._super( outputFormat );
|
||||
this.tplFormat = templateFormat || outputFormat;
|
||||
},
|
||||
|
||||
|
||||
|
||||
invoke: function( rez, themeMarkup, cssInfo, opts ) {
|
||||
this.opts = EXTEND( true, {}, _defaultOpts, opts );
|
||||
mk = this.single( rez, themeMarkup, this.format, cssInfo, { } );
|
||||
this.onBeforeSave && (mk = this.onBeforeSave( mk, themeFile, f ));
|
||||
return mk;
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Default generation method for template-based generators.
|
||||
@method generate
|
||||
@param rez A FreshResume object.
|
||||
@param f Full path to the output resume file to generate.
|
||||
@param opts Generator options.
|
||||
*/
|
||||
generate: function( rez, f, opts ) {
|
||||
|
||||
// Carry over options
|
||||
this.opts = EXTEND( true, { }, _defaultOpts, opts );
|
||||
|
||||
// Load the theme
|
||||
var themeInfo = themeFromMoniker.call( this );
|
||||
var theme = themeInfo.theme;
|
||||
var tFolder = themeInfo.folder;
|
||||
var tplFolder = PATH.join( tFolder, 'src' );
|
||||
var outFolder = PATH.parse(f).dir;
|
||||
var curFmt = theme.getFormat( this.format );
|
||||
var that = this;
|
||||
|
||||
// "Generate": process individual files within the theme
|
||||
curFmt.files.forEach(function(tplInfo){
|
||||
if( tplInfo.action === 'transform' ) {
|
||||
transform.call( that, rez, f, tplInfo, theme, outFolder );
|
||||
}
|
||||
else if( tplInfo.action === null && theme.explicit ) {
|
||||
var thisFilePath = PATH.join(outFolder, tplInfo.orgPath);
|
||||
try {
|
||||
MKDIRP.sync( PATH.dirname(thisFilePath) );
|
||||
FS.copySync( tplInfo.path, thisFilePath );
|
||||
}
|
||||
catch(ex) {
|
||||
console.log(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Some themes require a symlink structure. If so, create it.
|
||||
if( curFmt.symLinks ) {
|
||||
Object.keys( curFmt.symLinks ).forEach( function(loc) {
|
||||
var absLoc = PATH.join(outFolder, loc);
|
||||
var absTarg = PATH.join(PATH.dirname(absLoc), curFmt.symLinks[loc]);
|
||||
// 'file', 'dir', or 'junction' (Windows only)
|
||||
var type = PATH.parse( absLoc ).ext ? 'file' : 'junction';
|
||||
FS.symlinkSync( absTarg, absLoc, type);
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Perform a single resume JSON-to-DEST resume transformation.
|
||||
@param json A FRESH or JRS resume object.
|
||||
@param jst The stringified template data
|
||||
@param format The format name, such as "html" or "latex"
|
||||
@param cssInfo Needs to be refactored.
|
||||
@param opts Options and passthrough data.
|
||||
*/
|
||||
single: function( json, jst, format, cssInfo, opts ) {
|
||||
this.opts.freezeBreaks && ( jst = freeze(jst) );
|
||||
var eng = require( '../eng/' + ((opts.themeObj && opts.themeObj.engine) ||
|
||||
opts.engine) + '-generator' );
|
||||
var result = eng( json, jst, format, cssInfo, opts );
|
||||
this.opts.freezeBreaks && ( result = unfreeze(result) );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Export the TemplateGenerator function/ctor.
|
||||
*/
|
||||
module.exports = TemplateGenerator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Given a theme title, load the corresponding theme.
|
||||
*/
|
||||
function themeFromMoniker() {
|
||||
// Verify the specified theme name/path
|
||||
var tFolder = PATH.join(
|
||||
PATH.parse( require.resolve('fluent-themes') ).dir,
|
||||
this.opts.theme
|
||||
);
|
||||
var exists = require('../utils/file-exists');
|
||||
if( !exists( tFolder ) ) {
|
||||
tFolder = PATH.resolve( this.opts.theme );
|
||||
if( !exists( tFolder ) ) {
|
||||
throw { fluenterror: this.codes.themeNotFound, data: this.opts.theme};
|
||||
}
|
||||
}
|
||||
|
||||
var t = this.opts.themeObj || new Theme().open( tFolder );
|
||||
|
||||
// Load the theme and format
|
||||
return {
|
||||
theme: t,
|
||||
folder: tFolder
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Transform a single subfile.
|
||||
*/
|
||||
function transform( rez, f, tplInfo, theme, outFolder ) {
|
||||
var cssInfo = { file: tplInfo.css ? tplInfo.cssPath : null, data: tplInfo.css || null };
|
||||
var mk = this.single( rez, tplInfo.data, this.format, cssInfo, this.opts );
|
||||
this.onBeforeSave && (mk = this.onBeforeSave( { mk: mk, theme: theme, outputFile: f } ));
|
||||
var thisFilePath = PATH.join( outFolder, tplInfo.orgPath );
|
||||
try {
|
||||
MKDIRP.sync( PATH.dirname( tplInfo.major ? f : thisFilePath) );
|
||||
FS.writeFileSync( tplInfo.major ? f : thisFilePath, mk, { encoding: 'utf8', flags: 'w' } );
|
||||
}
|
||||
catch(ex) {
|
||||
console.log(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Freeze newlines for protection against errant JST parsers.
|
||||
*/
|
||||
function freeze( markup ) {
|
||||
return markup
|
||||
.replace( _reg.regN, _defaultOpts.nSym )
|
||||
.replace( _reg.regR, _defaultOpts.rSym );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Unfreeze newlines when the coast is clear.
|
||||
*/
|
||||
function unfreeze( markup ) {
|
||||
return markup
|
||||
.replace( _reg.regSymR, '\r' )
|
||||
.replace( _reg.regSymN, '\n' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Regexes for linebreak preservation.
|
||||
*/
|
||||
var _reg = {
|
||||
regN: new RegExp( '\n', 'g' ),
|
||||
regR: new RegExp( '\r', 'g' ),
|
||||
regSymN: new RegExp( _defaultOpts.nSym, 'g' ),
|
||||
regSymR: new RegExp( _defaultOpts.rSym, 'g' )
|
||||
};
|
||||
|
||||
|
||||
|
||||
}());
|
@ -1,19 +0,0 @@
|
||||
/**
|
||||
Plain text resume generator for FluentCV.
|
||||
@license Copyright (c) 2015 by James M. Devlin. All rights reserved.
|
||||
*/
|
||||
|
||||
var TemplateGenerator = require('./template-generator');
|
||||
|
||||
/**
|
||||
The TextGenerator generates a plain-text resume via the TemplateGenerator.
|
||||
*/
|
||||
var TextGenerator = TemplateGenerator.extend({
|
||||
|
||||
init: function(){
|
||||
this._super( 'txt' );
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
module.exports = TextGenerator;
|
@ -1,13 +0,0 @@
|
||||
/**
|
||||
MS Word resume generator for FluentCV.
|
||||
@license Copyright (c) 2015 by James M. Devlin. All rights reserved.
|
||||
*/
|
||||
|
||||
var TemplateGenerator = require('./template-generator');
|
||||
var WordGenerator = module.exports = TemplateGenerator.extend({
|
||||
|
||||
init: function(){
|
||||
this._super( 'doc', 'xml' );
|
||||
},
|
||||
|
||||
});
|
@ -1,17 +0,0 @@
|
||||
/**
|
||||
XML resume generator for FluentCV.
|
||||
@license Copyright (c) 2015 | James M. Devlin
|
||||
*/
|
||||
|
||||
var BaseGenerator = require('./base-generator');
|
||||
|
||||
/**
|
||||
The XmlGenerator generates an XML resume via the TemplateGenerator.
|
||||
*/
|
||||
var XmlGenerator = module.exports = BaseGenerator.extend({
|
||||
|
||||
init: function(){
|
||||
this._super( 'xml' );
|
||||
},
|
||||
|
||||
});
|
@ -1,24 +0,0 @@
|
||||
/**
|
||||
A YAML resume generator for FluentLib.
|
||||
@module yaml-generator.js
|
||||
@license MIT. Copyright (c) 2015 James Devlin / FluentDesk
|
||||
*/
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
var TemplateGenerator = require('./template-generator');
|
||||
|
||||
/**
|
||||
YamlGenerator generates a YAML-formatted resume via TemplateGenerator.
|
||||
*/
|
||||
|
||||
var YamlGenerator = module.exports = TemplateGenerator.extend({
|
||||
|
||||
init: function(){
|
||||
this._super( 'yml', 'yml' );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}());
|
128
src/index.js
128
src/index.js
@ -1,130 +1,22 @@
|
||||
#! /usr/bin/env node
|
||||
|
||||
/**
|
||||
Command-line interface (CLI) for FluentCV:CLI.
|
||||
@license MIT. Copyright (c) 2015 James M. Devlin / FluentDesk.
|
||||
*/
|
||||
|
||||
var ARGS = require( 'minimist' )
|
||||
, FCMD = require( './fluentcmd')
|
||||
, PKG = require('../package.json')
|
||||
, COLORS = require('colors')
|
||||
, FS = require('fs')
|
||||
, PATH = require('path')
|
||||
, opts = { }
|
||||
, title = ('*** FluentCV v' + PKG.version + ' ***').bold.white
|
||||
, _ = require('underscore');
|
||||
|
||||
/**
|
||||
Command-line interface (CLI) for HackMyResume.
|
||||
@license MIT. See LICENSE.md for details.
|
||||
@module index.js
|
||||
*/
|
||||
|
||||
|
||||
|
||||
try {
|
||||
main();
|
||||
|
||||
require('./cli/main')( process.argv );
|
||||
|
||||
}
|
||||
catch( ex ) {
|
||||
handleError( ex );
|
||||
}
|
||||
|
||||
|
||||
|
||||
function main() {
|
||||
|
||||
// Colorize
|
||||
COLORS.setTheme({
|
||||
title: ['white','bold'],
|
||||
info: process.platform === 'win32' ? 'gray' : ['white','dim'],
|
||||
infoBold: ['white','dim'],
|
||||
warn: 'yellow',
|
||||
error: 'red',
|
||||
guide: 'yellow',
|
||||
status: 'gray',//['white','dim'],
|
||||
useful: 'green',
|
||||
});
|
||||
|
||||
// Setup
|
||||
if( process.argv.length <= 2 ) { throw { fluenterror: 4 }; }
|
||||
var a = ARGS( process.argv.slice(2) );
|
||||
opts = getOpts( a );
|
||||
logMsg( title );
|
||||
|
||||
|
||||
// Get the action to be performed
|
||||
var params = a._.map( function(p){ return p.toLowerCase().trim(); });
|
||||
var verb = params[0];
|
||||
if( !FCMD.verbs[ verb ] ) {
|
||||
logMsg('Invalid command: "'.warn + verb.warn.bold + '"'.warn);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get source and dest params
|
||||
var splitAt = _.indexOf( params, 'to' );
|
||||
if( splitAt === a._.length - 1 ) {
|
||||
// 'TO' cannot be the last argument
|
||||
logMsg('Please '.warn + 'specify an output file'.warn.bold +
|
||||
' for this operation or '.warn + 'omit the TO keyword'.warn.bold +
|
||||
'.'.warn );
|
||||
return;
|
||||
}
|
||||
|
||||
var src = a._.slice(1, splitAt === -1 ? undefined : splitAt );
|
||||
var dst = splitAt === -1 ? [] : a._.slice( splitAt + 1 );
|
||||
var parms = [ src, dst, opts, logMsg ];
|
||||
|
||||
// Invoke the action
|
||||
FCMD.verbs[ verb ].apply( null, parms );
|
||||
|
||||
}
|
||||
|
||||
function logMsg( msg ) {
|
||||
opts.silent || console.log( msg );
|
||||
}
|
||||
|
||||
function getOpts( args ) {
|
||||
var noPretty = args.nopretty || args.n;
|
||||
noPretty = noPretty && (noPretty === true || noPretty === 'true');
|
||||
return {
|
||||
theme: args.t || 'modern',
|
||||
format: args.f || 'FRESH',
|
||||
prettify: !noPretty,
|
||||
silent: args.s || args.silent
|
||||
};
|
||||
}
|
||||
|
||||
function handleError( ex ) {
|
||||
var msg = '', exitCode;
|
||||
|
||||
|
||||
|
||||
if( ex.fluenterror ){
|
||||
switch( ex.fluenterror ) { // TODO: Remove magic numbers
|
||||
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 '.guide + 'specify a valid input resume'.guide.bold + ' in FRESH or JSON Resume format.'.guide; break;
|
||||
case 4: msg = title + "\nPlease ".guide + "specify a command".guide.bold + " (".guide +
|
||||
Object.keys( FCMD.verbs ).map( function(v, idx, ar) {
|
||||
return (idx === ar.length - 1 ? 'or '.guide : '') +
|
||||
v.toUpperCase().guide;
|
||||
}).join(', '.guide) + ").\n\n".guide + FS.readFileSync( PATH.join(__dirname, 'use.txt'), 'utf8' ).info.bold;
|
||||
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 6: msg = 'Please '.guide + 'specify a valid input resume'.guide.bold + ' in either FRESH or JSON Resume format.'.guide; break;
|
||||
case 7: msg = 'Please '.guide + 'specify an output file name'.guide.bold + ' for every input file you wish to convert.'.guide; break;
|
||||
}
|
||||
exitCode = ex.fluenterror;
|
||||
|
||||
}
|
||||
else {
|
||||
msg = ex.toString();
|
||||
exitCode = 4;
|
||||
}
|
||||
|
||||
var idx = msg.indexOf('Error: ');
|
||||
var trimmed = idx === -1 ? msg : msg.substring( idx + 7 );
|
||||
if( !ex.fluenterror || ex.fluenterror < 3 )
|
||||
console.log( ('ERROR: ' + trimmed.toString()).red.bold );
|
||||
else
|
||||
console.log( trimmed.toString() );
|
||||
|
||||
process.exit( exitCode );
|
||||
require('./cli/error').err( ex, true );
|
||||
|
||||
}
|
||||
|
25
src/use.txt
25
src/use.txt
@ -1,25 +0,0 @@
|
||||
Usage:
|
||||
|
||||
fluentcv <COMMAND> <SOURCES> [TO <TARGETS>] [-t <THEME>] [-f <FORMAT>]
|
||||
|
||||
<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>
|
||||
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:
|
||||
COMPACT, MINIMIST, MODERN, or HELLO-WORLD) or the relative path to a custom
|
||||
theme. <FORMAT> should be either FRESH (for a FRESH-format resume) or JRS
|
||||
(for a JSON Resume-format resume).
|
||||
|
||||
fluentcv BUILD resume.json TO out/resume.all
|
||||
fluentcv NEW resume.json
|
||||
fluentcv CONVERT resume.json TO resume-jrs.json
|
||||
fluentcv VALIDATE resume.json
|
||||
|
||||
Both SOURCES and TARGETS can accept multiple files:
|
||||
|
||||
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
|
||||
|
||||
See https://github.com/fluentdesk/fluentCV/blob/master/README.md for more
|
||||
information.
|
@ -1,67 +0,0 @@
|
||||
/* Simple JavaScript Inheritance
|
||||
* By John Resig http://ejohn.org/
|
||||
* MIT Licensed.
|
||||
* http://ejohn.org/blog/simple-javascript-inheritance/
|
||||
*/
|
||||
// Inspired by base2 and Prototype
|
||||
(function(){
|
||||
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
|
||||
|
||||
// The base Class implementation (does nothing)
|
||||
this.Class = function(){};
|
||||
module.exports = Class;
|
||||
|
||||
// Create a new Class that inherits from this class
|
||||
Class.extend = function(prop) {
|
||||
var _super = this.prototype;
|
||||
|
||||
// Instantiate a base class (but only create the instance,
|
||||
// don't run the init constructor)
|
||||
initializing = true;
|
||||
var prototype = new this();
|
||||
initializing = false;
|
||||
|
||||
// Copy the properties over onto the new prototype
|
||||
for (var name in prop) {
|
||||
// Check if we're overwriting an existing function
|
||||
prototype[name] = typeof prop[name] == "function" &&
|
||||
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
|
||||
(function(name, fn){
|
||||
return function() {
|
||||
var tmp = this._super;
|
||||
|
||||
// Add a new ._super() method that is the same method
|
||||
// but on the super-class
|
||||
this._super = _super[name];
|
||||
|
||||
// The method only need to be bound temporarily, so we
|
||||
// remove it when we're done executing
|
||||
var ret = fn.apply(this, arguments);
|
||||
this._super = tmp;
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(name, prop[name]) : // jshint ignore:line
|
||||
prop[name];
|
||||
}
|
||||
|
||||
// The dummy class constructor
|
||||
function Class() {
|
||||
// All construction is actually done in the init method
|
||||
if ( !initializing && this.init )
|
||||
this.init.apply(this, arguments);
|
||||
}
|
||||
|
||||
// Populate our constructed prototype object
|
||||
Class.prototype = prototype;
|
||||
|
||||
// Enforce the constructor to be what we expect
|
||||
Class.prototype.constructor = Class;
|
||||
|
||||
// And make this class extendable
|
||||
Class.extend = arguments.callee;
|
||||
|
||||
return Class;
|
||||
};
|
||||
|
||||
})();
|
@ -1,78 +0,0 @@
|
||||
/**
|
||||
Plain JavaScript replacement of jQuery .extend based on jQuery sources.
|
||||
@license Copyright (c) 2015 by James M. Devlin. All rights reserved.
|
||||
*/
|
||||
|
||||
function _extend() {
|
||||
|
||||
function isPlainObject( obj ) {
|
||||
if ((typeof obj !== "object") || obj.nodeType ||
|
||||
(obj !== null && obj === obj.window)) {
|
||||
return false;
|
||||
}
|
||||
if (obj.constructor &&
|
||||
!hasOwnProperty.call( obj.constructor.prototype, "isPrototypeOf" )) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
var options
|
||||
, name
|
||||
, src
|
||||
, copy
|
||||
, copyIsArray
|
||||
, clone
|
||||
, target = arguments[0] || {}
|
||||
, i = 1
|
||||
, length = arguments.length
|
||||
, deep = false;
|
||||
|
||||
// Handle a deep copy situation
|
||||
if (typeof target === "boolean") {
|
||||
deep = target;
|
||||
// Skip the boolean and the target
|
||||
target = arguments[i] || {};
|
||||
i++;
|
||||
}
|
||||
|
||||
// Handle case when target is a string or something (possible in deep copy)
|
||||
//if (typeof target !== "object" && !jQuery.isFunction(target))
|
||||
if (typeof target !== "object" && typeof target !== "function")
|
||||
target = {};
|
||||
|
||||
for (; i < length; i++) {
|
||||
// Only deal with non-null/undefined values
|
||||
if ((options = arguments[i]) !== null) {
|
||||
// Extend the base object
|
||||
for (name in options) {
|
||||
src = target[name];
|
||||
copy = options[name];
|
||||
|
||||
// Prevent never-ending loop
|
||||
if (target === copy) continue;
|
||||
|
||||
// Recurse if we're merging plain objects or arrays
|
||||
if (deep && copy && (isPlainObject(copy) ||
|
||||
(copyIsArray = (copy.constructor === Array)))) {
|
||||
if (copyIsArray) {
|
||||
copyIsArray = false;
|
||||
clone = src && (src.constructor === Array) ? src : [];
|
||||
} else {
|
||||
clone = src && isPlainObject(src) ? src : {};
|
||||
}
|
||||
// Never move original objects, clone them
|
||||
target[name] = _extend(deep, clone, copy);
|
||||
// Don't bring in undefined values
|
||||
} else if (copy !== undefined) {
|
||||
target[name] = copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return the modified object
|
||||
return target;
|
||||
}
|
||||
|
||||
module.exports = _extend;
|
@ -1,18 +0,0 @@
|
||||
/**
|
||||
File-exists checker for Node.js.
|
||||
@license Copyright (c) 2015 | James M. Devlin
|
||||
*/
|
||||
|
||||
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');
|
||||
}
|
||||
};
|
@ -1,18 +0,0 @@
|
||||
/**
|
||||
String utility functions.
|
||||
@license Copyright (c) 2015 | James M. Devlin
|
||||
*/
|
||||
|
||||
/**
|
||||
Determine if the string is null, empty, or whitespace.
|
||||
See: http://stackoverflow.com/a/32800728/4942583
|
||||
@method isNullOrWhitespace
|
||||
*/
|
||||
|
||||
String.isNullOrWhitespace = function( input ) {
|
||||
return !input || !input.trim();
|
||||
};
|
||||
|
||||
String.prototype.endsWith = function(suffix) {
|
||||
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
||||
};
|
1
test/.gitignore
vendored
Normal file
1
test/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
sandbox/
|
4
test/hmr-options.json
Normal file
4
test/hmr-options.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"theme": "positive",
|
||||
"debug": true
|
||||
}
|
91
test/resumes/jrs-0.0.0/empty.json
Normal file
91
test/resumes/jrs-0.0.0/empty.json
Normal file
@ -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": [
|
||||
""
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
104
test/resumes/jrs-0.0.0/jane-incomplete.json
Normal file
104
test/resumes/jrs-0.0.0/jane-incomplete.json
Normal file
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
263
test/resumes/jrs-0.0.0/jane-q-fullstacker.json
Normal file
263
test/resumes/jrs-0.0.0/jane-q-fullstacker.json
Normal file
@ -0,0 +1,263 @@
|
||||
{
|
||||
"basics": {
|
||||
"name": "Jane Q. Fullstacker",
|
||||
"label": "Senior Developer",
|
||||
"summary": "**Full-stack software developer with 6+ years industry experience** specializing in scalable cloud architectures for this, that, and the other. A native of southern CA, Jane enjoys hiking, mystery novels, and the company of Rufus, her two-year-old beagle.",
|
||||
"website": "http://janef.me/blog",
|
||||
"phone": "1-650-999-7777",
|
||||
"email": "jdoe@onecoolstartup.io",
|
||||
"picture": "jane_doe.png",
|
||||
"location": {
|
||||
"address": "Jane Fullstacker\n123 Somewhere Rd.\nMountain View, CA 94035",
|
||||
"postalCode": "94035",
|
||||
"city": "Mountain View",
|
||||
"countryCode": "US",
|
||||
"region": "CA"
|
||||
},
|
||||
"profiles": [
|
||||
{
|
||||
"network": "GitHub",
|
||||
"username": "janef-was-here",
|
||||
"url": "https://github.com/janef-was-here"
|
||||
},
|
||||
{
|
||||
"network": "Twitter",
|
||||
"username": "janef-was-here",
|
||||
"url": "https://twitter.com/janef-was-here"
|
||||
}
|
||||
]
|
||||
},
|
||||
"work": [
|
||||
{
|
||||
"company": "One Cool Startup",
|
||||
"website": "https://onecool.io/does-not-exist",
|
||||
"position": "Head Code Ninja",
|
||||
"startDate": "2013-09",
|
||||
"summary": "Development team manager for OneCoolApp and OneCoolWebsite, a free social network tiddlywink generator and lifestyle portal with over 200,000 users.",
|
||||
"highlights": [
|
||||
"Managed a 5-person development team",
|
||||
"Accomplishment 2",
|
||||
"Etc."
|
||||
]
|
||||
},
|
||||
{
|
||||
"company": "Veridian Dynamics",
|
||||
"website": "https://en.wikipedia.org/wiki/Better_Off_Ted#Plot",
|
||||
"position": "Principal Developer",
|
||||
"startDate": "2011-07",
|
||||
"endDate": "2013-08",
|
||||
"summary": "Developer on numerous projects culminating in technical lead role for the [Jabberwocky project](http://betteroffted.wikia.com/wiki/Jabberwocky) and promotion to principal developer.",
|
||||
"highlights": [
|
||||
"Managed a 5-person development team",
|
||||
"Accomplishment 2",
|
||||
"Etc."
|
||||
]
|
||||
},
|
||||
{
|
||||
"company": "Stark Industries",
|
||||
"position": "IT Administrator",
|
||||
"startDate": "2008-10",
|
||||
"endDate": "2011-06",
|
||||
"summary": "Junior programmer with heavy code responsibilities. Promoted to intermediate role after 6 months.",
|
||||
"highlights": [
|
||||
"Promoted to intermediate developer after 6 months",
|
||||
"Accomplishment 2",
|
||||
"Etc."
|
||||
]
|
||||
},
|
||||
{
|
||||
"company": "Dunder Mifflin",
|
||||
"position": "Intern",
|
||||
"startDate": "2008-06",
|
||||
"endDate": "2008-09",
|
||||
"summary": "Performed IT administration and deployments for Dunder Mifflin.",
|
||||
"highlights": [
|
||||
"Supervised roll-out of Dunder Mifflin Infinity website.",
|
||||
"Performed mission-critical system backups and ",
|
||||
"Etc."
|
||||
]
|
||||
}
|
||||
],
|
||||
"education": [
|
||||
{
|
||||
"institution": "Cornell University",
|
||||
"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",
|
||||
"keywords": [
|
||||
"Node.js",
|
||||
"Angular.js",
|
||||
"jQuery",
|
||||
"Bootstrap",
|
||||
"React.js",
|
||||
"Backbone.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Database",
|
||||
"keywords": [
|
||||
"MySQL",
|
||||
"PostgreSQL",
|
||||
"NoSQL",
|
||||
"ORM",
|
||||
"Hibernate"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Cloud",
|
||||
"keywords": [
|
||||
"AWS",
|
||||
"EC2",
|
||||
"RDS",
|
||||
"S3",
|
||||
"Azure",
|
||||
"Dropbox"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Project",
|
||||
"keywords": [
|
||||
"Agile",
|
||||
"TFS",
|
||||
"Unified Process",
|
||||
"MS Project"
|
||||
]
|
||||
}
|
||||
],
|
||||
"volunteer": [
|
||||
{
|
||||
"organization": "Technology for Tots",
|
||||
"position": "Technical Consultant",
|
||||
"startDate": "2003-11",
|
||||
"endDate": "2005-06",
|
||||
"website": "http://technology-for-tots.org",
|
||||
"summary": "Summary of this volunteer stint.",
|
||||
"highlights": [
|
||||
"Accomplishment 1",
|
||||
"Accomplishment 2",
|
||||
"etc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"organization": "US Army Reserves",
|
||||
"position": "NCO",
|
||||
"startDate": "1999-11",
|
||||
"endDate": "2003-06",
|
||||
"website": "http://www.usar.army.mil/",
|
||||
"summary": "Summary of this military stint.",
|
||||
"highlights": [
|
||||
"Accomplishment 1",
|
||||
"Accomplishment 2",
|
||||
"etc"
|
||||
]
|
||||
}
|
||||
],
|
||||
"awards": [
|
||||
{
|
||||
"title": "Honorable Mention",
|
||||
"date": "2012",
|
||||
"awarder": "Google"
|
||||
},
|
||||
{
|
||||
"title": "Summa cum laude",
|
||||
"date": "2012",
|
||||
"awarder": "Cornell University"
|
||||
}
|
||||
],
|
||||
"publications": [
|
||||
{
|
||||
"name": "Building User Interfaces with Electron and Atom",
|
||||
"publisher": "Code Project",
|
||||
"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",
|
||||
"releaseDate": "2008",
|
||||
"website": "http://url.to.publication.com/blah",
|
||||
"summary": "A primer on the programming language of GORFF, whose for loops are coterminous with all of time and space."
|
||||
}
|
||||
],
|
||||
"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",
|
||||
"years": 10
|
||||
}
|
||||
]
|
||||
}
|
76
test/test-cli.js
Normal file
76
test/test-cli.js
Normal file
@ -0,0 +1,76 @@
|
||||
/**
|
||||
CLI test routines for HackMyResume.
|
||||
@module test-cli.js
|
||||
*/
|
||||
|
||||
|
||||
|
||||
var chai = require('chai')
|
||||
, should = chai.should()
|
||||
, HMRMAIN = require('../src/cli/main')
|
||||
, CHALK = require('chalk')
|
||||
, FS = require('fs')
|
||||
, PATH = require('path')
|
||||
, PKG = require('../package.json')
|
||||
, _ = require('underscore');
|
||||
|
||||
|
||||
|
||||
var gather = '';
|
||||
var ConsoleLogOrg = console.log;
|
||||
var ProcessExitOrg = process.exit;
|
||||
var commandRetVal = 0;
|
||||
|
||||
|
||||
describe('Testing CLI interface', function () {
|
||||
|
||||
// TODO: use sinon
|
||||
// Replacement for process.exit()
|
||||
function MyProcessExit( retVal ) {
|
||||
commandRetVal = retVal;
|
||||
}
|
||||
|
||||
// HackMyResume CLI stub. Handle a single HMR invocation.
|
||||
function HackMyResumeStub( argsString ) {
|
||||
|
||||
var args = argsString.split(' ');
|
||||
args.unshift( process.argv[1] );
|
||||
args.unshift( process.argv[0] );
|
||||
process.exit = MyProcessExit;
|
||||
|
||||
try {
|
||||
var HMRMAIN = require('../src/cli/main');
|
||||
HMRMAIN( args );
|
||||
}
|
||||
catch( ex ) {
|
||||
require('../src/cli/error').err( ex, false );
|
||||
//if(ex.stack || (ex.inner && ex.inner.stacl))
|
||||
//console.log(ex.stack || ex.inner.stack);
|
||||
}
|
||||
process.exit = ProcessExitOrg;
|
||||
|
||||
}
|
||||
|
||||
// Run a test through the stub, gathering console.log output into "gather"
|
||||
// and testing against it.
|
||||
function run( args, expErr ) {
|
||||
var title = args;
|
||||
it( 'Testing: "' + title + '"\n\n', function() {
|
||||
commandRetVal = 0;
|
||||
HackMyResumeStub( args );
|
||||
commandRetVal.should.equal( parseInt(expErr, 10) );
|
||||
});
|
||||
}
|
||||
|
||||
var lines = FS.readFileSync( PATH.join( __dirname, './test-hmr.txt'), 'utf8').split('\n');
|
||||
lines.forEach(function(l){
|
||||
if( l && l.trim() ) {
|
||||
if(l[0] !== '#') {
|
||||
var lineInfo = l.split('|');
|
||||
var errCode = lineInfo[0];
|
||||
run( lineInfo.length > 1 ? lineInfo[1] : '', errCode );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
27
test/test-hmr.txt
Normal file
27
test/test-hmr.txt
Normal file
@ -0,0 +1,27 @@
|
||||
0|
|
||||
0|--help
|
||||
0|-h
|
||||
0|--debug
|
||||
0|-d
|
||||
5|notacommand
|
||||
3|build
|
||||
14|build doesnt-exist.json
|
||||
14|build doesnt-exist.json -t not-a-theme
|
||||
14|build doesnt-exist.json -t node_modules/not-a-theme
|
||||
8|new
|
||||
0|new test/sandbox/cli-test/new-empty-resume.auto.json
|
||||
0|new test/sandbox/cli-test/new-empty-resume.jrs.json -f jrs
|
||||
0|new test/sandbox/cli-test/new-empty-resume.fresh.json -f fresh
|
||||
3|analyze
|
||||
14|analyze doesnt-exist.json
|
||||
3|convert
|
||||
7|convert doesnt-exist.json
|
||||
3|validate
|
||||
14|validate doesnt-exist.json
|
||||
0|validate node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json
|
||||
3|peek
|
||||
14|peek doesnt-exist.json
|
||||
14|peek doesnt-exist.json not.a.path
|
||||
0|peek test/resumes/jrs-0.0.0/richard-hendriks.json work[0]
|
||||
0|peek node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json employment.history[1]
|
||||
0|peek node_modules/fresh-test-resumes/src/fresh/johnny-trouble.json skills.sets
|
144
test/test-stdout.js
Normal file
144
test/test-stdout.js
Normal file
@ -0,0 +1,144 @@
|
||||
/**
|
||||
Output test routines for HackMyResume.
|
||||
@module test-stdout.js
|
||||
*/
|
||||
|
||||
|
||||
|
||||
var chai = require('chai')
|
||||
, expect = chai.expect
|
||||
, HMRMAIN = require('../src/cli/main')
|
||||
, CHALK = require('chalk')
|
||||
, FS = require('fs')
|
||||
, PATH = require('path')
|
||||
, PKG = require('../package.json')
|
||||
, _ = require('underscore');
|
||||
|
||||
|
||||
|
||||
var gather = '';
|
||||
var ConsoleLogOrg = console.log;
|
||||
var ProcessExitOrg = process.exit;
|
||||
|
||||
|
||||
|
||||
describe('Testing Ouput interface', function () {
|
||||
|
||||
// TODO: use sinon
|
||||
// Replacement for console.log
|
||||
function MyConsoleLog( msg ) {
|
||||
gather += Array.prototype.slice.call(arguments).join(' ');
|
||||
ConsoleLogOrg.apply(this, arguments);
|
||||
}
|
||||
|
||||
// Replacement for process.exit()
|
||||
function MyProcessExit() {
|
||||
|
||||
}
|
||||
|
||||
// HackMyResume CLI stub. Handle a single HMR invocation.
|
||||
function HackMyResumeStub( args ) {
|
||||
|
||||
console.log = MyConsoleLog;
|
||||
process.exit = MyProcessExit;
|
||||
CHALK.enabled = false;
|
||||
|
||||
try {
|
||||
args.unshift( process.argv[1] );
|
||||
args.unshift( process.argv[0] );
|
||||
var HMRMAIN = require('../src/cli/main');
|
||||
HMRMAIN( args );
|
||||
}
|
||||
catch( ex ) {
|
||||
require('../src/cli/error').err( ex, false );
|
||||
}
|
||||
CHALK.enabled = true;
|
||||
process.exit = ProcessExitOrg;
|
||||
console.log = ConsoleLogOrg;
|
||||
|
||||
}
|
||||
|
||||
// Run a test through the stub, gathering console.log output into "gather"
|
||||
// and testing against it.
|
||||
function run( title, args, tests ) {
|
||||
it( title, function() {
|
||||
|
||||
gather = '';
|
||||
HackMyResumeStub( args );
|
||||
|
||||
expect(
|
||||
_.all( tests, function(t) {
|
||||
return gather.indexOf(t) > -1;
|
||||
})
|
||||
).to.equal(true);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
var title = '*** HackMyResume v' + PKG.version + ' ***';
|
||||
var feedMe = 'Please feed me a resume in FRESH or JSON Resume format.';
|
||||
var manPage = FS.readFileSync( PATH.resolve( __dirname, '../src/cli/use.txt' ), 'utf8');
|
||||
|
||||
run('HMR should output a help string when no command is specified',
|
||||
[], [ title, 'Please give me a command (BUILD, ANALYZE, VALIDATE, CONVERT, NEW, or PEEK).' ]);
|
||||
|
||||
run('BUILD should output a tip when no source is specified',
|
||||
['build'], [ title, feedMe ]);
|
||||
|
||||
run('VALIDATE should output a tip when no source is specified',
|
||||
['validate'], [ title, feedMe ]);
|
||||
|
||||
run('ANALYZE should output a tip when no source is specified',
|
||||
['analyze'], [ title, feedMe ]);
|
||||
|
||||
run('BUILD should display an error on a broken resume',
|
||||
['build',
|
||||
'node_modules/fresh-test-resumes/src/fresh/johnny-trouble.broken.json',
|
||||
'-t', 'modern'
|
||||
], [ title, 'Error: Invalid or corrupt JSON on line' ]);
|
||||
|
||||
run('CONVERT should output a tip when no source is specified',
|
||||
['convert'], [ title, feedMe ]);
|
||||
|
||||
run('NEW should output a tip when no source is specified',
|
||||
['new'], [ title, 'Please specify the filename of the resume to create.' ]);
|
||||
|
||||
// This will cause the HELP doc to be emitted, followed by an "unknown option --help"
|
||||
// error in the log, based on the way we're calling into HMR. As long as the test
|
||||
// passes, any extraneous error messages can be ignored here.
|
||||
run('HMR should output help doc with --help',
|
||||
['--help'], [ manPage ]);
|
||||
|
||||
run('HMR should accept raw JSON via --options',
|
||||
[
|
||||
'build',
|
||||
'node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json',
|
||||
'to',
|
||||
'test/sandbox/temp/janeq-1.all',
|
||||
'-o',
|
||||
"{ theme: 'compact', debug: true, pdf: 'wkhtmltopdf' }"],
|
||||
[ 'Applying COMPACT theme (', '(with wkhtmltopdf)'] );
|
||||
|
||||
run('HMR should accept a JSON settings file via --options',
|
||||
[
|
||||
'build',
|
||||
'node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json',
|
||||
'to',
|
||||
'test/sandbox/temp/janeq-2.all',
|
||||
'--options',
|
||||
"test/hmr-options.json"],
|
||||
[ 'Applying POSITIVE theme'] );
|
||||
|
||||
run('Explicit command line options should override --options',
|
||||
[
|
||||
'build',
|
||||
'node_modules/fresh-test-resumes/src/fresh/jane-fullstacker.json',
|
||||
'to',
|
||||
'test/sandbox/temp/janeq-3.all',
|
||||
'--options',
|
||||
"test/hmr-options.json",
|
||||
"-t",
|
||||
"modern"
|
||||
],
|
||||
[ 'Applying MODERN theme'] );
|
||||
});
|
@ -1,36 +0,0 @@
|
||||
|
||||
var chai = require('chai')
|
||||
, expect = chai.expect
|
||||
, should = chai.should()
|
||||
, path = require('path')
|
||||
, _ = require('underscore')
|
||||
, FRESHResume = require('../src/core/fresh-resume')
|
||||
, CONVERTER = require('../src/core/convert')
|
||||
, FS = require('fs')
|
||||
, _ = require('underscore');
|
||||
|
||||
chai.config.includeStack = false;
|
||||
|
||||
describe('FRESH/JRS converter', function () {
|
||||
|
||||
var _sheet;
|
||||
|
||||
it('should round-trip from JRS to FRESH to JRS without modifying or losing data', function () {
|
||||
|
||||
var fileA = path.join( __dirname, 'jrs-exemplar/richard-hendriks.json' );
|
||||
var fileB = path.join( __dirname, 'sandbox/richard-hendriks.json' );
|
||||
|
||||
_sheet = new FRESHResume().open( fileA );
|
||||
_sheet.saveAs( fileB, 'JRS' );
|
||||
|
||||
var rawA = FS.readFileSync( fileA, 'utf8' );
|
||||
var rawB = FS.readFileSync( fileB, 'utf8' );
|
||||
|
||||
var objA = JSON.parse( rawA );
|
||||
var objB = JSON.parse( rawB );
|
||||
|
||||
_.isEqual(objA, objB).should.equal(true);
|
||||
|
||||
});
|
||||
|
||||
});
|
@ -1,73 +0,0 @@
|
||||
|
||||
var chai = require('chai')
|
||||
, expect = chai.expect
|
||||
, should = chai.should()
|
||||
, path = require('path')
|
||||
, _ = require('underscore')
|
||||
, FRESHResume = require('../src/core/fresh-resume')
|
||||
, validator = require('is-my-json-valid');
|
||||
|
||||
chai.config.includeStack = false;
|
||||
|
||||
describe('jane-doe.json (FRESH)', function () {
|
||||
|
||||
var _sheet;
|
||||
|
||||
it('should open without throwing an exception', function () {
|
||||
function tryOpen() {
|
||||
_sheet = new FRESHResume().open(
|
||||
'node_modules/FRESCA/exemplar/jane-doe.json' );
|
||||
}
|
||||
tryOpen.should.not.Throw();
|
||||
});
|
||||
|
||||
it('should have one or more of each section', function() {
|
||||
expect(
|
||||
//(_sheet.basics) &&
|
||||
_sheet.name && _sheet.info && _sheet.location && _sheet.contact &&
|
||||
(_sheet.employment.history && _sheet.employment.history.length > 0) &&
|
||||
(_sheet.skills && _sheet.skills.list.length > 0) &&
|
||||
(_sheet.education.history && _sheet.education.history.length > 0) &&
|
||||
(_sheet.service.history && _sheet.service.history.length > 0) &&
|
||||
(_sheet.writing && _sheet.writing.length > 0) &&
|
||||
(_sheet.recognition && _sheet.recognition.length > 0) &&
|
||||
(_sheet.samples && _sheet.samples.length > 0) &&
|
||||
(_sheet.references && _sheet.references.length > 0) &&
|
||||
(_sheet.interests && _sheet.interests.length > 0)
|
||||
).to.equal( true );
|
||||
});
|
||||
|
||||
it('should have a work duration of 7 years', function() {
|
||||
_sheet.computed.numYears.should.equal( 7 );
|
||||
});
|
||||
|
||||
it('should save without throwing an exception', function(){
|
||||
function trySave() {
|
||||
_sheet.save( 'tests/sandbox/jane-doe.json' );
|
||||
}
|
||||
trySave.should.not.Throw();
|
||||
});
|
||||
|
||||
it('should not be modified after saving', function() {
|
||||
var savedSheet = new FRESHResume().open('tests/sandbox/jane-doe.json');
|
||||
_sheet.stringify().should.equal( savedSheet.stringify() )
|
||||
});
|
||||
|
||||
it('should validate against the FRESH resume schema', function() {
|
||||
var result = _sheet.isValid();
|
||||
// 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. " +
|
||||
"Validation errors:\n\n", _sheet.imp.validationErrors, "\n\n");
|
||||
result.should.equal( true );
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
// describe('subtract', function () {
|
||||
// it('should return -1 when passed the params (1, 2)', function () {
|
||||
// expect(math.subtract(1, 2)).to.equal(-1);
|
||||
// });
|
||||
// });
|
@ -1,67 +0,0 @@
|
||||
|
||||
var chai = require('chai')
|
||||
, expect = chai.expect
|
||||
, should = chai.should()
|
||||
, path = require('path')
|
||||
, _ = require('underscore')
|
||||
, JRSResume = require('../src/core/jrs-resume')
|
||||
, validator = require('is-my-json-valid');
|
||||
|
||||
chai.config.includeStack = false;
|
||||
|
||||
describe('fullstack.json (JRS)', function () {
|
||||
|
||||
var _sheet;
|
||||
|
||||
it('should open without throwing an exception', function () {
|
||||
function tryOpen() {
|
||||
_sheet = new JRSResume().open( 'node_modules/resample/fullstack/in/resume.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 );
|
||||
});
|
||||
|
||||
it('should have a work duration of 11 years', function() {
|
||||
_sheet.computed.numYears.should.equal( 11 );
|
||||
});
|
||||
|
||||
it('should save without throwing an exception', function(){
|
||||
function trySave() {
|
||||
_sheet.save( 'tests/sandbox/fullstack.json' );
|
||||
}
|
||||
trySave.should.not.Throw();
|
||||
});
|
||||
|
||||
it('should not be modified after saving', function() {
|
||||
var savedSheet = new JRSResume().open( 'tests/sandbox/fullstack.json' );
|
||||
_sheet.stringify().should.equal( savedSheet.stringify() )
|
||||
});
|
||||
|
||||
it('should validate against the JSON Resume schema', function() {
|
||||
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", validate.errors, "\n\n");
|
||||
result.should.equal( true );
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
// describe('subtract', function () {
|
||||
// it('should return -1 when passed the params (1, 2)', function () {
|
||||
// expect(math.subtract(1, 2)).to.equal(-1);
|
||||
// });
|
||||
// });
|
@ -1,110 +0,0 @@
|
||||
|
||||
var chai = require('chai')
|
||||
, expect = chai.expect
|
||||
, should = chai.should()
|
||||
, path = require('path')
|
||||
, _ = require('underscore')
|
||||
, FRESHResume = require('../src/core/fresh-resume')
|
||||
, FCMD = require( '../src/fluentcmd')
|
||||
, validator = require('is-my-json-valid')
|
||||
, COLORS = require('colors');
|
||||
|
||||
chai.config.includeStack = false;
|
||||
|
||||
describe('Testing themes', function () {
|
||||
|
||||
var _sheet;
|
||||
|
||||
COLORS.setTheme({
|
||||
title: ['white','bold'],
|
||||
info: process.platform === 'win32' ? 'gray' : ['white','dim'],
|
||||
infoBold: ['white','dim'],
|
||||
warn: 'yellow',
|
||||
error: 'red',
|
||||
guide: 'yellow',
|
||||
status: 'gray',//['white','dim'],
|
||||
useful: 'green',
|
||||
});
|
||||
|
||||
it('HELLO-WORLD theme should generate without throwing an exception', function () {
|
||||
function tryOpen() {
|
||||
var src = ['node_modules/FRESCA/exemplar/jane-doe.json'];
|
||||
var dst = ['tests/sandbox/hello-world/resume.all'];
|
||||
var opts = {
|
||||
theme: 'hello-world',
|
||||
format: 'FRESH',
|
||||
prettify: true,
|
||||
silent: false
|
||||
};
|
||||
FCMD.verbs.build( src, dst, opts );
|
||||
}
|
||||
tryOpen.should.not.Throw();
|
||||
});
|
||||
|
||||
it('COMPACT theme should generate without throwing an exception', function () {
|
||||
function tryOpen() {
|
||||
var src = ['node_modules/FRESCA/exemplar/jane-doe.json'];
|
||||
var dst = ['tests/sandbox/compact/resume.all'];
|
||||
var opts = {
|
||||
theme: 'compact',
|
||||
format: 'FRESH',
|
||||
prettify: true,
|
||||
silent: false
|
||||
};
|
||||
FCMD.verbs.build( src, dst, opts );
|
||||
}
|
||||
tryOpen.should.not.Throw();
|
||||
});
|
||||
|
||||
it('MODERN theme should generate without throwing an exception', function () {
|
||||
function tryOpen() {
|
||||
var src = ['node_modules/FRESCA/exemplar/jane-doe.json'];
|
||||
var dst = ['tests/sandbox/modern/resume.all'];
|
||||
var opts = {
|
||||
theme: 'modern',
|
||||
format: 'FRESH',
|
||||
prettify: true,
|
||||
silent: false
|
||||
};
|
||||
FCMD.verbs.build( src, dst, opts );
|
||||
}
|
||||
tryOpen.should.not.Throw();
|
||||
});
|
||||
|
||||
it('MINIMIST theme should generate without throwing an exception', function () {
|
||||
function tryOpen() {
|
||||
var src = ['node_modules/FRESCA/exemplar/jane-doe.json'];
|
||||
var dst = ['tests/sandbox/minimist/resume.all'];
|
||||
var opts = {
|
||||
theme: 'minimist',
|
||||
format: 'FRESH',
|
||||
prettify: true,
|
||||
silent: false
|
||||
};
|
||||
FCMD.verbs.build( src, dst, opts );
|
||||
}
|
||||
tryOpen.should.not.Throw();
|
||||
});
|
||||
|
||||
it('AWESOME theme should generate without throwing an exception', function () {
|
||||
function tryOpen() {
|
||||
var src = ['node_modules/FRESCA/exemplar/jane-doe.json'];
|
||||
var dst = ['tests/sandbox/awesome/resume.all'];
|
||||
var opts = {
|
||||
theme: 'awesome',
|
||||
format: 'FRESH',
|
||||
prettify: true,
|
||||
silent: false
|
||||
};
|
||||
FCMD.verbs.build( src, dst, opts );
|
||||
}
|
||||
tryOpen.should.not.Throw();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// describe('subtract', function () {
|
||||
// it('should return -1 when passed the params (1, 2)', function () {
|
||||
// expect(math.subtract(1, 2)).to.equal(-1);
|
||||
// });
|
||||
// });
|
Reference in New Issue
Block a user