diff options
| -rw-r--r-- | GNUmakefile | 4 | ||||
| -rw-r--r-- | post-receive | 22 | ||||
| -rw-r--r-- | template.html | 6 | ||||
| -rwxr-xr-x | template.pl | 4 |
4 files changed, 28 insertions, 8 deletions
diff --git a/GNUmakefile b/GNUmakefile index e5da114..b95157e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -22,10 +22,6 @@ compress: build # for gzip-static, check the openbsd httpd.conf(5) man page find out/ -type f -exec grep -Il . {} \; \ -exec gzip -k {} \; -publish: compress build - rsync -rcvP --delete out/ \ - lemurianmage@slimegirl.nexus:/var/www/htdocs/slimegirl.nexus - clean: rm -r out/ diff --git a/post-receive b/post-receive new file mode 100644 index 0000000..18dedf6 --- /dev/null +++ b/post-receive @@ -0,0 +1,22 @@ +#!/bin/sh + +# post-receive hook for the webserver + +TARGET="/var/www/htdocs/slimegirl.nexus" +GIT_DIR="/var/www/pub/git/slimegirl.nexus" + +tmpdir=$(mktemp -d) || exit 1 + +cleanup() { rm -rf "$tmpdir"; } + +while read oldrev newrev ref; do + if [ "$ref" = "refs/head/master" ]; then + echo "!!deploying!!" + cd $tmpdir + git --work-tree=. --git-dir="$GIT_DIR" checkout -f + gmake clean && gmake compress + rsync -rcvP --delete out/ "$TARGET" + fi +done + +trap cleanup EXIT diff --git a/template.html b/template.html index 97d226a..c59696f 100644 --- a/template.html +++ b/template.html @@ -10,9 +10,6 @@ $for(css.split)$ <link rel="stylesheet" href="$this.escapehtmlurl$"> $endfor$ - $for(javascript.split)$ - <script src="$this.escapehtmlurl$"></script> - $endfor$ <title>$ifdef(title)$$title.escapehtml$$endif$</title> $htmlheader$ </head> @@ -24,5 +21,8 @@ </nav> <article>$body$</article> + $for(javascript.split)$ + <script src="$this.escapehtmlurl$"></script> + $endfor$ </body> </html> diff --git a/template.pl b/template.pl index 793f9b3..4d9dadd 100755 --- a/template.pl +++ b/template.pl @@ -11,7 +11,9 @@ use File::Basename; use open qw( :std :encoding(UTF-8) ); -my $content = `lowdown --html-titleblock --html-no-head-ids -s --template template.html $ARGV[0]`; +my $LOWDOWN_FLAGS = '--html-titleblock --html-no-head-ids -s --template template.html'; + +my $content = `lowdown $LOWDOWN_FLAGS $ARGV[0]`; my $dom = Mojo::DOM->new($content); |
