forked from jeresig/env-js
-
Notifications
You must be signed in to change notification settings - Fork 75
/
test-prototype.sh
executable file
·54 lines (43 loc) · 1.59 KB
/
test-prototype.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
# Usage: test-prototype.sh [version]
# Currently supported versions: 1.6.0.3
#
# This script will check out the Prototype development tree from Github if necessary,
# massage the testing scripts as necessary, copy our latest version of env.js into place,
# and then run the test scripts.
if [ -n "$2" ]; then
echo 'debug'
if [ -n "$2" ]; then VERSION="$2"; else VERSION="1.6.0.3"; fi
DEBUG=1
else
echo 'jquery'
if [ -n "$1" ]; then VERSION="$1"; else VERSION="1.6.0.3"; fi
DEBUG=0
fi
PROTOTYPE_DIR="test/vendor/Prototype/$VERSION";
ant concat
if [ ! -d "$PROTOTYPE_DIR" ]; then
git clone git://github.com/sstephenson/prototype.git $PROTOTYPE_DIR
# - prepares tests - #
cd $PROTOTYPE_DIR
git submodule init #allow prototype to discover test framework dependencies
git submodule update #load the dicovered dependencies
cd -
fi
#replace thier test html template erb (malformed html on purpose..really???)
cat bin/prototype_1.6.0.3_tmpl.txt > $PROTOTYPE_DIR/test/unit/templates/default.erb
sed 's/runner\.run/ /g' $PROTOTYPE_DIR/Rakefile > $PROTOTYPE_DIR/Rakefile
cd $PROTOTYPE_DIR
rake test
cd -
cp dist/env.rhino.js $PROTOTYPE_DIR/test/unit/tmp/env.js
cp dist/env-js.jar $PROTOTYPE_DIR/test/unit/tmp/env-js.jar
cp bin/prototype-$VERSION-test.js $PROTOTYPE_DIR/test/unit/tmp/test.js
cd $PROTOTYPE_DIR/test/unit/tmp
if [ $DEBUG -eq 1 ]; then
echo 'running with rhino debugger'
java -cp env-js.jar org.mozilla.javascript.tools.envjs.Main test.js;
else
echo 'running with rhino'
java -cp env-js.jar org.mozilla.javascript.tools.envjs.Main test.js;
fi