rougail-tutorials_builder/build.sh
2024-08-06 10:05:23 +02:00

102 lines
2.9 KiB
Bash
Executable file

#!/bin/bash -e
set -x
DEST=../rougail-tutorials
if [ -d $DEST ]; then
echo "déjà fait"
exit 1
fi
export LC_ALL=C
BUILDER="$(pwd)"
mkdir -p $DEST/firefox
rm -f summary.md
touch summary.md
cd "$DEST"
DEST="$(pwd)"
cp "$BUILDER"/firefox.png .
cp "$BUILDER"/foxyproxy.png .
cp "$BUILDER"/summary.md .
touch README.md
"$BUILDER"/build.py
rm -rf summary.md
rm -rf jinja_caches
git init -b 1.1
git add .
git commit -am"$(cat $BUILDER/TITLE)"
cd - > /dev/null
for i in $(ls -d "examples"/* | sort); do
if [ -f "$i/README.md" ]; then
rm -rf "$DEST/config"
cp "summary.md" "$DEST"
echo $(basename "$i")
#
cd "$i/dictionaries"
if [ -d firefox ]; then
for j in $(ls firefox/*.yml 2>/dev/null); do
cp "$j" "$DEST/$j"
done
fi
if [ -d foxyproxy ]; then
mkdir -p $DEST/foxyproxy
for j in $(ls foxyproxy/*.yml 2>/dev/null); do
cp "$j" "$DEST/$j"
done
fi
cp -f ../README.md "$DEST"
if [ -d ../config ]; then
cp -aL ../config "$DEST"
fi
msg="[tutorial $(basename $i)] $(cat ../README.md)"
summary="[tutorial $(basename $i)] $(head -n 1 ../README.md)"
[ -e ../firefox.png ] && cp ../firefox.png "$DEST"
[ -e ../foxyproxy.png ] && cp ../foxyproxy.png "$DEST"
cd - > /dev/null
cd "$DEST"
echo "- $summary" >> summary.md
"$BUILDER"/build.py
rm -rf config/*/README.md config/*/read_write
rm -rf jinja_caches summary.md
git add .
git commit -am"$msg"
commit_id="$(git rev-parse HEAD)"
cd - > /dev/null
echo "- [$summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/$commit_id/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/commit/$commit_id))" >> summary.md
fi
done
cd "$DEST"
echo "# Description
This tutorial shows to you an example of Rougail use on how to set a proxy in the Mozilla Firefox browser.
More precisely, this tutorial aims at reproducing this [Mozilla Firefox](https://www.mozilla.org/firefox/new/) settings page:
![Firefox Proxy setting](firefox.png)
And the integration of part of the [Firefox FoxyProxy plugin](https://addons.mozilla.org/firefox/addon/foxyproxy-standard/).
The idea is to have a namespace specific to FoxyProxy and to find in it part of the settings that we will have made in the main namespace.
This is what the page looks like:
![Foxyproxy Proxy setting](foxyproxy.png)
" > README.md
echo "# Summary
Each step is a separerate commit. You can navigate to history to discover different aspect to the Rougail format.
" >> README.md
cat "$BUILDER"/summary.md >> README.md
echo >> README.md
git add .
rm -rf firefox foxyproxy
git commit -am"Summary"
#
git remote add origin ssh://git@forge.cloud.silique.fr:2222/stove/rougail-tutorials.git
git push --set-upstream origin 1.1 --force
echo "FAIT"
exit 0