#!/bin/bash
source ./function.sh
# abort on errors
set -e

# Define the commit command
while getopts c: option
do
case "${option}"
in
c) COMMIT=${OPTARG};;
esac
done

if [ -n "$(git status --porcelain)" ]; then
   update
   echo 'update';
elif [ -n "$(git log origin/master..master)" ]; then
   change
   # echo 'change';
fi
# BASIC
# columns
cd "./widgets/basic/columns/"

sh deploy.sh -c "$COMMIT"
# editor
cd ../editor/
git remote -vv
sh deploy.sh -c "$COMMIT"
# form
cd ../form/
git remote -vv
sh deploy.sh -c "$COMMIT"
# hero
cd ../hero/
git remote -vv
sh deploy.sh -c "$COMMIT"
# images
cd ../images/
git remote -vv
sh deploy.sh -c "$COMMIT"
# news
cd ../news/
sh deploy.sh -c "$COMMIT"
# text_img
cd ../text_img/
git remote -vv
sh deploy.sh -c "$COMMIT"
# video
cd ../video/
git remote -vv
sh deploy.sh -c "$COMMIT"

# PREMIUM
# campaigns
cd ../../premium/campaigns/
git remote -vv
sh deploy.sh -c "$COMMIT"
# events
cd ../events/
git remote -vv
sh deploy.sh -c "$COMMIT"
# faq
cd ../faq/
git remote -vv
sh deploy.sh -c "$COMMIT"
# map
cd ../map/
git remote -vv
sh deploy.sh -c "$COMMIT"
# mapmulti
cd ../mapmulti/
git remote -vv
sh deploy.sh -c "$COMMIT"
# partners
cd ../partners/
git remote -vv
sh deploy.sh -c "$COMMIT"
# projects
cd ../projects/
git remote -vv
sh deploy.sh -c "$COMMIT"
# step
cd ../step/
git remote -vv
sh deploy.sh -c "$COMMIT"
# stories
cd ../stories/
git remote -vv
sh deploy.sh -c "$COMMIT"
# team
cd ../team/
git remote -vv
sh deploy.sh -c "$COMMIT"
# testimonials
cd ../testimonials/
git remote -vv
sh deploy.sh -c "$COMMIT"




# cd ./widgets/basic/columns/
# sh deploy.sh -c "$COMMIT"

# cd ../editor/
# sh deploy.sh -c "$COMMIT"













# git clone git@gitlab.spade.be:minotaure/plugin/widgets/basic/hero.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/basic/video.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/basic/text_img.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/basic/news.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/basic/images.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/basic/form.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/basic/editor.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/basic/columns.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/premium/step.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/premium/mapmulti.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/premium/team.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/premium/testimonials.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/premium/projects.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/premium/partners.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/premium/map.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/premium/faq.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/premium/campaigns.git
# git clone git@gitlab.spade.be:minotaure/plugin/widgets/premium/events.git