Skip to content

Instantly share code, notes, and snippets.

@drscream
Created December 16, 2013 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drscream/7993238 to your computer and use it in GitHub Desktop.
Save drscream/7993238 to your computer and use it in GitHub Desktop.
REMOTE ?= "tm@frubar:~/htdocs"
TOPIC ?= "New-Post"
DATE ?= "$(shell date --rfc-3339='seconds')"
FILE = "$(shell echo "+./_drafts/$(TOPIC).md" | sed -e y/\ /-/ | tr A-Z a-z)"
help:
@echo 'Makefile for a jekyll web site '
@echo ' '
@echo 'Usage: '
@echo ' make new create new blog entry based on template '
@echo ' make clean remove the generated files '
@echo ' make build (re)generate the web site '
@echo ' make push upload the web site via rsync+ssh '
@echo ' make deploy generate using production settings '
@echo ' make serve serve site at http://localhost:8000 '
@echo ' '
@echo 'Variables: '
@echo ' REMOTE=$(REMOTE) '
@echo ' TOPIC=$(TOPIC) '
@echo ' DATE=$(DATE) '
@echo ' FILE=$(FILE) '
@echo ' '
new:
echo "---" >> $(FILE)
echo "title: $(TOPIC)" >> $(FILE)
echo "layout: post" >> $(FILE)
echo "date: $(DATE)" >> $(FILE)
echo "published: false" >> $(FILE)
echo "---" >> $(FILE)
clean:
rm -r _site/*
build:
jekyll build
push:
rsync --archive --compress --delete _site/* $(REMOTE)
deploy: build push
serve:
jekyll serve --drafts --watch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment