From 9d3afe245ab49e773b7f3f1649ce76914bb69739 Mon Sep 17 00:00:00 2001
From: laurentheirendt <laurent.heirendt@uni.lu>
Date: Fri, 8 Nov 2019 11:39:03 +0100
Subject: [PATCH] add contribute shell

---
 contribute.sh | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100755 contribute.sh

diff --git a/contribute.sh b/contribute.sh
new file mode 100755
index 00000000..76ceb988
--- /dev/null
+++ b/contribute.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# set the variables
+dockerImg="git-r3lab.uni.lu:4567/r3/docker/nodejs-yarn-grunt"
+dockerPort="9000"
+
+helpFunction()
+{
+   echo ""
+   echo "Usage: $0 -d parameterDate -n parameterName"
+   echo -e "\t-d Data of presentation"
+   echo -e "\t-n Name of presentation"
+   exit 1 # Exit script after printing help
+}
+
+while getopts "d:n:" opt
+do
+   case "$opt" in
+      d ) parameterDate="$OPTARG" ;;
+      n ) parameterName="$OPTARG" ;;
+      ? ) helpFunction ;; # Print helpFunction in case parameter is non-existent
+   esac
+done
+
+# Print helpFunction in case parameters are empty
+if [ -z "$parameterDate" ] || [ -z "$parameterName" ]
+then
+   echo "Some or all of the parameters are empty";
+   helpFunction
+fi
+
+# launch the docker file
+cmd="python contribute.py --date=\"$parameterDate\" --name=\"$parameterName\""
+
+docker run -p $dockerPort:$dockerPort -it -v $(pwd)/:/presentation $dockerImg /bin/bash -c "$cmd"
-- 
GitLab