-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.R
executable file
·43 lines (36 loc) · 1.23 KB
/
build.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
35
36
37
38
39
40
41
42
43
#! /usr/bin/env Rscript
t_start <- Sys.time()
cat("\n\nRendering things…\n")
rmarkdown::render(input = "index.Rmd",
output_format = "revealjs::revealjs_presentation",
output_file = "index.html",
encoding = "UTF-8", quiet = TRUE)
cat("\nChecking who you are…\n")
current_user <- Sys.info()[["user"]]
cat(paste0("I hope you're really ", current_user), "\n")
if (current_user == "Lukas") {
slides_dir <- "~/Sync/public.tadaa-data.de/r-intro/slides"
} else if (current_user == "tobi") {
slides_dir <- "~/Dokumente/syncthing/public.tadaa-data.de/r-intro/slides"
} else {
slides_dir <- NA
}
cat("Pushing stuff to output directory…\n")
if (is.na(slides_dir)) {
cat("No output directory defined, leaving everything as is.\n")
} else {
cat("Copying to", slides_dir)
files <- c("assets", "index.html")
status <- file.copy(files, slides_dir, overwrite = TRUE, recursive = TRUE)
if (all(status)) {
cat("\nCopying worked fine\n")
} else {
cat("Warning: Copying didn't work right!")
}
}
#### Done ####
cat("\nAll done!\n")
t_finish <- Sys.time()
t_diff <- round(as.numeric(difftime(t_finish, t_start, "s")), 0)
cat("Took about", t_diff, "seconds", "\n")
timestamp()