-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
65 lines (38 loc) · 1.51 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
# Build the artefacts required for the RSE 2018 Workshop on Shiny
#
# David Mawdsley
#
.NOTPARALLEL: sitecontent
presentationname=WorkshopSlides
contentrmd = $(shell find content/ -name '*.Rmd' -print)
contentmd = $(patsubst %.Rmd,%.md,$(contentrmd))
sourcedata = $(wildcard sourcedata/*)
.PHONEY: runrstudio stoprstudio dockerimage
.INTERMEDIATE: $(presentationname)_annote.Rmd
all: slides site
site: sitecontent
hugo
# Remove generated markdown from site
cleancontent:
rm $$(find content -name "*.md" -print)
sitecontent: $(contentmd)
%.md: %.Rmd
./addlinks.sh $(patsubst %.md,%.Rmd,$@) $(patsubst %.md,%_gitlink.Rmd,$@)
cd $(dir $@) && Rscript -e "knitr::knit('$(patsubst %.md,%_gitlink.Rmd,$(notdir $@))', output='$(notdir $@)')"
rm $(patsubst %.md, %_gitlink.Rmd,$@)
slides: $(presentationname).html
$(presentationname).html: $(presentationname)_annote.Rmd coursematerial/workshopFunctions.R coursematerial/gapminder.rds .gitmodules presentstyle.css headerfooter.html
Rscript -e "rmarkdown::render('$<', output_file='$@')"
touch content/slides.html
$(presentationname)_annote.Rmd: $(presentationname).Rmd
./addlinks.sh $< $@
present: $(presentationname).html
chromium-browser $< &
dockerimage: Dockerfile
docker build . -t mawds/rstudio
coursematerial/gapminder.rds: createData.R $(sourcedata)
Rscript $<
runrstudio:
docker run --rm -d --name rstudio -p 8787:8787 -p 3838:3838 -v "$$(pwd)/coursematerial:/home/rstudio/coursematerial" -e USERID=$UID mawds/rstudio
stoprstudio:
docker stop rstudio