Browse Source

tamplate

master
zeus 3 years ago
parent
commit
3b36ca2411
  1. 6
      template/antora.yml
  2. 5
      template/build.sh
  3. 1
      template/config.ini
  4. 196
      template/init-docs.sh
  5. BIN
      template/modules/ROOT/images/adhoc.png
  6. BIN
      template/modules/ROOT/images/swarmlab.png
  7. 1
      template/modules/ROOT/nav.adoc
  8. 11
      template/modules/ROOT/pages/index.adoc
  9. 4
      template/run/build-intro.sh
  10. 4
      template/run/build.sh
  11. 20
      template/site.yml

6
template/antora.yml

@ -0,0 +1,6 @@
name: swarmlab_cloud
title: swarmlab_cloud
version: docs
nav:
- modules/ROOT/nav.adoc

5
template/build.sh

@ -0,0 +1,5 @@
docker stop swarmlab-documentation
docker container rm swarmlab-documentation
docker pull hub.swarmlab.io:5480/antora
docker run -ti --name swarmlab-documentation -p 8080:8080 -v $PWD/:/antora -v $PWD/supplemental-ui:/antora/supplemental-ui hub.swarmlab.io:5480/antora /bin/sh -c "DOCSEARCH_ENABLED=true DOCSEARCH_ENGINE=lunr DOCSEARCH_INDEX_VERSION=latest NODE_PATH=/usr/local/lib/node_modules:\$NODE_PATH exec sh -c '/antora/run/build.sh'"

1
template/config.ini

@ -0,0 +1 @@
SERVICE_URL=https://git.swarmlab.io:3000/docs/Documentation.git

196
template/init-docs.sh

@ -0,0 +1,196 @@
#!/bin/bash
#SERVICE_URL=https://git.swarmlab.io:3000/docs/Documentation.git
#SERVICE_NAME=cloud
#SERVICE_NAME_MENOU=cloud
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
TARGET="$(readlink "$SOURCE")"
if [[ $TARGET == /* ]]; then
SOURCE="$TARGET"
else
DIR="$( dirname "$SOURCE" )"
SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
fi
done
SRPATH="$( dirname "$SOURCE" )"
SFPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
if [ "$SFPATH" != "$SRPATH" ]; then
RDIR=$SRPATH # relativ path directory
fi
cwdir=$PWD
wdir=$SFPATH
#echo $cwdir
#echo $wdir
txturl='\033[1;36m'
txturl1='\033[0;36m'
txtg='\033[0;32m'
NOCOLOR='\033[0m'
usage ()
{
echo ""
echo " No argument supplied"
echo ""
echo "--------------"
echo " create Swarmlab.io Doc "
echo "--------------"
echo ""
echo " USAGE: ./init-docs.sh [OPTIONS]"
echo ""
echo " Examples of [OPTIONS] can be:"
echo ""
echo -e " ${txtg}[docname]:${NOCOLOR} You can use upper and lowercase letters, numbers, “.” (dot), and “_” (underscore) symbols. "
echo ""
echo ""
echo " "
}
if [[ $# -eq 0 ]] ; then
usage
exit 1
fi
if [[ -z "$1" ]] ; then
usage
exit 1
else
pdir="$(dirname "$wdir")"
dname="$pdir/$1"
#echo $pdir
#echo $dname
if [[ -d "$dname" ]] ; then
echo ""
echo "--------------"
echo -e "Directory ${txtg} ${dname} ${NOCOLOR} ${txturl} exists ${NOCOLOR}"
echo "--------------"
echo ""
exit 1
fi
. $wdir/config.ini
SERVICE_NAME=$1
SERVICE_NAME_MENOU=$1
echo ""
echo "Default parameters are:"
echo -e "SERVICE_URL=${txtg}${SERVICE_URL}${NOCOLOR}"
echo -e "SERVICE_NAME=${txtg}${SERVICE_NAME}${NOCOLOR}"
echo -e "SERVICE_NAME_MENOU=${txtg}${SERVICE_NAME_MENOU}${NOCOLOR}"
echo -e "You can change this setting in: ${txturl} config.ini ${NOCOLOR}"
echo ""
echo "Do you wish to create this in $dname?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) exit;;
esac
done
if [[ $yn == 'Yes' ]];then
mkdir -p $dname
if [[ ! -d "$dname" ]] ; then
echo ""
echo "--------------"
echo -e "mkdir: cannot create directory ${txtg} ${dname} ${NOCOLOR}"
echo "--------------"
echo ""
exit 1
fi
cd $wdir
cp -rf modules ${dname}
cp -rf supplemental-ui ${dname}
cp -rf run ${dname}
cp -f build.sh ${dname}
cp -f antora.yml ${dname}
cp -f site.yml ${dname}
cp -f push.sh ${dname}
if [[ ! -d "${dname}/modules" || ! -d "${dname}/supplemental-ui" || ! -d "${dname}/run" || ! -f "${dname}/antora.yml" || ! -f "${dname}/site.yml" || ! -f "${dname}/build.sh" || ! -f "${dname}/push.sh" ]] ; then
echo ""
echo "--------------"
echo -e "cannot create template in directory ${txtg} ${dname} ${NOCOLOR}"
echo "--------------"
echo ""
exit 1
fi
exit 1
cat << EOF > $dname/antora.yml
name: swarmlab_${SERVICE_NAME}
title: swarmlab_${SERVICE_NAME}
version: docs
nav:
- modules/ROOT/nav.adoc
EOF
cat << EOF > $dname/site.yml
site:
title: Swarmlab ${SERVICE_NAME}
url: http://docs.swarmlab.io/SwarmLab-HowTos/swarmlab/docs
start_page: swarmlab_${SERVICE_NAME}::index.adoc
content:
sources:
- url: ${SERVICE_URL}
branches: master
start_path: docs
ui:
bundle:
url: https://git.swarmlab.io:3000/docs/docs/raw/branch/master/ui-bundle.zip
snapshot: true
supplemental_files: ./supplemental-ui
asciidoc:
attributes:
:plantuml-server-url: http://www.plantuml.com/plantuml
extensions:
- '@djencks/asciidoctor-mathjax'
- asciidoctor-plantuml
EOF
cat << EOF > $dname/modules/ROOT/nav.adoc
* xref:index.adoc[${SERVICE_NAME_MENOU}]
EOF
cat << EOF > $dname/modules/ROOT/pages/index.adoc
= ${SERVICE_NAME_MENOU}
image::ROOT:swarmlab.png[swarmlab,150,float=right]
This tutorial demonstrates: *a.* howto create a Swarmlab.io doc wit asciidoc
== Intro
*intro* here
EOF
fi
cd $cwdir
fi

BIN
template/modules/ROOT/images/adhoc.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

BIN
template/modules/ROOT/images/swarmlab.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

1
template/modules/ROOT/nav.adoc

@ -0,0 +1 @@
* xref:index.adoc[cloud]

11
template/modules/ROOT/pages/index.adoc

@ -0,0 +1,11 @@
= cloud
image::ROOT:swarmlab.png[swarmlab,150,float=right]
This tutorial demonstrates: *a.* howto create a Swarmlab.io doc wit asciidoc
== Intro
*intro* here

4
template/run/build-intro.sh

@ -0,0 +1,4 @@
antora --fetch /antora/site-intro.yml
antora /antora/site-intro.yml
ifconfig
http-server build/site -c-1

4
template/run/build.sh

@ -0,0 +1,4 @@
antora --fetch /antora/site.yml
antora /antora/site.yml
ifconfig
http-server build/site -c-1

20
template/site.yml

@ -0,0 +1,20 @@
site:
title: Swarmlab cloud
url: http://docs.swarmlab.io/SwarmLab-HowTos/swarmlab/docs
start_page: swarmlab_cloud::index.adoc
content:
sources:
- url: https://git.swarmlab.io:3000/docs/Documentation.git
branches: master
start_path: docs
ui:
bundle:
url: https://git.swarmlab.io:3000/docs/docs/raw/branch/master/ui-bundle.zip
snapshot: true
supplemental_files: ./supplemental-ui
asciidoc:
attributes:
:plantuml-server-url: http://www.plantuml.com/plantuml
extensions:
- '@djencks/asciidoctor-mathjax'
- asciidoctor-plantuml
Loading…
Cancel
Save