From 3be80539e1ea2b8277d2ebe1a5820f2917406762 Mon Sep 17 00:00:00 2001
From: laurentheirendt <laurent.heirendt@uni.lu>
Date: Thu, 20 Jun 2019 21:18:44 +0200
Subject: [PATCH] add copy of gruntfile and fct of symlink

---
 contribute.py | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/contribute.py b/contribute.py
index 35884eba..78803bb5 100644
--- a/contribute.py
+++ b/contribute.py
@@ -2,6 +2,7 @@ import click
 import datetime
 import os
 from distutils.dir_util import copy_tree
+from shutil import copyfile
 
 @click.command()
 @click.option('--date', default=datetime.datetime.today().strftime('%Y-%m-%d'), help='Date of the presentation - format: YYYY-MM-DD')
@@ -46,18 +47,8 @@ def main(date, name):
     os.chdir(fullPath)
 
     # generate the symlink to the theme
-    if not os.path.islink('theme'):
-        os.symlink('../../theme', 'theme')
-        click.echo(' > Symlink to theme created.')
-    else:
-        click.echo(' > Symlink to theme already exists.')
-
-    # generate the symlink to the package.json file
-    if not os.path.islink('package.json'):
-        os.symlink('../../theme/package.json', 'package.json')
-        click.echo(' > Symlink to package.json created.')
-    else:
-        click.echo(' > Symlink to package.json already exists.')
+    createSymlink('../../theme', 'theme')
+    createSymlink('../../theme/package.json', 'package.json')
 
     # copy the contents of the template folder
     if not os.path.isfile(os.path.join(fullPath, 'slides', 'index.md')):
@@ -67,6 +58,21 @@ def main(date, name):
         click.echo(' > Slide deck already exists.')
 
 
+    # copy the Gruntfile
+    if not os.path.isfile(os.path.join(fullPath, 'Gruntfile.coffee')):
+        copyfile(os.path.join(rootDir, 'template', 'Gruntfile.coffee'), os.path.join(fullPath, 'Gruntfile.coffee'))
+        click.echo(' > Gruntfile copied.')
+    else:
+        click.echo(' > Gruntfile already exists.')
+
+
+def createSymlink(src, dst):
+    if not os.path.islink(dst):
+        os.symlink(src, dst)
+        click.echo(' > Symlink to {0} created.' . format(dst))
+    else:
+        click.echo(' > Symlink to {0} already exists.' . format(dst))
+
 
 def validateDate(input):
     """Validate a date string to fit the ISO format"""
-- 
GitLab