Added support for folders in cookiecutter build function

Change-Id: I0d3825fc086d5aa28aa8dca4c5b5b7950c2608f8
diff --git a/src/com/mirantis/mk/Python.groovy b/src/com/mirantis/mk/Python.groovy
index 45696e5..ad202af 100644
--- a/src/com/mirantis/mk/Python.groovy
+++ b/src/com/mirantis/mk/Python.groovy
@@ -225,13 +225,16 @@
 /**
  * Generate the cookiecutter templates with given context
  *
- * @param path        Path where virtualenv is created
+ * @param template template
+ * @param context template context
+ * @param path Path where virtualenv is created (optional)
+ * @param templatePath path to cookiecutter template repo (optional)
  */
-def buildCookiecutterTemplate(template, context, outputDir = '.', path = none) {
+def buildCookiecutterTemplate(template, context, outputDir = '.', path = null, templatePath = ".") {
     configFile = "default_config.yaml"
     configString = "default_context:\n"
     writeFile file: configFile, text: context
-    command = "if [ -f generate.py ]; then python generate.py --config-file ${configFile} --template ${template}; else . ${path}/bin/activate; cookiecutter --config-file ${configFile} --output-dir ${outputDir} --overwrite-if-exists --verbose --no-input ${template}; fi"
+    command = "if [ -f ${templatePath}/generate.py ]; then python ${templatePath}/generate.py --config-file ${configFile} --template ${template} --output-dir ${outputDir}; else . ${path}/bin/activate; cookiecutter --config-file ${configFile} --output-dir ${outputDir} --overwrite-if-exists --verbose --no-input ${template}; fi"
     output = sh (returnStdout: true, script: command)
     echo("[Cookiecutter build] Output: ${output}")
 }