Skip to content
This repository was archived by the owner on Jul 5, 2021. It is now read-only.

Commit

Permalink
Dev processes can be killed with ctrl-c (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
richsilv authored and daviddias committed Jul 19, 2017
1 parent 9e42138 commit 4d2b061
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,5 @@ typings/
public
static/js
static/css
dev.pid
package-lock.json
auth.token
18 changes: 5 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ IPFSGATEWAY="https://ipfs.io/ipfs/"
NPM=npm
NPMBIN=./node_modules/.bin
OUTPUTDIR=public
PIDFILE=dev.pid

ifeq ($(DEBUG), true)
PREPEND=
Expand All @@ -32,7 +31,6 @@ help:
@echo ' make css Compile the *.styl to ./static/css '
@echo ' make minify Optimise all the things! '
@echo ' make dev Start a hot-reloding dev server on http://localhost:1313 '
@echo ' make dev-stop Stop the dev server '
@echo ' make deploy Add the website to your local IPFS node '
@echo ' make publish-to-domain Update $(DOMAIN) DNS record to the ipfs hash from the last deploy '
@echo ' make clean remove the generated files '
Expand Down Expand Up @@ -70,20 +68,14 @@ minify-img: install
wait

dev: install js css
$(PREPEND)[ ! -f $(PIDFILE) ] || rm $(PIDFILE) ; \
touch $(PIDFILE) ; \
($(NPMBIN)/nodemon --watch less --exec "$(NPMBIN)/lessc --clean-css --autoprefix less/main.less static/css/main.css" & echo $$! >> $(PIDFILE) ; \
$(NPMBIN)/watchify --noparse=jquery js/{header-and-latest,header}.js -p [ factor-bundle -o static/js/header-and-latest.js -o static/js/header.js ] -o static/js/common.js & echo $$! >> $(PIDFILE) ; \
hugo server -w & echo $$! >> $(PIDFILE))

dev-stop:
$(PREPEND)touch $(PIDFILE) ; \
[ -z "`(cat $(PIDFILE))`" ] || kill `(cat $(PIDFILE))` ; \
rm $(PIDFILE)
$(PREPEND)( \
$(NPMBIN)/nodemon --watch less --exec "$(NPMBIN)/lessc --clean-css --autoprefix less/main.less static/css/main.css" & \
$(NPMBIN)/watchify --noparse=jquery js/{header-and-latest,header}.js -p [ factor-bundle -o static/js/header-and-latest.js -o static/js/header.js ] -o static/js/common.js & \
hugo server -w \
)

deploy:
$(PREPEND)rm -rf public/blog ; \
ipfs swarm peers >/dev/null || (echo "ipfs daemon must be online to publish" && exit 1) ; \
ipfs add -r -q $(OUTPUTDIR) | tail -n1 >versions/current ; \
cat versions/current >>versions/history ; \
export hash=`cat versions/current`; \
Expand Down

0 comments on commit 4d2b061

Please sign in to comment.