From 9a3fe2aacd6baf9a63da12fc8b9e14abc559a606 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Sat, 7 Feb 2015 19:21:19 +0100 Subject: Complete the repositories section in composer.json during update --- bin/update.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/bin/update.sh b/bin/update.sh index 26314408c..1dfaa961d 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -181,6 +181,27 @@ if ($RCI->configured) { */ } + // 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'; -- cgit v1.2.3