-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile
36 lines (29 loc) · 1.74 KB
/
Makefile
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
#!usr/bin/make -f
# All commands are run as R functions rather than shell commands so that it will work easily on any Windows machine, even if the Windows machine isn't properly set up with all the right tools
all: README.md
clean:
Rscript -e 'suppressWarnings(file.remove("README.md", "vignettes/ggExtra.md"))'
.PHONY: all clean build-image render-figs test
.DELETE_ON_ERROR:
.SECONDARY:
README.md : vignettes/ggExtra.Rmd
# echo "Rendering the ggExtra vignette"
Rscript -e 'rmarkdown::render("vignettes/ggExtra.Rmd", output_format = "md_document")'
# echo "Correcting image paths"
# sed -i -- 's,../inst,inst,g' vignettes/ggExtra.md
Rscript -e 'file <- gsub("\\.\\./inst", "inst", readLines("vignettes/ggExtra.md")); writeLines(file, "vignettes/ggExtra.md")'
Rscript -e 'dir.create("inst/vignette_files/", showWarnings = FALSE);file.copy("vignettes/ggExtra_files/", "inst/vignette_files/", overwrite = TRUE, recursive = TRUE)'
Rscript -e 'file <- gsub("ggExtra_files", "inst/vignette_files/ggExtra_files", readLines("vignettes/ggExtra.md")); writeLines(file, "vignettes/ggExtra.md")'
Rscript -e 'file <- gsub("\\\\```", "```", readLines("vignettes/ggExtra.md")); writeLines(file, "vignettes/ggExtra.md")'
# echo "Copying output to README.md"
# cp vignettes/ggExtra.md README.md
Rscript -e 'file.copy("vignettes/ggExtra.md", "README.md", overwrite = TRUE)'
Rscript -e 'suppressWarnings(file.remove("vignettes/ggExtra.md"))'
build-image:
docker build -t ggextra-image .
render-figs:
docker run --rm -v `pwd`:/home/ggExtra ggextra-image \
Rscript -e "devtools::load_all(); source('tests/testthat/render-figs.R')"
test:
docker run --rm -v `pwd`:/home/ggExtra ggextra-image \
/bin/bash -c 'R CMD build ../ggExtra && R CMD check ggExtra_* --as-cran --no-manual'