From 6622c14dc855e2f26597cabf961619f87e13c3b0 Mon Sep 17 00:00:00 2001
From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl>
Date: Sat, 25 Mar 2017 11:12:21 +0100
Subject: [PATCH] build test

---
 .gitignore                      |  1 +
 .gitlab-ci.yml                  | 13 +++++++++++--
 cass_zk_rmq/DESCRIPTION         |  1 +
 cass_zk_rmq/metadata.json       | 15 ---------------
 cassandra/DESCRIPTION           |  1 +
 cassandra/metadata.json         |  2 +-
 czr_pythons/DESCRIPTION         |  1 +
 czr_pythons/metadata.json       | 15 ---------------
 czr_pythons_pg/DESCIRPTION      |  1 +
 czr_pythons_pg/metadata.json    | 15 ---------------
 make-gitlab-ci.py => make.py    | 27 ++++++++++++++++++++++++++-
 nodejs4/DESCRIPTION             |  1 +
 nodejs4/metadata.json           | 15 ---------------
 nodejs5_jdk_adk25/DESCRIPTION   |  1 +
 nodejs5_jdk_adk25/metadata.json | 15 ---------------
 15 files changed, 45 insertions(+), 79 deletions(-)
 create mode 100644 cass_zk_rmq/DESCRIPTION
 delete mode 100644 cass_zk_rmq/metadata.json
 create mode 100644 cassandra/DESCRIPTION
 create mode 100644 czr_pythons/DESCRIPTION
 delete mode 100644 czr_pythons/metadata.json
 create mode 100644 czr_pythons_pg/DESCIRPTION
 delete mode 100644 czr_pythons_pg/metadata.json
 rename make-gitlab-ci.py => make.py (54%)
 create mode 100644 nodejs4/DESCRIPTION
 delete mode 100644 nodejs4/metadata.json
 create mode 100644 nodejs5_jdk_adk25/DESCRIPTION
 delete mode 100644 nodejs5_jdk_adk25/metadata.json

diff --git a/.gitignore b/.gitignore
index 591e112..ccd0a8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 .idea/
 .vagrant/
+*/metadata.json
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 52f069e..5efd096 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,13 @@
-
+stages:
+ - makemeta
+ - build
+build_metadata:
+  stage: makemeta
+  script:
+    - python make.py
+ cache:
+   paths:
+     - ./*/metadata.json
 variables:
   PREFIX: henrietta/
 .job_template: &box_build_job
@@ -8,7 +17,7 @@ variables:
     - develop19216822423
   before_script:
     - ln -s .. $BOX/boxen
-    - cp -rf wynurz.s $BOX/wynurz.sh
+    - cp -f *.sh $BOX/
     - cp SkeletonVagrantfile $BOX/Vagrantfile
     - sed -ie 's/INSERTBOXNAME/$BOX/g' $BOX/Vagrantfile
     - cd $BOX; vagrant up
diff --git a/cass_zk_rmq/DESCRIPTION b/cass_zk_rmq/DESCRIPTION
new file mode 100644
index 0000000..15e1fd5
--- /dev/null
+++ b/cass_zk_rmq/DESCRIPTION
@@ -0,0 +1 @@
+Cassandra, ZooKeeper, RabbitMQ
\ No newline at end of file
diff --git a/cass_zk_rmq/metadata.json b/cass_zk_rmq/metadata.json
deleted file mode 100644
index e54a1d0..0000000
--- a/cass_zk_rmq/metadata.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "description": "Cassandra, ZooKeeper, RabbitMQ",
-    "short_description": "Cassandra, ZooKeeper, RabbitMQ",
-    "name": "henrietta/cass_zk_rmq",
-    "versions": [{
-        "version": "1",
-        "status": "active",
-        "description_html": "<p>Cass+ZK+RMQ</p>",
-        "description_markdown": "Cass+ZK+RMQ",
-        "providers": [{
-            "name": "virtualbox",
-            "url": "http://dev.dms-serwis.com.pl/vagrant/cass_zk_rmq.box"
-        }]
-    }]
-}
\ No newline at end of file
diff --git a/cassandra/DESCRIPTION b/cassandra/DESCRIPTION
new file mode 100644
index 0000000..a218ac4
--- /dev/null
+++ b/cassandra/DESCRIPTION
@@ -0,0 +1 @@
+Debian Jessie x86_64 with Cassandra 3.0.9
\ No newline at end of file
diff --git a/cassandra/metadata.json b/cassandra/metadata.json
index 3065a02..305681a 100644
--- a/cassandra/metadata.json
+++ b/cassandra/metadata.json
@@ -1,5 +1,5 @@
 {
-    "description": "Debian Jessie x86_64 with Cassandra 3.0.9",
+    "description": "",
     "short_description": "Debian + Cassandra",
     "name": "henrietta/cassandra",
     "versions": [{
diff --git a/czr_pythons/DESCRIPTION b/czr_pythons/DESCRIPTION
new file mode 100644
index 0000000..43b9777
--- /dev/null
+++ b/czr_pythons/DESCRIPTION
@@ -0,0 +1 @@
+Cassandra, ZooKeeper, RabbitMQ and assorted Pythons
\ No newline at end of file
diff --git a/czr_pythons/metadata.json b/czr_pythons/metadata.json
deleted file mode 100644
index 29315cd..0000000
--- a/czr_pythons/metadata.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "description": "Cassandra, ZooKeeper, RabbitMQ and assorted Pythons",
-    "short_description": "Cassandra, ZooKeeper, RabbitMQ and assorted Pythons",
-    "name": "henrietta/czr_pythons",
-    "versions": [{
-        "version": "1",
-        "status": "active",
-        "description_html": "<p>Cass+ZK+RMQ+Py</p>",
-        "description_markdown": "Cass+ZK+RMQ+Py",
-        "providers": [{
-            "name": "virtualbox",
-            "url": "http://dev.dms-serwis.com.pl/vagrant/czr_pythons.box"
-        }]
-    }]
-}
\ No newline at end of file
diff --git a/czr_pythons_pg/DESCIRPTION b/czr_pythons_pg/DESCIRPTION
new file mode 100644
index 0000000..63bfdda
--- /dev/null
+++ b/czr_pythons_pg/DESCIRPTION
@@ -0,0 +1 @@
+czr_pythons but with PostgreSQL
\ No newline at end of file
diff --git a/czr_pythons_pg/metadata.json b/czr_pythons_pg/metadata.json
deleted file mode 100644
index 50bb0f5..0000000
--- a/czr_pythons_pg/metadata.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "description": "Cassandra, ZooKeeper, RabbitMQ, PgSQL and assorted Pythons",
-    "short_description": "Cassandra, ZooKeeper, RabbitMQ, PgSQL and assorted Pythons",
-    "name": "henrietta/czr_pythons_pg",
-    "versions": [{
-        "version": "1",
-        "status": "active",
-        "description_html": "<p>Cass+ZK+RMQ+PgSQL+Py</p>",
-        "description_markdown": "Cass+ZK+RMQ+PgSQL+Py",
-        "providers": [{
-            "name": "virtualbox",
-            "url": "http://dev.dms-serwis.com.pl/vagrant/czr_pythons_pg.box"
-        }]
-    }]
-}
\ No newline at end of file
diff --git a/make-gitlab-ci.py b/make.py
similarity index 54%
rename from make-gitlab-ci.py
rename to make.py
index 126f878..caa379a 100644
--- a/make-gitlab-ci.py
+++ b/make.py
@@ -8,6 +8,7 @@ if __name__ == '__main__':
     dirs = [dir for dir in os.listdir('.') if os.path.isdir(dir)]
     boxes = [box for box in dirs if os.path.exists(os.path.join(box, 'Vagrantfile'))]
 
+    # Generate Gitlab CI file
     with open('.gitlab-ci.yml', 'wb') as ci:
         ci.write(b'''
 variables:
@@ -40,4 +41,28 @@ build_%s:
     - master
     - /^%s\-(.*)$/
 
-''' % (box, box, box))
\ No newline at end of file
+''' % (box, box, box))
+
+
+    # Generate metadata
+    for box in boxes:
+        with open(os.path.join(box, 'DESCRIPTION'), 'rb') as mdin:
+            description = mdin.read().strip()
+
+            with open(os.path.join(box, 'metadata.json'), 'wb') as mdout:
+                mdout.write('''{
+    "description": "%s",
+    "short_description": "%s",
+    "name": "henrietta/%s",
+    "versions": [{
+        "version": "1",
+        "status": "active",
+        "description_html": "<p>%s</p>",
+        "description_markdown": "%s",
+        "providers": [{
+            "name": "virtualbox",
+            "url": "http://dev.dms-serwis.com.pl/vagrant/%s.box"
+        }]
+    }]
+}''' % (description, description, box, description, description, box))
+
diff --git a/nodejs4/DESCRIPTION b/nodejs4/DESCRIPTION
new file mode 100644
index 0000000..d285119
--- /dev/null
+++ b/nodejs4/DESCRIPTION
@@ -0,0 +1 @@
+NodeJS 4 + bower + gulp
\ No newline at end of file
diff --git a/nodejs4/metadata.json b/nodejs4/metadata.json
deleted file mode 100644
index 8c2280a..0000000
--- a/nodejs4/metadata.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "description": "NodeJS 4 + bower + gulp",
-    "short_description": "NodeJS 4 + bower + gulp",
-    "name": "henrietta/nodejs4",
-    "versions": [{
-        "version": "1",
-        "status": "active",
-        "description_html": "<p>NodeJS 4 + bower + gulp</p>",
-        "description_markdown": "NodeJS 4 + bower + gulp",
-        "providers": [{
-            "name": "virtualbox",
-            "url": "http://dev.dms-serwis.com.pl/vagrant/nodejs4.box"
-        }]
-    }]
-}
\ No newline at end of file
diff --git a/nodejs5_jdk_adk25/DESCRIPTION b/nodejs5_jdk_adk25/DESCRIPTION
new file mode 100644
index 0000000..f62f671
--- /dev/null
+++ b/nodejs5_jdk_adk25/DESCRIPTION
@@ -0,0 +1 @@
+odeJS 5.x + JDK + ADT + cordova
\ No newline at end of file
diff --git a/nodejs5_jdk_adk25/metadata.json b/nodejs5_jdk_adk25/metadata.json
deleted file mode 100644
index eb6e887..0000000
--- a/nodejs5_jdk_adk25/metadata.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "description": "NodeJS 5.x + JDK + ADT + cordova",
-    "short_description": "NodeJS 5.x + JDK + ADT + cordova",
-    "name": "henrietta/nodejs5_jdk_adk25",
-    "versions": [{
-        "version": "1",
-        "status": "active",
-        "description_html": "<p>NodeJS 5.x + JDK + ADT + cordova</p>",
-        "description_markdown": "NodeJS 5.x + JDK + ADT + cordova",
-        "providers": [{
-            "name": "virtualbox",
-            "url": "http://dev.dms-serwis.com.pl/vagrant/nodejs5_jdk_adk25.box"
-        }]
-    }]
-}
\ No newline at end of file
-- 
GitLab