Check for presence of Jekyll before proceeding

This commit is contained in:
Rico Sta. Cruz 2019-03-27 19:17:17 +08:00
parent 3957e0f973
commit c0835bcb29
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
1 changed files with 16 additions and 5 deletions

View File

@ -2,6 +2,12 @@ npmbin := ./node_modules/.bin
PORT ?= 3000 PORT ?= 3000
HOST ?= 127.0.0.1 HOST ?= 127.0.0.1
help:
@echo
@echo Makefile targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@echo
# Builds intermediate files. Needs a _site built first though # Builds intermediate files. Needs a _site built first though
update: _site critical update: _site critical
@ -9,10 +15,10 @@ update: _site critical
_site: _site:
bundle exec jekyll build --incremental bundle exec jekyll build --incremental
# Builds critical path CSS/JS critical: _site ## Builds critical path CSS/JS
critical: _site
node _support/critical.js node _support/critical.js
# Ensure that bins are available.
ensure-bin: ensure-bin:
@if [ ! -d $(npmbin) ]; then \ @if [ ! -d $(npmbin) ]; then \
echo "---"; \ echo "---"; \
@ -20,9 +26,14 @@ ensure-bin:
echo "---"; \ echo "---"; \
exit 1; \ exit 1; \
fi fi
@if ! bundle show jekyll &>/dev/null; then \
echo "---"; \
echo "Error: Jekyll not found, you may need to run '[docker-compose run --rm web] bundle install'."; \
echo "---"; \
exit 1; \
fi
# Starts development server dev: ensure-bin ## Starts development server
dev: ensure-bin
$(npmbin)/concurrently -k -p command -c "blue,green" \ $(npmbin)/concurrently -k -p command -c "blue,green" \
"make dev-webpack" \ "make dev-webpack" \
"make dev-jekyll" "make dev-jekyll"
@ -37,7 +48,7 @@ dev-jekyll: ensure-bin
bundle exec jekyll serve --safe --trace --drafts --watch --host $(HOST) --port $(PORT); \ bundle exec jekyll serve --safe --trace --drafts --watch --host $(HOST) --port $(PORT); \
fi fi
test: _site test: _site ## Runs rudimentary tests
@test -f _site/vim.html @test -f _site/vim.html
@test -f _site/react.html @test -f _site/react.html
@test -f _site/index.html @test -f _site/index.html