2013-01-11 22:18:32 +01:00
|
|
|
@echo off
|
2025-03-16 11:22:35 -07:00
|
|
|
SETLOCAL EnableDelayedExpansion
|
2019-10-10 20:21:39 +03:00
|
|
|
|
2025-03-16 10:44:53 -07:00
|
|
|
REM we want jruby-complete to take care of all things ruby
|
|
|
|
|
SET GEM_HOME=
|
|
|
|
|
SET GEM_PATH=
|
2019-10-10 20:21:39 +03:00
|
|
|
|
2025-03-18 13:55:35 -07:00
|
|
|
# This code supports both:
|
|
|
|
|
# ./go "namespace:task[--arg1,--arg2]" --rake-flag
|
|
|
|
|
# ./go namespace:task --arg1 --arg2 -- --rake-flag
|
|
|
|
|
|
2025-03-16 11:22:35 -07:00
|
|
|
REM The first argument is always the Rake task name
|
|
|
|
|
SET task=%1
|
2019-10-10 20:21:39 +03:00
|
|
|
|
2025-03-16 11:22:35 -07:00
|
|
|
REM Check for arguments
|
|
|
|
|
IF "%task%"=="" (
|
|
|
|
|
echo No task specified
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
|
|
|
|
|
2025-03-18 13:55:35 -07:00
|
|
|
REM Shift the task off
|
2025-03-16 11:22:35 -07:00
|
|
|
SHIFT
|
|
|
|
|
|
|
|
|
|
REM Leave task alone if already passing in arguments the normal way
|
|
|
|
|
ECHO %task% | FINDSTR /C:"[" >NUL
|
|
|
|
|
IF %ERRORLEVEL% EQU 0 (
|
2025-03-18 13:55:35 -07:00
|
|
|
GOTO execute_with_args
|
2025-03-16 11:22:35 -07:00
|
|
|
)
|
|
|
|
|
|
2025-03-18 13:55:35 -07:00
|
|
|
REM Initialize variables for task arguments and rake flags
|
|
|
|
|
SET task_args=
|
|
|
|
|
SET rake_flags=
|
|
|
|
|
SET separator_found=false
|
|
|
|
|
|
|
|
|
|
REM Process arguments until we find --
|
2025-03-16 11:22:35 -07:00
|
|
|
:process_args
|
|
|
|
|
IF "%1"=="" GOTO done_args
|
2025-03-18 13:55:35 -07:00
|
|
|
|
|
|
|
|
IF "%1"=="--" (
|
|
|
|
|
SET separator_found=true
|
|
|
|
|
SHIFT
|
|
|
|
|
GOTO collect_rake_flags
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
REM Add to task arguments
|
|
|
|
|
IF "!task_args!"=="" (
|
|
|
|
|
SET task_args=%1
|
2025-03-16 11:22:35 -07:00
|
|
|
) ELSE (
|
2025-03-18 13:55:35 -07:00
|
|
|
SET task_args=!task_args!,%1
|
2025-03-16 11:22:35 -07:00
|
|
|
)
|
|
|
|
|
SHIFT
|
|
|
|
|
GOTO process_args
|
|
|
|
|
|
2025-03-18 13:55:35 -07:00
|
|
|
REM Collect remaining arguments as rake flags
|
|
|
|
|
:collect_rake_flags
|
|
|
|
|
IF "%1"=="" GOTO done_args
|
|
|
|
|
IF "!rake_flags!"=="" (
|
|
|
|
|
SET rake_flags=%1
|
|
|
|
|
) ELSE (
|
|
|
|
|
SET rake_flags=!rake_flags! %1
|
|
|
|
|
)
|
|
|
|
|
SHIFT
|
|
|
|
|
GOTO collect_rake_flags
|
|
|
|
|
|
2025-03-16 11:22:35 -07:00
|
|
|
:done_args
|
2025-03-18 13:55:35 -07:00
|
|
|
REM If we have task args, format them as task[arg1,arg2,...]
|
|
|
|
|
IF NOT "!task_args!"=="" (
|
|
|
|
|
SET task=%task%[!task_args!]
|
2025-03-16 11:22:35 -07:00
|
|
|
ECHO Executing rake task: %task%
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
:execute
|
2025-03-18 13:55:35 -07:00
|
|
|
REM Execute rake with the task and flags
|
|
|
|
|
java %JAVA_OPTS% -jar third_party\jruby\jruby-complete.jar -X-C -S rake %task% %rake_flags%
|
|
|
|
|
GOTO :EOF
|
|
|
|
|
|
|
|
|
|
:execute_with_args
|
|
|
|
|
REM Task already has arguments in brackets, pass remaining args directly to rake
|
|
|
|
|
java %JAVA_OPTS% -jar third_party\jruby\jruby-complete.jar -X-C -S rake %task% %*
|