From 9a3fe2aacd6baf9a63da12fc8b9e14abc559a606 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <bruederli@kolabsys.com>
Date: Sat, 07 Feb 2015 13:21:19 -0500
Subject: [PATCH] Complete the repositories section in composer.json during update

---
 bin/update.sh |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/bin/update.sh b/bin/update.sh
index 2631440..1dfaa96 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -181,6 +181,27 @@
       */
     }
 
+    // update the repositories section with the new dependencies
+    if (is_array($composer_template['repositories'])) {
+      if (!is_array($composer_data['repositories'])) {
+        $composer_data['repositories'] = array();
+      }
+
+      foreach ($composer_template['repositories'] as $repo) {
+        $rkey = $repo['type'] . $repo['url'] . $repo['package']['name'];
+        $existing = false;
+        foreach ($composer_data['repositories'] as $_repo) {
+          if ($rkey == $_repo['type'] . $_repo['url'] . $_repo['package']['name']) {
+            $existing = true;
+            break;
+          }
+        }
+        if (!$existing) {
+          $composer_data['repositories'][] = $repo;
+        }
+      }
+    }
+
     // use the JSON encoder from the Composer package
     if (is_file('composer.phar')) {
       include 'phar://composer.phar/src/Composer/Json/JsonFile.php';

--
Gitblit v1.9.1