diff --git a/README.md b/README.md index 842a688..2a1b1b3 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,28 @@ Third, stop the container ```sh docker stop ovh-docs-dev-env ``` + +## Without Docker + +### Prerequesite + +- Python 3 installed + +### First launch + +After cloning this project, you need to initialize your environment +``` +./generate-doc.sh init /path/to/ovh-docs +``` + +The generator checks out the docs-rendering Git project on `src/docs` directory, creates output folder and link to pages directory on your ovh-docs project. +It launches the `pip install` command to install requirements like `Pelican`. +And then, it calls the `entrypoint.sh` script. + +### Next launch + +``` +./generate-doc.sh launch +``` + +The generator checks `src/docs` exists and calls the `entrypoint.sh` script. diff --git a/generate-doc.sh b/generate-doc.sh new file mode 100755 index 0000000..40c1123 --- /dev/null +++ b/generate-doc.sh @@ -0,0 +1,49 @@ +#!/bin/bash +if [ -z "$1" ] + then + echo "Usage : ./generate-doc.sh launch|init [path/to/ovh-docs]" + echo "Caution : you need Python in version 3" + exit 1 +fi + +export SRC=./src +export WORKDIR=./src/docs + +if [ $1 = "launch" ]; then + # Check if workdir exist first + CMDLS=$(ls $WORKDIR; echo $?) + + # Launch server command + if [ $CMDLS -eq "1" ]; then + echo "Use init command first" + else + cd $WORKDIR + echo "Launch entrypoint" + ../entrypoint.sh + fi +else + if [ -z "$2" ]; then + echo "Need path to ovh-docs" + exit 1 + fi + echo "Clone docs rendering repo" + git clone https://github.com/ovh/docs-rendering.git $WORKDIR + echo "Repo cloned" + + cd $WORKDIR + + export DOCS=$2 + echo "Create pages and output folders" + mkdir output + ln -s $DOCS/pages pages + + + echo "Install requirements" + pip install -r requirements.txt + + echo "Change mode to execute" + chmod +x ../entrypoint.sh + + echo "Launch entrypoint" + ../entrypoint.sh +fi \ No newline at end of file