1
+ #! /bin/bash
2
+
3
+ # get the product docset that is going to be run
4
+
5
+ case $1 in
6
+ ( ' docset' ) echo " product: $1 " ;;
7
+ (* ) echo " pick docset" && exit ;;
8
+ esac
9
+
10
+ echo " checking prerequisites"
11
+
12
+ # check if nvm is running and up-to-date
13
+
14
+ . ~ /.nvm/nvm.sh
15
+ . ~ /.profile
16
+ . ~ /.bashrc
17
+
18
+ nvmversion=$( nvm --version)
19
+ echo " nvm version: ${nvmversion} "
20
+
21
+ if [ $nvmversion != 0.39.0 ]; then
22
+ # update homebrew list of packages and either update or install nvm
23
+ echo " Updating/installing nvm - please be patient, this takes time"
24
+ brew update
25
+ brew install nvm
26
+ fi
27
+
28
+ # check if node is running and the version
29
+
30
+ nodeversion=$( node -v)
31
+ echo " node version: ${nodeversion} "
32
+
33
+ if [ $nodeversion != ' v16.13.1' ]; then
34
+ # use nvm to install version 16 and change nvm to use it
35
+ nvm install 16
36
+ nvm use 16
37
+ fi
38
+
39
+ # check if npm is running and the version
40
+
41
+ npmversion=$( npm -v)
42
+ echo " npm version: ${npmversion} "
43
+
44
+ if [ $npmversion != ' 8.5.5' ]; then
45
+ npm install
46
+ fi
47
+
48
+ # check the antora version
49
+
50
+ antoraversion=$( npm info antora version)
51
+ echo " antora version: ${antoraversion} "
52
+
53
+ if [$antoraversion != 3.0.1 ]; then
54
+ npm install antora
55
+ fi
56
+
57
+ # remove the antora symlinks that exist
58
+ # and set the antora symlinks to the correct product docset
59
+ # finally, run the corresponding product docset playbook
60
+
61
+ case $1 in
62
+
63
+ docset)
64
+ echo " product is docset"
65
+ echo " make antora.yml links"
66
+ cd docs-src/docset-core
67
+ rm antora.yml; ln -s antora-docset.yml antora.yml
68
+ cd ../docset-develop
69
+ rm antora.yml; ln -s antora-docset.yml antora.yml
70
+ cd ../..
71
+ echo " run the build"
72
+ npm run build:local:docset
73
+ ;;
74
+
75
+ esac
76
+
77
+ echo
78
+ read -p " Do you want to start a local web server for viewing the generated docs? (Y or N)" server
79
+
80
+ if [ $server = " Y" ] || [ $server = " y" ];
81
+ then
82
+ npm i -g serve; serve
83
+ else
84
+ exit ;
85
+ fi
0 commit comments