franta-hg@23: #!/bin/bash franta-hg@23: franta-hg@23: # Free Telco Dictionary franta-hg@23: # Copyright © 2013 František Kučera (frantovo.cz) franta-hg@23: # franta-hg@23: # This program is free software: you can redistribute it and/or modify franta-hg@23: # it under the terms of the GNU General Public License as published by franta-hg@23: # the Free Software Foundation, either version 3 of the License, or franta-hg@23: # (at your option) any later version. franta-hg@23: # franta-hg@23: # This program is distributed in the hope that it will be useful, franta-hg@23: # but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@23: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@23: # GNU General Public License for more details. franta-hg@23: # franta-hg@23: # You should have received a copy of the GNU General Public License franta-hg@23: # along with this program. If not, see . franta-hg@23: franta-hg@23: franta-hg@23: # Script for generating deliverables: franta-hg@23: # packed dictionary data in StarDict format franta-hg@23: franta-hg@23: franta-hg@23: JAR="dist/dictionary-generator.jar" franta-hg@23: GENERATOR_DIR="java/dictionary-generator" franta-hg@23: WORK_DIR="free-telco-dictionary" franta-hg@23: franta-hg@23: function package() { franta-hg@23: DELIVERY_DIR="../../delivery" franta-hg@23: rm -rf $DELIVERY_DIR/$WORK_DIR franta-hg@23: java -jar $JAR $1 franta-hg@23: pushd $DELIVERY_DIR franta-hg@23: (echo -n "Mercurial: "; hg identify || echo "n/a"; echo -n "Generated: "; date --rfc-3339=seconds) > $WORK_DIR/version.txt franta-hg@23: tar czf $2.tar.gz $WORK_DIR franta-hg@23: popd franta-hg@23: } franta-hg@23: franta-hg@23: pushd `dirname $0`/$GENERATOR_DIR franta-hg@23: franta-hg@31: hg status ../../data/dictionary.xml | grep -q "^M" && echo -e "\033[31mWARNING: building from data file which was not commited into Mercurial!\033[0m" || (echo -e "\033[32mINFO: building from versioned data file: `hg identify` \033[0m"); franta-hg@29: franta-hg@23: # build the generator if needed franta-hg@23: if [ ! -f $JAR ]; then franta-hg@23: ant; franta-hg@23: fi franta-hg@23: franta-hg@23: # generate packages in multiple formats franta-hg@23: package m free-telco-dictionary.text # plain text franta-hg@23: package h free-telco-dictionary.xhtml # rich text franta-hg@23: franta-hg@23: popd franta-hg@23: