From 8ff0116ed441e43d769287f41e0b326beead0bcf Mon Sep 17 00:00:00 2001
From: hahn <axel.hahn@iml.unibe.ch>
Date: Fri, 22 Jul 2022 19:34:20 +0200
Subject: [PATCH] add example build plugin: zip

---
 .../plugins/build/zip/build_zip.php           | 32 +++++++++++++++++++
 .../deployment/plugins/build/zip/info.json    | 11 +++++++
 .../plugins/build/zip/lang_de-de.json         |  4 +++
 .../plugins/build/zip/lang_en-en.json         |  4 +++
 4 files changed, 51 insertions(+)
 create mode 100644 public_html/deployment/plugins/build/zip/build_zip.php
 create mode 100644 public_html/deployment/plugins/build/zip/info.json
 create mode 100644 public_html/deployment/plugins/build/zip/lang_de-de.json
 create mode 100644 public_html/deployment/plugins/build/zip/lang_en-en.json

diff --git a/public_html/deployment/plugins/build/zip/build_zip.php b/public_html/deployment/plugins/build/zip/build_zip.php
new file mode 100644
index 00000000..37e7066f
--- /dev/null
+++ b/public_html/deployment/plugins/build/zip/build_zip.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * 
+ * Build plugin - TGZ
+ * 
+ * @author <axel.hahn@iml.unibe.ch>
+ */
+class build_zip extends build_base {
+    
+    /**
+     * check requirements if the plugin could work
+     * @return array
+     */
+    public function checkRequirements() {
+        return [
+            'which zip'
+        ];
+    }
+    
+    /**
+     * get an array with shell commands to execute
+     * @return array
+     */
+    public function getBuildCommands(){
+        return [
+            'cd "'. $this->getBuildDir(). '" && zip -r9 "'. $this->getOutfile().'" .'
+        ];
+    }
+   
+
+}
diff --git a/public_html/deployment/plugins/build/zip/info.json b/public_html/deployment/plugins/build/zip/info.json
new file mode 100644
index 00000000..0d4f6b9a
--- /dev/null
+++ b/public_html/deployment/plugins/build/zip/info.json
@@ -0,0 +1,11 @@
+{
+    "name": "ZIP Archive",
+    "description": "Create a ZIP archive",
+    "author": "Axel Hahn; University of Bern; Institute for Medical education",
+    
+    "version": "1.0",
+    "url": "[included]",
+    "license": "GNU GPL 3.0",
+
+    "extension": "zip"
+}
diff --git a/public_html/deployment/plugins/build/zip/lang_de-de.json b/public_html/deployment/plugins/build/zip/lang_de-de.json
new file mode 100644
index 00000000..f0bf3895
--- /dev/null
+++ b/public_html/deployment/plugins/build/zip/lang_de-de.json
@@ -0,0 +1,4 @@
+{
+    "plugin_name": "ZIP",
+    "description": "ZIP Archiv erstellen"
+}
\ No newline at end of file
diff --git a/public_html/deployment/plugins/build/zip/lang_en-en.json b/public_html/deployment/plugins/build/zip/lang_en-en.json
new file mode 100644
index 00000000..c0fd28c1
--- /dev/null
+++ b/public_html/deployment/plugins/build/zip/lang_en-en.json
@@ -0,0 +1,4 @@
+{
+    "plugin_name": "ZIP",
+    "description": "Create a ZIP archive"
+}
\ No newline at end of file
-- 
GitLab