Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: eec97738e3
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 66 lines (59 sloc) 2.375 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 58 59 60 61 62 63 64 65
:: 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 jmvc\script\controller Todo
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
if "%1"=="" (
java -cp steal\rhino\js.jar org.mozilla.javascript.tools.shell.Main
GOTO END
)
if "%1"=="-h" GOTO PRINT_HELP
if "%1"=="-?" GOTO PRINT_HELP
if "%1"=="--help" GOTO PRINT_HELP

if "%1"=="-d" (
java -classpath funcunit/java/selenium-java-client-driver.jar;steal/rhino/js.jar org.mozilla.javascript.tools.debugger.Main
GOTO END
)
SET CP=funcunit/java/selenium-java-client-driver.jar;steal\rhino\js.jar
SET ERRORLEV=0
if "%1"=="-e" (
SET ERRORLEV=1
SHIFT /1
)
SET ARGS=[
SET FILENAME=%1
SET FILENAME=%FILENAME:\=/%
::haven't seen any way to loop through all args yet, so for now this goes through arg 2-7
::dos sucks and for some reason this structure doesn't respect the shift, so we branch
if "%ERRORLEV%"=="1" (
for /f "tokens=3,4,5,6,7,8 delims= " %%a in ("%*") do SET ARGS=!ARGS!'%%a','%%b','%%c','%%d','%%e','%%f'
) ELSE (
for /f "tokens=2,3,4,5,6,7 delims= " %%a in ("%*") do SET ARGS=!ARGS!'%%a','%%b','%%c','%%d','%%e','%%f'
)
::remove the empty args
:: for %%a in (",''=") do ( call set ARGS=%%ARGS:%%~a%% )
SET ARGS=%ARGS:,''=%
::remove the spaces
:: for /f "tokens=1*" %%A in ("%ARGS%") do SET ARGS=%%A
SET ARGS=%ARGS: =%
SET ARGS=%ARGS%]
set ARGS=%ARGS:\=/%
java -Xmx512m -Xss1024k -cp %CP% org.mozilla.javascript.tools.shell.Main -opt -1 -e _args=%ARGS% -e load('%FILENAME%')

if "%ERRORLEV%"=="1" (
if errorlevel 1 exit 1
)

GOTO END

:PRINT_HELP
echo Load a command line Rhino JavaScript environment or run JavaScript script files in Rhino.
echo Available commands:
echo js Opens a command line JavaScript environment
echo js -d Opens the Rhino debugger
echo js -selenium Starts selenium server
echo js [FILE] Runs FILE in the Rhino environment

echo JavaScriptMVC script usage:
echo js steal/generate/app [NAME] Creates a new JavaScriptMVC application
echo js steal/generate/page [APP] [PAGE] Generates a page for the application
echo js steal/generate/controller [NAME] Generates a Controller file
echo js steal/generate/model [TYPE] [NAME] Generates a Model file
echo js apps/[NAME]/compress.js Compress your application and generate documentation

:END
Something went wrong with that request. Please try again.