diff options
author | Wave <wave72@users.noreply.github.com> | 2016-07-22 10:55:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-22 10:55:02 +0200 |
commit | 744ad84714fe0f7a3d90250a4ff02dc4327b9061 (patch) | |
tree | 595fb74ec9ea0bc7130d18bd7993d719a222d343 /vendor/sabre/dav/bin/build.php | |
parent | c38c79d71c8ef70ef649f83e322f1984b75ee2dd (diff) | |
parent | 7d897a3f03bd57ed556433eb84a41963ba44e02e (diff) | |
download | volse-hubzilla-744ad84714fe0f7a3d90250a4ff02dc4327b9061.tar.gz volse-hubzilla-744ad84714fe0f7a3d90250a4ff02dc4327b9061.tar.bz2 volse-hubzilla-744ad84714fe0f7a3d90250a4ff02dc4327b9061.zip |
Merge pull request #6 from redmatrix/dev
Dev
Diffstat (limited to 'vendor/sabre/dav/bin/build.php')
-rw-r--r-- | vendor/sabre/dav/bin/build.php | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/vendor/sabre/dav/bin/build.php b/vendor/sabre/dav/bin/build.php index 11cca1e61..c4ba20941 100644 --- a/vendor/sabre/dav/bin/build.php +++ b/vendor/sabre/dav/bin/build.php @@ -1,3 +1,4 @@ +#!/usr/bin/env php <?php $tasks = [ @@ -9,10 +10,10 @@ $tasks = [ 'init', 'test', 'clean', ], 'clean' => [], - 'test' => [ + 'test' => [ 'composerupdate', ], - 'init' => [], + 'init' => [], 'composerupdate' => [], ]; @@ -35,9 +36,9 @@ if (!isset($tasks[$currentTask])) { $newTaskList = []; $oldTaskList = [$currentTask => true]; -while(count($oldTaskList)>0) { +while (count($oldTaskList) > 0) { - foreach($oldTaskList as $task=>$foo) { + foreach ($oldTaskList as $task => $foo) { if (!isset($tasks[$task])) { echo "Dependency not found: " . $task, "\n"; @@ -46,7 +47,7 @@ while(count($oldTaskList)>0) { $dependencies = $tasks[$task]; $fullFilled = true; - foreach($dependencies as $dependency) { + foreach ($dependencies as $dependency) { if (isset($newTaskList[$dependency])) { // Already in the fulfilled task list. continue; @@ -65,7 +66,7 @@ while(count($oldTaskList)>0) { } -foreach(array_keys($newTaskList) as $task) { +foreach (array_keys($newTaskList) as $task) { echo "task: " . $task, "\n"; call_user_func($task); @@ -100,7 +101,7 @@ function composerupdate() { global $baseDir; echo " Updating composer packages to latest version\n\n"; - system('cd ' . $baseDir . '; composer update --dev'); + system('cd ' . $baseDir . '; composer update'); } function test() { @@ -109,7 +110,7 @@ function test() { echo " Running all unittests.\n"; echo " This may take a while.\n\n"; - system(__DIR__ . '/phpunit --configuration ' . $baseDir . '/tests/phpunit.xml --stop-on-failure', $code); + system(__DIR__ . '/phpunit --configuration ' . $baseDir . '/tests/phpunit.xml.dist --stop-on-failure', $code); if ($code != 0) { echo "PHPUnit reported error code $code\n"; die(1); @@ -120,12 +121,51 @@ function test() { function buildzip() { global $baseDir, $version; - echo " Asking composer to download sabre/dav $version\n\n"; - system("composer create-project --no-dev sabre/dav build/SabreDAV $version", $code); - if ($code!==0) { + echo " Generating composer.json\n"; + + $input = json_decode(file_get_contents(__DIR__ . '/../composer.json'), true); + $newComposer = [ + "require" => $input['require'], + "config" => [ + "bin-dir" => "./bin", + ], + "prefer-stable" => true, + "minimum-stability" => "alpha", + ]; + unset( + $newComposer['require']['sabre/vobject'], + $newComposer['require']['sabre/http'], + $newComposer['require']['sabre/uri'], + $newComposer['require']['sabre/event'] + ); + $newComposer['require']['sabre/dav'] = $version; + mkdir('build/SabreDAV'); + file_put_contents('build/SabreDAV/composer.json', json_encode($newComposer, JSON_PRETTY_PRINT)); + + echo " Downloading dependencies\n"; + system("cd build/SabreDAV; composer install -n", $code); + if ($code !== 0) { echo "Composer reported error code $code\n"; die(1); } + + echo " Removing pointless files\n"; + unlink('build/SabreDAV/composer.json'); + unlink('build/SabreDAV/composer.lock'); + + echo " Moving important files to the root of the project\n"; + + $fileNames = [ + 'CHANGELOG.md', + 'LICENSE', + 'README.md', + 'examples', + ]; + foreach ($fileNames as $fileName) { + echo " $fileName\n"; + rename('build/SabreDAV/vendor/sabre/dav/' . $fileName, 'build/SabreDAV/' . $fileName); + } + // <zip destfile="build/SabreDAV-${sabredav.version}.zip" basedir="build/SabreDAV" prefix="SabreDAV/" /> echo "\n"; |