-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvjs
More file actions
executable file
·39 lines (35 loc) · 1.09 KB
/
Copy pathenvjs
File metadata and controls
executable file
·39 lines (35 loc) · 1.09 KB
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
#!/bin/sh
# Usage: envjs <platorm> file.js [file2.js ...]
###########################################################################
ENVJS_PLATFORM='node'
# first arguments ($1)
# may be a platform or is a file and the default platorm is used
if [ -n "$1" ]; then
if [ -n "$1" ]; then ENVJS_PLATFORM="$1"; shift; fi
fi
# Run envjs with the given platform
###########################################################################
case "$ENVJS_PLATFORM" in
"node")
node envjs/node.js $@
;;
"rhino")
java -Xmx512M -jar rhino/js.jar -opt -1 envjs/rhino.js $@
;;
"rhino-debug")
java -cp rhino/js.jar org.mozilla.javascript.tools.debugger.Main envjs/rhino.js $@
;;
"spyd")
python envjs/spydermonkey.py envjs/spydermonkey.js $@
;;
"rubyracer")
ruby -rrubygems envjs/rubyracer.rb envjs/rubyracer.js $@
;;
"johnson")
ruby -rrubygems envjs/johnson.rb envjs/johnson.js $@
;;
*)
# platform default means $1 was actually a file
node envjs/node.js $ENVJS_PLATFORM $@
;;
esac