From a7c61b5376590f292dd5db7eaf8a7649972b1359 Mon Sep 17 00:00:00 2001
From: laurentheirendt <laurent.heirendt@uni.lu>
Date: Thu, 25 Apr 2019 13:53:10 +0200
Subject: [PATCH] loop in deploy

---
 .ci/deploy.sh | 94 +++++++++++++++++++++++++++++----------------------
 1 file changed, 53 insertions(+), 41 deletions(-)

diff --git a/.ci/deploy.sh b/.ci/deploy.sh
index dca55f37..10f6b7e4 100644
--- a/.ci/deploy.sh
+++ b/.ci/deploy.sh
@@ -3,44 +3,56 @@
 rootDir=$(pwd)
 echo $rootDir
 
-# define the directory to the blade
-cd 2019
-BLADE="template"
-
-# create the required folders in public
-mkdir $rootDir/public
-mkdir $rootDir/public/$BLADE
-mkdir $rootDir/public/$BLADE/stable
-mkdir $rootDir/public/$BLADE/latest
-
-# change to the blade directory to be built
-cd $BLADE
-
-# install npm
-npm install -g npm@latest yo grunt-cli generator-reveal
-npm install
-
-# build the master version into stable
-git fetch --tags
-latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
-git checkout $latestTag
-grunt dist
-mv public/* $rootDir/public/$BLADE/stable/.
-
-# build the develop version into latest
-git checkout -f develop
-git fetch origin develop
-git reset --hard origin/develop
-grunt dist
-mv public/* $rootDir/public/$BLADE/latest/.
-
-# auto redirect file
-
-echo '<html>\n
-      <head>\n
-      <meta http-equiv="refresh" content="0; url=https://r3.pages.uni.lu/school/'$BLADE'/stable"/>\n
-      </head>\n
-      <body>\n
-      </bod>\n
-      </html>\n' > $rootDir/public/$BLADE/index.html
-
+nBlades=0
+for d in $(find . -maxdepth 1 -type d)
+do
+    if [[ "${d}" == *20* ]]; then
+        cd "${d}"
+        echo "changed to ${d}"
+        for d1 in $(find . -maxdepth 1 -type d)
+        do
+            if [[ ${#d1} -ge 2 ]]; then
+                let "nBlades+=1"
+                #blades[$nBlades]="$tutorial"
+                BLADE=${d1:2}
+                echo "Building ... ${d1}"
+
+                # create the required folders in public
+                mkdir $rootDir/public
+                mkdir $rootDir/public/$BLADE
+                mkdir $rootDir/public/$BLADE/stable
+                mkdir $rootDir/public/$BLADE/latest
+
+                # change to the blade directory to be built
+                cd $BLADE
+
+                # install npm
+                npm install -g npm@latest yo grunt-cli generator-reveal
+                npm install
+
+                # build the master version into stable
+                #git fetch --tags
+                #latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
+                #git checkout $latestTag
+                #grunt dist
+                #mv public/* $rootDir/public/$BLADE/stable/.
+
+                # build the develop version into latest
+                git checkout -f develop
+                git fetch origin develop
+                git reset --hard origin/develop
+                grunt dist
+                mv public/* $rootDir/public/$BLADE/latest/.
+
+                # auto redirect file
+                echo '<html>\n
+                    <head>\n
+                    <meta http-equiv="refresh" content="0; url=https://r3.pages.uni.lu/school/'$BLADE'/stable"/>\n
+                    </head>\n
+                    <body>\n
+                    </bod>\n
+                    </html>\n' > $rootDir/public/$BLADE/index.html
+            fi
+        done
+    fi
+done
\ No newline at end of file
-- 
GitLab