File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
33# # note: always use a patch release even if it's 0
4- KSCRIPT_VERSION=1.5.1
4+ KSCRIPT_VERSION=1.5.2
55
66# # make sure that all requirements (java, kotlinc, maven) to run kscript are met
77assertInPath (){ if [ -z " $( which $1 ) " ]; then echo " [ERROR] Could not locate '$1 '" 1>&2 ; exit 1; fi }
122122
123123# # ... or use a cached version of it if possible
124124# scriptFile="./test.kts"
125+ # scriptFile="test-script.kts"
125126scriptFile=" $1 "
126127shift
127128
@@ -250,8 +251,8 @@ scriptCheckSum=$(kscript_md5 ${scriptFile})
250251jarFile=${KSCRIPT_CACHE_DIR} /$( basename ${scriptFile} .kts) .${scriptCheckSum} .jar
251252
252253
253- # # capitalize first letter (since this is what kotlin compiler is doing for the wrapper
254- className=$( basename ${scriptFile} .kts)
254+ # # capitalize first letter and get rid of dashes (since this is what kotlin compiler is doing for the wrapper to create a valid java class name)
255+ className=$( basename ${scriptFile} .kts | tr ' - ' ' _ ' )
255256# className="${className^}" ## disabled because requires bash4 and thus not on macos
256257className=$( echo ${className: 0: 1} | tr ' [a-z]' ' [A-Z]' ) ${className: 1}
257258
Original file line number Diff line number Diff line change 1+ println (" dash alarm!" )
Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ assert "source ${KSCRIPT_HOME}/test/resources/local_script_file.sh" "kscript roc
4242# # make sure that it runs with local script files
4343assert " kscript ${KSCRIPT_HOME} /test/resources/multi_line_deps.kts" " kscript is cool!"
4444
45+ # # scripts with dashes in the file name should work as well
46+ assert " kscript ${KSCRIPT_HOME} /test/resources/dash-test.kts" " dash alarm!"
47+
48+
4549# # missing script
4650assert_raises " kscript i_do_not_exist.kts" 1
4751assert " kscript i_do_not_exist.kts 2>&1" " [ERROR] Could not open script file 'i_do_not_exist.kts'"
You can’t perform that action at this time.
0 commit comments