Created
January 3, 2014 20:00
-
-
Save whitequark/8245480 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host := www-foo@othalan.whitequark.org | |
Root := foo | |
Branch := $(shell git rev-parse HEAD) | |
# Generic rules | |
.PHONY:: all clean deps | |
all: | |
ocamlbuild -j 8 -use-ocamlfind lib/foo.d.byte | |
clean: | |
ocamlbuild -clean | |
deps: | |
opam install extlib extunix ssl yojson atdgen type_conv sexplib lwt cohttp cryptokit inspect | |
# Server-related rules | |
.PHONY:: sync deploy restart | |
sync: | |
rsync -avz $(Host):$(Root)/data/ data/ | |
deploy: all | |
@test -z "$$(git diff-index --name-only HEAD --)" || (echo "git: local changes present"; false) | |
git push origin | |
ssh $(Host) '\ | |
set -e; \ | |
eval `opam config -env`; \ | |
cd $(Root); \ | |
git fetch origin; \ | |
git reset --hard $(Branch); \ | |
make deps; \ | |
make all; \ | |
make restart' | |
restart: | |
[ -e cache/foo.pid ] && kill `cat cache/foo.pid` || true | |
./foo.d.byte -daemon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment