Skip to content

Commit

Permalink
I went to 11 with this auto-render thing
Browse files Browse the repository at this point in the history
  • Loading branch information
relaxdiego committed Sep 23, 2017
1 parent 267d8eb commit de069a6
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 34 deletions.
12 changes: 12 additions & 0 deletions Makefile
@@ -0,0 +1,12 @@
ROOTDIR=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))

.PHONY: resume
.DEFAULT: resume

resume: resume.pdf resume/index.html

resume.pdf: resume/resume.adoc resume/index.adoc
@script/resume-pdf

resume/index.html: resume/resume.adoc resume/index.adoc
@script/resume-html
6 changes: 2 additions & 4 deletions Procfile
@@ -1,4 +1,2 @@
# Run this using Foreman via `foreman start`
# See: https://github.com/ddollar/foreman
web: jekyll server start
resume: ./render-resume
blog: jekyll server start
resume: script/autorenderer
7 changes: 0 additions & 7 deletions build

This file was deleted.

23 changes: 0 additions & 23 deletions render-resume

This file was deleted.

19 changes: 19 additions & 0 deletions script/autorenderer
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

# In case something changed before this script started
make resume

# Requires fswatch https://github.com/emcrisostomo/fswatch
# `brew install fswatch`

# This loop was inspired by https://superuser.com/a/181543/774060
fswatch -x ./resume |
while read -r path events; do
filename=$(basename "$path")
extension="${filename##*.}"

if [ "$extension" = "adoc" ]; then
echo "Source file changed: $filename"
make resume
fi
done
4 changes: 4 additions & 0 deletions script/resume-html
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
cd $(dirname "${BASH_SOURCE[0]}")/..
asciidoctor --base-dir ./ resume/index.adoc
echo " rendered resume/index.html"
4 changes: 4 additions & 0 deletions script/resume-pdf
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
cd $(dirname "${BASH_SOURCE[0]}")/..
asciidoctor-pdf --base-dir ./ --destination-dir ./ --out-file resume.pdf resume/index.adoc
echo " rendered ./resume.pdf"
12 changes: 12 additions & 0 deletions start
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Run this via `./start`

if hash foreman 2>/dev/null; then
foreman start
else
echo "==============================================="
echo "Please install Foreman before proceeding"
echo "More info at https://github.com/ddollar/foreman"
echo "==============================================="
fi

0 comments on commit de069a6

Please sign in to comment.