Browse Source

different order of projects on the index site

master
Nils 4 years ago
parent
commit
2c28759bcb
  1. 44
      generate.bash

44
generate.bash

@ -15,7 +15,7 @@ cd temp
#We loop over all projects several times, each stage of the generation. #We loop over all projects several times, each stage of the generation.
#Instead of doing one project fully at a time, creating one giant nested loop. #Instead of doing one project fully at a time, creating one giant nested loop.
#Administration first, the processing! #Administration first, the processing!
PROJECTS=(laborejo patroneo vico fluajho agordejo) #The order here is the order on the page. Each of these gets its own entry. PROJECTS=(laborejo patroneo agordejo fluajho vico) #The order here is the order on the page. Each of these gets its own entry.
PROJECTS_AS_STRING=$( IFS=$' '; echo "${PROJECTS[*]}" ) PROJECTS_AS_STRING=$( IFS=$' '; echo "${PROJECTS[*]}" )
@ -25,48 +25,48 @@ do
GIT="https://git.laborejo.org/lss/$PROJECT.git" GIT="https://git.laborejo.org/lss/$PROJECT.git"
echo "$GIT" echo "$GIT"
if [ -d "$PROJECT" ]; then if [ -d "$PROJECT" ]; then
cd "$PROJECT" cd "$PROJECT"
git pull git pull
cd .. cd ..
else else
git clone "$GIT" git clone "$GIT"
fi fi
done done
cd "$ROOTPATH" #reset for next step cd "$ROOTPATH" #reset for next step
#Documentation, just a copy #Documentation, just a copy
for PROJECT in ${PROJECTS[*]} for PROJECT in ${PROJECTS[*]}
do do
cp -r "temp/$PROJECT/documentation/out" "out/documentation/$PROJECT" cp -r "temp/$PROJECT/documentation/out" "out/documentation/$PROJECT"
cp "static/images/$PROJECT.png" "out/documentation/$PROJECT/logo.png" cp "static/images/$PROJECT.png" "out/documentation/$PROJECT/logo.png"
done done
#Generate Menu. n^2 loop. For each project all projects #Generate Menu. n^2 loop. For each project all projects
for PROJECT in ${PROJECTS[*]} for PROJECT in ${PROJECTS[*]}
do do
echo "" > "temp/$PROJECT/module_menu" #empty file echo "" > "temp/$PROJECT/module_menu" #empty file
#Index/Home is the same for all sub-pages. index is not included in the list so we do not care about the "this is the current page" highlight here. #Index/Home is the same for all sub-pages. index is not included in the list so we do not care about the "this is the current page" highlight here.
echo "<li class='pure-menu-item'><a class='pure-menu-link' href='/'>Home</a></li>" >> "temp/$PROJECT/module_menu" #automatic newline echo "<li class='pure-menu-item'><a class='pure-menu-link' href='/'>Home</a></li>" >> "temp/$PROJECT/module_menu" #automatic newline
for EACH in ${PROJECTS[*]} for EACH in ${PROJECTS[*]}
do do
TITLE=$(echo "$EACH" | sed 's/[^ ]\+/\L\u&/g') TITLE=$(echo "$EACH" | sed 's/[^ ]\+/\L\u&/g')
if [ "$PROJECT" = "$EACH" ]; then if [ "$PROJECT" = "$EACH" ]; then
#Special line for ourselves #Special line for ourselves
echo "<li class='pure-menu-item menu-item-divided pure-menu-selected'><a class='pure-menu-link' href='/$PROJECT/'>$TITLE</a></li>" >> "temp/$PROJECT/module_menu" #automatic newline echo "<li class='pure-menu-item menu-item-divided pure-menu-selected'><a class='pure-menu-link' href='/$PROJECT/'>$TITLE</a></li>" >> "temp/$PROJECT/module_menu" #automatic newline
else else
echo "<li class='pure-menu-item'><a class='pure-menu-link' href='/$EACH/'>$TITLE</a></li>" >> "temp/$PROJECT/module_menu" #automatic newline echo "<li class='pure-menu-item'><a class='pure-menu-link' href='/$EACH/'>$TITLE</a></li>" >> "temp/$PROJECT/module_menu" #automatic newline
fi fi
done done
done done
for PROJECT in ${PROJECTS[*]} for PROJECT in ${PROJECTS[*]}
do do
echo "" > "temp/$PROJECT/module_page" #empty file echo "" > "temp/$PROJECT/module_page" #empty file
done done
cd "$ROOTPATH" #reset for next step cd "$ROOTPATH" #reset for next step
@ -83,7 +83,7 @@ done
#A bit of redundancy first. Generate a menu. #A bit of redundancy first. Generate a menu.
echo "" > "temp/index_menu" #empty file echo "" > "temp/index_menu" #empty file
echo "<li class='pure-menu-item menu-item-divided pure-menu-selected'><a class='pure-menu-link' href='/'>Home</a></li>" >> "temp/index_menu" #automatic newline echo "<li class='pure-menu-item menu-item-divided pure-menu-selected'><a class='pure-menu-link' href='/'>Home</a></li>" >> "temp/index_menu" #automatic newline
for EACH in ${PROJECTS[*]} for EACH in ${PROJECTS[*]}
do do
TITLE=$(echo "$EACH" | sed 's/[^ ]\+/\L\u&/g') TITLE=$(echo "$EACH" | sed 's/[^ ]\+/\L\u&/g')
echo "<li class='pure-menu-item'><a class='pure-menu-link' href='/$EACH/'>$TITLE</a></li>" >> "temp/index_menu" #automatic newline echo "<li class='pure-menu-item'><a class='pure-menu-link' href='/$EACH/'>$TITLE</a></li>" >> "temp/index_menu" #automatic newline
@ -95,8 +95,8 @@ cat "modules/10head" "temp/index_menu" "modules/20aftermenu" "temp/index" "modul
#Check if we have an HTML dir, then deploy #Check if we have an HTML dir, then deploy
cd "$ROOTPATH" #reset for next step cd "$ROOTPATH" #reset for next step
if [ -d "../html" ]; then if [ -d "../html" ]; then
echo "It looks like we are on a host. Deploying website" echo "It looks like we are on a host. Deploying website"
cp -r out/. ../html #copy all, including hidden. This will not replace the html symlink . Do NOT use cp -a, this will screw up file permissions cp -r out/. ../html #copy all, including hidden. This will not replace the html symlink . Do NOT use cp -a, this will screw up file permissions
fi fi

Loading…
Cancel
Save