-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
50 lines (40 loc) · 1.73 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# h/t to @jimhester and @yihui for this parse block:
# https://github.com/yihui/knitr/blob/dc5ead7bcfc0ebd2789fe99c527c7d91afb3de4a/Makefile#L1-L4
# Note the portability change as suggested in the manual:
# https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Writing-portable-packages
PKGNAME = `sed -n "s/Package: *\([^ ]*\)/\1/p" DESCRIPTION`
PKGVERS = `sed -n "s/Version: *\([^ ]*\)/\1/p" DESCRIPTION`
.PHONY: paper
all: check
build:
R CMD build .
check: build
R CMD check --no-manual $(PKGNAME)_$(PKGVERS).tar.gz
install_deps:
Rscript \
-e 'if (!requireNamespace("remotes")) install.packages("remotes")' \
-e 'remotes::install_deps(dependencies = TRUE)'
install: install_deps build
R CMD INSTALL $(PKGNAME)_$(PKGVERS).tar.gz
build_pkgdown:
Rscript \
-e 'devtools::load_all(path = here::here())' \
-e 'devtools::document()' \
-e 'pkgdown::build_site()' \
style:
Rscript -e "styler::style_dir(path = here::here('R'), filetype = c('R'), recursive = FALSE, include_roxygen_examples = TRUE)"
Rscript -e "styler::style_dir(path = here::here('tests', 'testthat'), filetype = c('R'), recursive = FALSE, include_roxygen_examples = TRUE)"
paper_clean:
rm -rf paper/*.html paper/*.tex paper/*.log paper/*.md paper/submission/*.md
paper:
Rscript -e "rmarkdown::render(input = here::here('paper', 'paper.Rmd'))"
Rscript -e "knitr::purl(here::here('paper', 'paper.Rmd'), documentation = 0)"
mv paper.R paper/code.R
Rscript -e "knitr::spin(hair = here::here('paper', 'code.R'))"
mv code.html code.md paper/code.R paper/submission/
mv paper/paper.pdf paper/submission/
tar -cvzf maars_submission.tar.gz paper/submission
mv maars_submission.tar.gz paper/submission/
make paper_clean
clean:
@rm -rf $(PKGNAME)_$(PKGVERS).tar.gz $(PKGNAME).Rcheck