@@ -22,26 +22,29 @@ tasks.create("generateDocs") {
22
22
} ? : throw RuntimeException (" Function 'groupedApiMappings' not found." )
23
23
val outputFileName = openApiExt::class .members.firstOrNull {
24
24
it.name == " outputFileName"
25
- } ? : throw RuntimeException (" Founction 'outputFileName' not found." )
25
+ } ? : throw RuntimeException (" Function 'outputFileName' not found." )
26
26
var docList = (groupedApiMappings.call(openApiExt) as MapProperty <String , String >).get().map { it.value }
27
27
if (docList.isEmpty()) {
28
28
docList = listOf ((outputFileName.call(openApiExt) as Property <String >).get())
29
29
}
30
30
exec {
31
31
workingDir(" $buildDir " )
32
- commandLine(if (Os .isFamily(Os .FAMILY_WINDOWS )) " npm.cmd" else " npm" , " i" , " -g" , " redoc-cli" )
32
+ if (Os .isFamily(Os .FAMILY_WINDOWS )) {
33
+ commandLine(" npm.cmd" , " i" , " -g" , " redoc-cli" )
34
+ } else {
35
+ commandLine(" bash" , " -lc" , " npm i -g redoc-cli" )
36
+ }
33
37
}
34
38
docList.forEach { docnameTeljes ->
35
39
val docname = docnameTeljes.removeSuffix(" .json" )
36
40
println (" doc: $docname " )
37
41
exec {
38
42
workingDir(outputDirString)
39
- commandLine(
40
- if (Os .isFamily(Os .FAMILY_WINDOWS )) " npx.cmd" else " npx" ,
41
- " redoc-cli" ,
42
- " build" ,
43
- " $docname .json"
44
- )
43
+ if (Os .isFamily(Os .FAMILY_WINDOWS )) {
44
+ commandLine(" npx.cmd" , " redoc-cli" , " build" , " $docname .json" )
45
+ } else {
46
+ commandLine(" bash" , " -lc" , " npx redoc-cli build $docname .json" )
47
+ }
45
48
}
46
49
copy {
47
50
from(outputDirString)
0 commit comments