hgbook

changeset 634:d1a6ed326f87

Add package and upload script
author Dongsheng Song <dongsheng.song@gmail.com>
date Fri Mar 13 16:01:21 2009 +0800 (2009-03-13)
parents 74da9b315396
children fa8a143923ae
files contrib/hg-package
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/contrib/hg-package	Fri Mar 13 16:01:21 2009 +0800
     1.3 @@ -0,0 +1,54 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +build_dir=`dirname "$0"`/../build
     1.7 +rev_id=`hg parents --template '{date|shortdate}' | sed 's/-//g'`
     1.8 +
     1.9 +for l in en zh; do
    1.10 +  (cd ${build_dir}/${l};
    1.11 +
    1.12 +  f='html'
    1.13 +  if [ -f "${f}/index.html" ] ; then
    1.14 +     d=hgbook-${l}-${f}
    1.15 +     rm -fr ${d} && cp -r ${f} ${d} && tar czf ../${d}-${rev_id}.tar.gz ${d}
    1.16 +  fi
    1.17 +
    1.18 +  f='html-single'
    1.19 +  if [ -f "${f}/hgbook.html" ] ; then
    1.20 +     d=hgbook-${l}-${f}
    1.21 +     rm -fr ${d} && cp -r ${f} ${d} && tar czf ../${d}-${rev_id}.tar.gz ${d}
    1.22 +  fi
    1.23 +
    1.24 +  if [ -f "pdf/hgbook.pdf" ] ; then
    1.25 +     cp pdf/hgbook.pdf ../hgbook-${l}-${rev_id}.pdf
    1.26 +     gzip -f9 ../hgbook-${l}-${rev_id}.pdf
    1.27 +  fi
    1.28 +  )
    1.29 +done
    1.30 +
    1.31 +upload_pass=$1
    1.32 +upload_user=$2
    1.33 +
    1.34 +if [ "${upload_user}x" == "x" ]; then
    1.35 +  upload_user="dongsheng.song"
    1.36 +fi
    1.37 +
    1.38 +if [ "${upload_pass}x" != "x" ]; then
    1.39 +  (
    1.40 +  cd ${build_dir}
    1.41 +  curl -O http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py
    1.42 +
    1.43 +  for l in en zh; do
    1.44 +    python googlecode_upload.py -u "dongsheng.song" -w "$1" \
    1.45 +      -p "i18n-zh" -l "Type-Docs,hgbook" \
    1.46 +      -s "Distributed revision control with Mercurial - ${l} - pdf" \
    1.47 +      hgbook-${l}-${rev_id}.pdf.gz
    1.48 +
    1.49 +    for f in html html-single; do
    1.50 +      python googlecode_upload.py -u "dongsheng.song" -w "$1" \
    1.51 +        -p "i18n-zh" -l "Type-Docs,hgbook" \
    1.52 +        -s "Distributed revision control with Mercurial - ${l} - ${f}" \
    1.53 +        hgbook-${l}-${f}-${rev_id}.tar.gz
    1.54 +    done
    1.55 +  done
    1.56 +  )
    1.57 +fi