-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (78 loc) · 2.58 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# main commands
## command to open R in interactive session
R:
R --quiet --no-save
## command to remove automatically generated files
clean:
rm -rf man/*
rm -rf docs/*
rm -rf inst/doc/*
# R package development commands
## build docs and run tests
all: man readme test check spellcheck
## build docs
man:
R --slave -e "devtools::document()"
## reubild readme
readme:
R --slave -e "rmarkdown::render('README.Rmd')"
## run tests
test:
R --slave -e "devtools::test()" > test.log 2>&1
rm -f tests/testthat/Rplots.pdf
## test examples
examples:
R --slave -e "devtools::run_examples(test = TRUE, run = TRUE);warnings()" >> examples.log
rm -f Rplots.pdf
## run checks
check:
echo "\n===== R CMD CHECK =====\n" > check.log 2>&1
R --slave -e "devtools::check(build_args = '--no-build-vignettes', args = '--no-build-vignettes', run_dont_test = TRUE, vignettes = FALSE)" >> check.log 2>&1
## check docs for spelling mistakes
spellcheck:
echo "\n===== SPELL CHECK =====\n" > spell.log 2>&1
R --slave -e "devtools::spell_check()" >> spell.log 2>&1
## install package
install:
R --slave -e "devtools::install_local(getwd(), force = TRUE, upgrade = 'never')"
## build entire site
site:
R --slave -e "pkgdown::clean_site()"
R --slave -e "pkgdown::build_site(run_dont_run = TRUE, lazy = FALSE)"
## rebuild update files for site
quicksite:
R --slave -e "pkgdown::build_site(run_dont_run = TRUE, lazy = TRUE)"
# commands to launch app
## launch local version using system libraries
debug:
R -e "options(golem.app.prod = FALSE); golem::run_dev()"
quick-debug:
R -e "options(golem.app.prod = FALSE, quick = TRUE); golem::run_dev()"
## launch local version inside Docker container
demo:
docker-compose up --build -d
demo-kill:
docker-compose down
## launch released version inside Docker container
launch:
docker run -dp 3838:3838 --name whattemplatemaker -it naturecons/whattemplatemaker
launch-kill:
docker rm --force whattemplatemaker
# Docker commands
## create local image and push to docker
image:
docker build -t naturecons/whattemplatemaker:latest .
docker push naturecons/whattemplatemaker:latest
## delete all local containers and images
reset:
docker rm $(docker ps -aq) || \
docker rmi -f $(docker images -aq)
# renv commands
## update deps
updatedeps:
R --slave -e "remotes::install_github('NCC-CNC/whatdataio', force = TRUE, upgrade = 'never')"
R --slave -e "renv::snapshot()"
## snapshot R package dependencies
snapshot:
R -e "renv::snapshot()"
.PHONY: clean data readme test check install man spellcheck examples site quicksite snapshot deploy demo demo-kill image debug snapshot updatedeps