Skip to content

Commit 3540e29

Browse files
committed
[rb] make it easier to call rake tasks from commandline
1 parent 7bc2762 commit 3540e29

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,22 @@ unset GEM_PATH
66

77
JAVA_OPTS="-client -Xmx4096m -XX:ReservedCodeCacheSize=512m -XX:MetaspaceSize=1024m --add-modules java.se --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/javax.crypto=ALL-UNNAMED"
88

9-
java $JAVA_OPTS -jar third_party/jruby/jruby-complete.jar -X-C -S rake $*
9+
# The first argument is alwaysthe Rake task name
10+
task="$1"
11+
12+
# Shift the task off and get the remaining arguments
13+
shift
14+
15+
# Leave task alone if already passing in arguments the normal way
16+
if [[ "$task" != *[*]* ]]; then
17+
# Combine remaining arguments into a single string, clean up spaces after commas, and replace spaces with commas
18+
args=$(IFS=' '; echo "$*" | sed -e 's/,[ ]*/,/g' -e 's/ /,/g')
19+
20+
# If there are any arguments, format them as task[arg1,arg2,...]
21+
if [ -n "$args" ]; then
22+
task="$task[$args]"
23+
fi
24+
fi
25+
26+
java $JAVA_OPTS -jar third_party/jruby/jruby-complete.jar -X-C -S rake $task
1027

0 commit comments

Comments
 (0)