Add VERSION and DATE to headers and support for it in build scripts.

This commit is contained in:
Jürg Lehni 2011-07-13 13:27:14 +01:00
parent a3bfc8fe40
commit 86b1d82636
5 changed files with 27 additions and 20 deletions

View file

@ -22,6 +22,9 @@
# compressed No comments and no whitespaces
# uglified Uses UglifyJS to further reduce file size
VERSION=0.2
DATE=$(git log -1 --pretty=format:%ad)
if [ $# -eq 0 ]
then
MODE="stripped"
@ -35,5 +38,5 @@ then
mkdir ../dist/
fi
./preprocess.sh ../src/paper.js ../dist/paper.js "-DBROWSER" $MODE
./preprocess.sh ../src/paper.js ../dist/paper-server.js "-DSERVER" $MODE
./preprocess.sh $MODE ../src/paper.js ../dist/paper.js "-DBROWSER -DVERSION=$VERSION -DDATE='$DATE'"
#./preprocess.sh $MODE ../src/paper.js ../dist/paper-server.js "-DSERVER"

View file

@ -21,36 +21,37 @@
# are preserved or stripped and whitespaces are compressed.
#
# Usage:
# preprocess.sh SOURCE DESTINATION ARGUMENTS MODE
# preprocess.sh MODE SOURCE DESTINATION ARGUMENTS
#
# ARGUMENTS:
# e.g. "-DBROWSER"
#
# MODE:
# commented Preprocessed but still formated and commented (default)
# commented Preprocessed but still formated and commented
# stripped Formated but without comments
# compressed No comments and no whitespaces
# uglified Uses UglifyJS to further reduce file size
KEYWORD="//#"
COMMAND="./filepp.pl -kc $KEYWORD $4 $2"
case $4 in
case $1 in
stripped)
./filepp.pl -kc $KEYWORD $3 $1 | ./jsstrip.pl -w -q | sed -n '/^[ ][ ]*$/d
eval $COMMAND | ./jsstrip.pl -w -q | sed -n '/^[ ][ ]*$/d
/./,/^$/!d
p' > $2
p' > $3
;;
compressed)
./filepp.pl -kc $KEYWORD $3 $1 | ./jsstrip.pl -q > $2
eval $COMMAND | ./jsstrip.pl -q > $3
;;
commented)
./filepp.pl -kc $KEYWORD $3 $1 | sed -n '/^[ ][ ]*$/d
eval $COMMAND | sed -n '/^[ ][ ]*$/d
/./,/^$/!d
p' > $2
p' > $3
;;
uglified)
./filepp.pl -kc $KEYWORD $3 $1 > temp.js
../../uglifyjs/bin/uglifyjs temp.js --extra --unsafe --reserved-names "$eval,$sign" > $2
eval $COMMAND > temp.js
../../uglifyjs/bin/uglifyjs temp.js --extra --unsafe --reserved-names "$eval,$sign" > $3
rm temp.js
;;
esac

View file

@ -28,7 +28,7 @@ var PaperScope = this.PaperScope = Base.extend(/** @scope _global_ */{
*
* @type Number
*/
version: 0.2,
version: VERSION,
initialize: function(id) {
/** @lends _global_# */

View file

@ -19,6 +19,9 @@
//
// NOTE: Any files added as includes to paper.js also need to be listed here
// Define VERSION, so PaperScope is not bailing out.
var VERSION = 'dev;'
var sources = [
'lib/bootstrap.js',
'lib/parse-js.js',

View file

@ -1,9 +1,8 @@
/***
/*!
* Paper.js vVERSION
*
* Paper.js
*
* A JavaScript Vector Graphics Library, based on Scriptographer.org and
* designed to be largely API compatible.
* This file is part of Paper.js, a JavaScript Vector Graphics Library,
* based on Scriptographer.org and designed to be largely API compatible.
* http://paperjs.org/
* http://scriptographer.org/
*
@ -14,6 +13,8 @@
*
* All rights reserved.
*
* Date: DATE
*
***
*
* Bootstrap.js JavaScript Framework.
@ -40,8 +41,7 @@
* http://lehni.org/
*
* Distributed under the BSD license.
*
***/
*/
/**
* The global PaperScope object