-
Notifications
You must be signed in to change notification settings - Fork 3
/
generate_doc.sh
executable file
·52 lines (38 loc) · 1.41 KB
/
generate_doc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# Author Juhan Aasaru
print_endpoint() {
echo ".request"
echo "include::{snippets}/$1/http-request.adoc[]"
echo ""
echo ".response"
echo "include::{snippets}/$1/http-response.adoc[]"
echo ""
echo "'''"
echo ""
}
generate_adoc () {
outputFilename=$2
outputFolder="src/main/asciidoc/"
outputFullPath="$outputFolder$outputFilename.adoc"
> "$outputFullPath"
echo "= $outputFilename-cn documentation" >> "$outputFullPath"
echo "" >> "$outputFullPath"
for entry in "../fineract-cn-$2/component-test/build/doc/generated-snippets/$1"/*
do
folderName=${entry//\.\.\//}
print_endpoint $folderName >> "$outputFullPath"
done
echo "<li><a href="$outputFilename.html">$outputFilename</a></li>" >> $indexFile
}
indexFile="src/main/resources/doc/html5/index.html"
echo "<h1>Fineract API documentation</h1><ul>" > "$indexFile"
generate_adoc 'test-transaction-type' 'accounting'
generate_adoc 'test-identification-cards' 'customer'
generate_adoc 'test-deposit' 'deposit-account-management'
generate_adoc 'test-group' 'group'
generate_adoc 'test-identity' 'identity'
generate_adoc 'test-payroll' 'payroll'
generate_adoc 'test-teller' 'teller'
echo "</ul><a href='https://github.com/aasaru/fineract-cn-api-docs/'>Info how to generate updated documentation yourself</a>" >> "$indexFile"
./gradlew asciidoctor
echo "Completed generating files"