Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 57 lines (51 sloc) 1.791 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#!/bin/sh
# This script checks for arguments, if they don't exist it opens the Rhino dialog
# if arguments do exist, it loads the script in the first argument and passes the other arguments to the script
# ie: ./js steal/script/controller Todo

if [ $# -eq 0 ]
then
  java -cp steal/rhino/js.jar:funcunit/java/selenium-java-client-driver.jar org.mozilla.javascript.tools.shell.Main
  exit 127
fi
CP=funcunit/java/selenium-java-client-driver.jar:steal/rhino/js.jar

ERRORLEV=0
if [ $1 = "-e" ]
then
ERRORLEV=1
shift
fi

if [ $1 = "-h" -o $1 = "-?" -o $1 = "--help" ]
then
echo Load a command line Rhino JavaScript environment or run JavaScript script files in Rhino.
echo Available commands:
echo -e "./js\t\t\t\tOpens a command line JavaScript environment"
echo -e "./js -d\t\t\t\tOpens the Rhino debugger"
echo -e "./js [FILE]\t\t\tRuns FILE in the Rhino environment"
echo -e ""
echo -e "JavaScriptMVC script usage:"
echo -e "./js steal/generate/app [NAME]\t\tCreates a new JavaScriptMVC application"
echo -e "./js steal/generate/page [APP] [PAGE]\tGenerates a page for the application"
echo -e "./js steal/generate/controller [NAME]\tGenerates a Controller file"
echo -e "./js steal/generate/model [TYPE] [NAME]\tGenerates a Model file"
echo -e "./js apps/[NAME]/compress.js\t\tCompress your application and generate documentation"
  exit 127
fi

if [ $1 = "-d" ]
then
        java -classpath steal/rhino/js.jar:steal/rhino/selenium-java-client-driver.jar org.mozilla.javascript.tools.debugger.Main
        exit 127
fi

ARGS=[
for arg
do
  if [ $arg != $1 ]
  then
    ARGS=$ARGS"'$arg'",
  fi
done
ARGS=$ARGS]
java -Xmx512m -Xss1024k -cp $CP org.mozilla.javascript.tools.shell.Main -e _args=$ARGS -opt -1 -e 'load('"'"$1"'"')'

if [ $ERRORLEV = "1" -a $? = "1" ]
then
exit $?
fi
Something went wrong with that request. Please try again.