Skip to content

Commit b0a1317

Browse files
committed
first commit
0 parents  commit b0a1317

File tree

13 files changed

+1255
-0
lines changed

13 files changed

+1255
-0
lines changed

.github/workflows/gh-pages.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Set a branch name to trigger deployment
7+
pull_request:
8+
workflow_dispatch: {}
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-20.04
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
env:
16+
DTC_HEADLES: true
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: setup
20+
run: chmod +x dtcw
21+
- name: generateSite
22+
run: ./dtcw generateSite
23+
- name: copyToPublic
24+
run: cp -r ./build/microsite/output ./public
25+
- name: Deploy
26+
uses: peaceiris/actions-gh-pages@v3
27+
# if: ${{ github.ref == 'refs/heads/main' }}
28+
with:
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
publish_dir: ./public

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.idea/
2+
/.gradle/
3+
/build/

docToolchainConfig.groovy

Lines changed: 370 additions & 0 deletions
Large diffs are not rendered by default.

dtcw

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
#!/usr/bin/env bash
2+
3+
#here you can specify the URL of a theme to use with generateSite-task
4+
#export DTC_SITETHEME=https://....zip
5+
6+
#here you can specify the location of additional templates
7+
#export DTC_TEMPLATE1=https://....zip
8+
#export DTC_TEMPLATE2=https://....zip
9+
#...
10+
11+
MAIN_CONFIG_FILE=docToolchainConfig.groovy
12+
VERSION=2.0.5
13+
DISTRIBUTION_URL=https://github.com/docToolchain/docToolchain/releases/download/v${VERSION}/docToolchain-${VERSION}.zip
14+
export DTC_PROJECT_BRANCH=$(git branch --show-current)
15+
16+
DTC_OPTS="$DTC_OPTS -PmainConfigFile=$MAIN_CONFIG_FILE --warning-mode=none --no-daemon"
17+
18+
echo "dtcw - docToolchain wrapper V0.29"
19+
echo "docToolchain V${VERSION}"
20+
21+
# check if CLI, docker or sdkman are installed
22+
cli=false
23+
docker=false
24+
sdkman=false
25+
homefolder=false
26+
java=false
27+
wsl=false
28+
doJavaCheck=true
29+
30+
if [[ $(grep -i 'microsoft' /proc/version) ]]; then
31+
echo " "
32+
echo "Bash is running on WSL"
33+
echo "this might cause problems with plantUML"
34+
echo "see https://doctoolchain.github.io/docToolchain/#wsl for more details"
35+
echo " "
36+
wsl=true
37+
fi
38+
39+
java_help_and_die() {
40+
echo "it might be that you have installed the needed version java in another shell from which you started dtcw"
41+
echo "dtcw is running in bash and uses the PATH to find java"
42+
echo ""
43+
echo "one way to install or update java is to install"
44+
echo "sdkman and then java via sdkman"
45+
echo "https://sdkman.io/install"
46+
echo "$ curl -s "https://get.sdkman.io" | bash"
47+
echo "$ sdk install java"
48+
echo ""
49+
echo "or you can download it from https://adoptium.net/"
50+
echo ""
51+
echo "make sure that your java version is between 8 and 14"
52+
echo ""
53+
echo "If you do not want to use a local java installtion, you can also use docToolchain as docker container."
54+
echo "In that case, specify 'docker' as first parameter in your statement."
55+
echo "example: ./dtcw docker generateSite"
56+
exit 1
57+
58+
}
59+
check_java() {
60+
if command -v java &> /dev/null; then
61+
java=true
62+
if java -version 2>&1 >/dev/null | grep -q "Unable to locate a Java Runtime" ; then
63+
##we are on a mac and the java command is only a shim
64+
java=false
65+
fi
66+
fi
67+
if [ "$java" = false ] ; then
68+
echo "docToolchain depends on java, but the java command couldn't be found in this shell (bash)"
69+
java_help_and_die
70+
fi
71+
javaversion=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
72+
echo "Java Version $javaversion"
73+
if (( $javaversion < 8 )); then
74+
echo "your java version $javaversion is too old (<8): $(which java)"
75+
echo "please update your java installation and try again"
76+
java_help_and_die
77+
else
78+
if (( $javaversion > 14 )); then
79+
echo "your java version $javaversion is too new (>14): $(which java)"
80+
echo "please update your java installation and try again"
81+
java_help_and_die
82+
fi
83+
fi
84+
85+
}
86+
install_local() {
87+
#check that pre-requisites are met
88+
if ! (command -v wget &> /dev/null); then
89+
if ! (command -v curl &> /dev/null); then
90+
echo "you need either wget or curl installed"
91+
echo "please install it and re-run the command"
92+
exit 1
93+
fi
94+
fi
95+
if ! (command -v unzip &> /dev/null); then
96+
echo "you need unzip installed"
97+
echo "please install it and re-run the command"
98+
exit 1
99+
fi
100+
mkdir $HOME/.doctoolchain
101+
wgetversion=$(wget --version | head -1 | sed -E 's/^.* 1.([0-9]+).*$/\1/')
102+
if command -v curl &> /dev/null; then
103+
curl -Lo $HOME/.doctoolchain/source.zip $DISTRIBUTION_URL
104+
else
105+
if (( $wgetversion > 13 )); then
106+
wget $DISTRIBUTION_URL -O $HOME/.doctoolchain/source.zip
107+
else
108+
echo "you need curl or wget (version >= 1.14) installed"
109+
echo "please install or update and re-run the command"
110+
exit 1
111+
fi
112+
fi
113+
unzip $HOME/.doctoolchain/source.zip -d $HOME/.doctoolchain/.
114+
command="$HOME/.doctoolchain/docToolchain-${VERSION}/bin/doctoolchain . $1 $2 $3 $4 $5 $6 $7 $8 $9 $DTC_OPTS"
115+
116+
}
117+
118+
if command -v doctoolchain &> /dev/null; then
119+
echo "docToolchain as CLI available"
120+
cli=true
121+
fi
122+
if command -v docker &> /dev/null; then
123+
echo "docker available"
124+
docker=true
125+
fi
126+
if command -v sdk &> /dev/null; then
127+
echo "sdkman available"
128+
sdkman=true
129+
fi
130+
if [ -d "$HOME/.doctoolchain/docToolchain-${VERSION}/." ]; then
131+
echo "home folder exists"
132+
homefolder=true
133+
fi
134+
if [ "$1" = "local" ] ; then
135+
echo "force use of local install"
136+
docker=false
137+
cli=false
138+
shift
139+
fi
140+
if [ "$1" = "docker" ] ; then
141+
cli=false
142+
homefolder=false
143+
echo "force use of docker"
144+
shift
145+
fi
146+
if [ "$1" = "sdk" ] ; then
147+
cli=false
148+
homefolder=false
149+
docker=false
150+
sdkman=true
151+
echo "force use of sdkman"
152+
shift
153+
fi
154+
#if bakePreview is called, deactivate deamon
155+
if [ "$1" = "bakePreview" ] ; then
156+
DTC_OPTS="$DTC_OPTS -Dorg.gradle.daemon=false"
157+
fi
158+
159+
if [[ $# -lt 1 ]]; then
160+
echo '
161+
Usage: ./dtcw [option...] [task...]
162+
163+
You can use the same options and tasks as in underlying gradle.
164+
Use "./dtcw tasks --group doctoolchain" to see available tasks.
165+
Use "local", "sdk" or "docker" as first argument to force the use of a local, sdkman or docker install.
166+
167+
Examples:
168+
169+
Download and install arc42 Template:
170+
./dtcw downloadTemplate
171+
172+
Generate PDF:
173+
./dtcw generatePDF
174+
175+
Generate HTML:
176+
./dtcw generateHTML
177+
178+
Publish HTML to Confluence:
179+
./dtcw publishToConfluence
180+
181+
get more documentation at https://doctoolchain.github.io
182+
'
183+
exit 1
184+
fi
185+
186+
if [ "$cli" = true ] ; then
187+
command="$(which doctoolchain) . $1 $2 $3 $4 $5 $6 $7 $8 $9 $DTC_OPTS"
188+
echo "use cli install $(which doctoolchain)"
189+
else
190+
if [ "$homefolder" = true ] ; then
191+
command="$HOME/.doctoolchain/docToolchain-${VERSION}/bin/doctoolchain . $1 $2 $3 $4 $5 $6 $7 $8 $9 $DTC_OPTS"
192+
echo "use local homefolder install $HOME/.doctoolchain/"
193+
else
194+
if [ "$docker" = true ] ; then
195+
if ! docker info >/dev/null 2>&1; then
196+
echo "Docker does not seem to be running, run it first and retry"
197+
echo "if you want to use a local installation of doctoolchain instead"
198+
echo "use 'local' as first argument to force the installation and use of a local install."
199+
200+
exit 1
201+
fi
202+
docker_cmd=$(which docker)
203+
echo $docker_cmd
204+
if command -v cygpath &>/dev/null; then
205+
pwd=$(cygpath -w $PWD)
206+
else
207+
pwd=$PWD
208+
fi
209+
command="$docker_cmd run -u $(id -u):$(id -g) --name doctoolchain${version} -e DTC_HEADLESS=1 -e DTC_SITETHEME -p 8042:8042 --rm -i --entrypoint //bin/bash -v '${pwd}:/project' rdmueller/doctoolchain:v${VERSION} -c \"doctoolchain . $1 $2 $3 $4 $5 $6 $7 $8 $9 $DTC_OPTS && exit\""
210+
doJavaCheck=false
211+
echo "use docker installation"
212+
else
213+
214+
echo "docToolchain not installed."
215+
if [ "$sdkman" = true ] ; then
216+
echo "please use sdkman to install docToolchain"
217+
echo "$ sdk install doctoolchain ${VERSION}-beta"
218+
exit
219+
else
220+
echo "sdkman not found"
221+
if [ "$DTC_HEADLESS" == true ] ; then
222+
# just download
223+
install_local
224+
else
225+
echo "Do you wish to install doctoolchain to $HOME/.doctoolchain?"
226+
select yn in "Yes" "No"; do
227+
case $yn in
228+
Yes ) echo "installing doctoolchain";
229+
install_local
230+
break
231+
;;
232+
No )
233+
echo "you need docToolchain as CLI-Tool installed or docker."
234+
echo "to install docToolchain as CLI-Tool, please install"
235+
echo "sdkman and re-run this command."
236+
echo "https://sdkman.io/install"
237+
echo "$ curl -s "https://get.sdkman.io" | bash"
238+
exit 1
239+
;;
240+
esac
241+
done
242+
fi
243+
fi
244+
fi
245+
fi
246+
fi
247+
if [ "$doJavaCheck" = true ] ; then
248+
check_java
249+
fi
250+
exec bash -c "$command"

0 commit comments

Comments
 (0)