#!/bin/sh

DIR_BASE=$(cd $(dirname $0); pwd)
DIR_EXPORTER=$DIR_BASE/stub/module-exporter
DIR_ORGJS=$DIR_BASE/lib/org

$DIR_EXPORTER/export.rb $DIR_ORGJS/*.js $DIR_ORGJS/converter/*.js > ./org.js.tmp

rm -f ./org.js
touch ./org.js
echo "// Generated by export.rb at" `LC_TIME=c date -u` >> ./org.js
echo "/*" >> ./org.js
cat ./LICENSE | sed 's/^\([^ ]\)/  \1/' >> ./org.js
echo "*/" >> ./org.js
echo "" >> ./org.js
cat ./org.js.tmp >> ./org.js
rm ./org.js.tmp
