File tree Expand file tree Collapse file tree 4 files changed +19
-1
lines changed Expand file tree Collapse file tree 4 files changed +19
-1
lines changed Original file line number Diff line number Diff line change
1
+ ### 0.12.1 (2024-Feb-05)
2
+
3
+ * Fix https://github.com/kudulab/dojo/issues/37 - support the case when the current directory contains special characters
4
+
1
5
### 0.12.0 (2024-Feb-04)
2
6
3
7
* Compile Dojo using Golang 1.21.6 thanks to using Docker image kudulab/golang-dojo:2.1.0
Original file line number Diff line number Diff line change 8
8
"log"
9
9
"math/rand"
10
10
"os"
11
+ "regexp"
11
12
"runtime"
12
13
"strconv"
13
14
"strings"
@@ -113,6 +114,9 @@ func getRunIDGenerateFromCurrentDir(currentDirectory string) string {
113
114
// the currentDirectory contains capital letters and docker-compose project names do not welcome
114
115
// capital letters
115
116
runID = strings .ToLower (runID )
117
+ //runID = strings.ReplaceAll(runID, " ", "")
118
+ // remove any special characters
119
+ runID = regexp .MustCompile (`[^a-zA-Z0-9\-]+` ).ReplaceAllString (runID , "" )
116
120
return runID
117
121
}
118
122
Original file line number Diff line number Diff line change @@ -106,11 +106,21 @@ func Test_getRunID(t *testing.T) {
106
106
}
107
107
108
108
func Test_getRunIDGenerateFromCurrentDir (t * testing.T ) {
109
+ // lower case letters only
109
110
runID := getRunIDGenerateFromCurrentDir ("mydir" )
110
111
assert .True (t , strings .HasPrefix (runID , "dojo-mydir-" ))
111
112
113
+ // lower case and upper case letters
112
114
runID = getRunIDGenerateFromCurrentDir ("mYdIR" )
113
115
assert .True (t , strings .HasPrefix (runID , "dojo-mydir-" ))
116
+
117
+ // lower case and upper case letters and spaces
118
+ runID = getRunIDGenerateFromCurrentDir ("mYdIR with spaces" )
119
+ assert .True (t , strings .HasPrefix (runID , "dojo-mydirwithspaces-" ))
120
+
121
+ // lower case and upper case letters and spaces and special characters
122
+ runID = getRunIDGenerateFromCurrentDir ("mYdIR wi#th s(3paces" )
123
+ assert .True (t , strings .HasPrefix (runID , "dojo-mydirwiths3paces-" ))
114
124
}
115
125
116
126
func getTestConfig () Config {
Original file line number Diff line number Diff line change 1
1
package main
2
- const DojoVersion = "0.12.0 "
2
+ const DojoVersion = "0.12.1 "
3
3
You can’t perform that action at this time.
0 commit comments