Skip to content

Commit 1d7fc75

Browse files
committed
added a little makefile to help publishing
1 parent d104320 commit 1d7fc75

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cache
22
output
3-
.v
3+
.venv
44
*.pyc
55
*.egg-info

Makefile

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Gitoyen public web site
2+
# https://gitoyen.net/
3+
#
4+
5+
BASEDIR=$(CURDIR)
6+
OUTPUTDIR=$(BASEDIR)/output
7+
PY=$(shell which python)
8+
GITOYEN_BIN="gitoyen"
9+
10+
SSH_HOST=kilo.gitoyen.net
11+
SSH_TARGET_DIR=/var/www/www.gitoyen.net/
12+
13+
help:
14+
@echo 'Makefile for Gitoyen public web site '
15+
@echo ' '
16+
@echo 'Usage: '
17+
@echo ' make clean remove the generated files '
18+
@echo ' make new create a new gitoyen blog post '
19+
@echo ' make build generate gitoyen static site in ./output dir '
20+
@echo ' make serve generate + serve site at http://localhost:8000'
21+
@echo ' make upload upload the web site via rsync+ssh '
22+
@echo ' '
23+
24+
deps:
25+
@hash $(GITOYEN_BIN) > /dev/null 2>&1 || \
26+
(echo "Please install gitoyen package to continue (make install)"; exit 1)
27+
28+
venv:
29+
@hash virtualenv> /dev/null 2>&1 || \
30+
(echo "Please install virtualenv to continue"; exit 1)
31+
virtualenv -p /usr/bin/python2.7 $(BASEDIR)/.venv
32+
33+
sourcevenv:
34+
@test -f "$(BASEDIR)/.venv/bin/activate" || \
35+
(echo "Python virtualenv not found, please run 'make venv'"; exit 1)
36+
@if [ ${PY} != "$(BASEDIR)/.venv/bin/python" ]; then \
37+
echo "Virtualenv not activated, please run: source $(BASEDIR)/.venv/bin/activate"; \
38+
fi
39+
40+
install: venv sourcevenv
41+
pip install -e .
42+
43+
build: sourcevenv deps
44+
gitoyen build
45+
46+
clean: sourcevenv deps
47+
gitoyen clean
48+
49+
new: sourcevenv deps
50+
gitoyen new_post
51+
52+
serve: sourcevenv deps
53+
@sensible-browser http://localhost:8000/
54+
gitoyen serve
55+
56+
upload: build
57+
rsync -e ssh -P -rvz --delete $(OUTPUTDIR)/ $(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
58+
59+
.PHONY: help clean new serve upload install build

0 commit comments

Comments
 (0)