-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserve_resume.R
executable file
·34 lines (26 loc) · 1.02 KB
/
serve_resume.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env Rscript
"usage: serve_resume.R [--resume <resume> --host <host>]
options:
--resume <resume> resume.json file
--host <host> Host
" -> doc
library(docopt)
library(glue)
opts <- docopt(doc)
host <- if (!is.null(opts$host)) opts$host else "127.0.0.1"
resume <- if (!is.null(opts$resume)) opts$resume else "resume.json"
missing_hackmyresume <- system("hackmyresume -h", ignore.stdout=TRUE, ignore.stderr=TRUE)
if (missing_hackmyresume) {
stop("hackmyresume is not installed.\nTry `[sudo] npm install -g hackmyresume`\nOr visit https://github.com/hacksalot/HackMyResume")
}
if (!"package-lock.json" %in% dir("theme/dave-alt/"))
stop("Please run `npm install` in `theme/dave-alt/`")
require(servr)
has_index <- "index.html" %in% dir()
if (!has_index)
system(glue("hackmyresume build {resume} TO index.html -t ./theme/dave-alt/"))
rebuild <- function(x) {
if (x == resume)
system(glue("hackmyresume build {resume} TO index.html -t ./theme/dave-alt/"))
}
httw(handler = rebuild, pattern = resume, host = host)