Skip to content

Commit

Permalink
testing Makefile tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Carroll committed Apr 25, 2018
1 parent e5d8bd7 commit b9492c7
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@ SLIDES_PMD := $(shell find . -path "./docs/_slides_pmd/*.pmd")

# look up files for trainees in Jekyll _config.yml
HANDOUTS := $(shell ruby -e "require 'yaml';puts YAML.load_file('docs/_config.yml')['handouts']")
HANDOUTS := $(HANDOUTS:worksheet%=worksheet-$(LESSON)%)
HANDOUTS := $(HANDOUTS:%=../../release/%)
COURSE_HANDOUTS := $(HANDOUTS:worksheet%=worksheet-$(LESSON)%)
COURSE_HANDOUTS := $(COURSE_HANDOUTS:%=../../release/%)

# do not run rules in parallel; because
# bin/build_slides.R (.py) runs over all .Rmd (.pmd) slides
# bin/build_slides.* runs over all .Rmd and .pmd slides
.NOTPARALLEL:
.DEFAULT_GOAL: slides
.PHONY: course lesson slides archive

# target to check files in docs/_slides
slides: $(SLIDES:%=docs/_slides/%.md) | docs/_slides
docs/_slides:
mkdir docs/_slides
slides: $(SLIDES:%=docs/_slides/%.md) | .git/refs/remotes/upstream

# target to ensure upstream remote is lesson-style
.git/refs/remotes/upstream:
git remote add upstream "[email protected]:sesync-ci/lesson-style.git"
git fetch upstream
git checkout -b upstream upstream/master
git checkout master

# cannot use a pattern as the next three targets, because
# the targets are only a subset of docs/_slides/%.md and
Expand All @@ -36,24 +41,19 @@ $(subst _pmd,,$(SLIDES_PMD:.pmd=.md)): $(SLIDES_PMD)
@bin/build_slides.py

# target to update lesson repo on GitHub
lesson: slides | .git/refs/remotes/upstream
lesson: slides
git pull
git fetch upstream master:upstream
git merge --no-edit upstream
git push
.git/refs/remotes/upstream:
git remote add upstream "[email protected]:sesync-ci/lesson-style.git"
git fetch upstream
git checkout -b upstream upstream/master
git checkout master

# target copies lesson handouts to the ../../release/ director,
# while adding lesson numbers to worksheets
.SECONDEXPANSION:
$(HANDOUTS): $$(patsubst worksheet-$(LESSON)%,worksheet%,$$(subst ../../release/,,$$@))
$(COURSE_HANDOUTS): $$(patsubst worksheet-$(LESSON)%,worksheet%,$$(subst ../../release/,,$$@))
cp -r $< $@

# targets keep jekyll site up to date
# targets keep jekyll site up to date for RStudio Viewer presentation on port 4000
export GEM_HOME=$(HOME)/.gem
SITE = $(shell find ./docs/ ! -name _site)
docs/_site: $(SITE) | docs/Gemfile.lock
Expand All @@ -64,7 +64,7 @@ docs/Gemfile.lock:

# make target "course" is called within the handouts Makefile,
# assumed to be at ../../
course: lesson $(HANDOUTS) docs/_site
course: lesson $(COURSE_HANDOUTS) docs/_site

# call the archive target with a
# command line parameter for DATE
Expand Down

0 comments on commit b9492c7

Please sign in to comment.