From 4e2670b08f68587669e79bb0a3beb187f4720db1 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Mon, 22 Feb 2010 20:11:01 -0800 Subject: [PATCH] check in the new commit hooks --- commit-hook/commit.cgi | 25 +++++++++++++++++++++++++ commit-hook/commit.sh | 19 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 commit-hook/commit.cgi create mode 100755 commit-hook/commit.sh diff --git a/commit-hook/commit.cgi b/commit-hook/commit.cgi new file mode 100755 index 0000000..1494318 --- /dev/null +++ b/commit-hook/commit.cgi @@ -0,0 +1,25 @@ +#!/usr/local/bin/perl +use URI::Escape; +use JSON; + +# Read in the POST data and URL-decode it. +$data=""; +while (<>) { + $data .= $_; +} +$data = uri_unescape($data); +$data =~ s/.*?=//; # JSON::decode_json doesn't like the 'payload=' prefix. + +# Save for debugging. +open (MYFILE, '>./postdata.txt'); +print MYFILE $data; +close (MYFILE); + +# Parse the JSON +$perl_scalar = decode_json $data; +$id=$perl_scalar->{'after'}; +die unless $id =~ /^[0-9][a-f]*$/; +print "Id: $id\n"; + +# Run the actual commit hook. +system("./commit.sh $id"); diff --git a/commit-hook/commit.sh b/commit-hook/commit.sh new file mode 100755 index 0000000..439cbf8 --- /dev/null +++ b/commit-hook/commit.sh @@ -0,0 +1,19 @@ +#!/bin/bash +id=$1; + +echo id: $id > ./id.txt +dir=git-$id +mkdir $dir +cd $dir + +# TODO(danvk): any way to clone at a particular revision? +git clone --depth 0 git://github.com/danvk/dygraphs.git +cd dygraphs +./generate-combined.sh + +# Copy data over to http://www.danvk.org/dygraphs/ +cp tests/*.html tests/*.js ~/danvk.org/dygraphs/tests/ +cp dygraph.js dygraph-canvas.js dygraph-combined.js gadget.xml excanvas.js thumbnail.png docs/* ~/danvk.org/dygraphs/ + +cd ../.. +rm -rf $dir -- 2.7.4