diff options
Diffstat (limited to 'vendor/sabre/dav/bin/build.php')
-rw-r--r-- | vendor/sabre/dav/bin/build.php | 88 |
1 files changed, 40 insertions, 48 deletions
diff --git a/vendor/sabre/dav/bin/build.php b/vendor/sabre/dav/bin/build.php index c4ba20941..54174a777 100644 --- a/vendor/sabre/dav/bin/build.php +++ b/vendor/sabre/dav/bin/build.php @@ -2,7 +2,6 @@ <?php $tasks = [ - 'buildzip' => [ 'init', 'test', 'clean', ], @@ -10,25 +9,29 @@ $tasks = [ 'init', 'test', 'clean', ], 'clean' => [], - 'test' => [ + 'test' => [ 'composerupdate', ], - 'init' => [], + 'init' => [], 'composerupdate' => [], ]; $default = 'buildzip'; -$baseDir = __DIR__ . '/../'; +$baseDir = __DIR__.'/../'; chdir($baseDir); $currentTask = $default; -if ($argc > 1) $currentTask = $argv[1]; +if ($argc > 1) { + $currentTask = $argv[1]; +} $version = null; -if ($argc > 2) $version = $argv[2]; +if ($argc > 2) { + $version = $argv[2]; +} if (!isset($tasks[$currentTask])) { - echo "Task not found: ", $currentTask, "\n"; + echo 'Task not found: ', $currentTask, "\n"; die(1); } @@ -37,11 +40,9 @@ $newTaskList = []; $oldTaskList = [$currentTask => true]; while (count($oldTaskList) > 0) { - foreach ($oldTaskList as $task => $foo) { - if (!isset($tasks[$task])) { - echo "Dependency not found: " . $task, "\n"; + echo 'Dependency not found: '.$task, "\n"; die(1); } $dependencies = $tasks[$task]; @@ -55,82 +56,74 @@ while (count($oldTaskList) > 0) { $oldTaskList[$dependency] = true; $fullFilled = false; } - } if ($fullFilled) { unset($oldTaskList[$task]); $newTaskList[$task] = 1; } - } - } foreach (array_keys($newTaskList) as $task) { - - echo "task: " . $task, "\n"; + echo 'task: '.$task, "\n"; call_user_func($task); echo "\n"; - } -function init() { - +function init() +{ global $version; if (!$version) { - include __DIR__ . '/../vendor/autoload.php'; + include __DIR__.'/../vendor/autoload.php'; $version = Sabre\DAV\Version::VERSION; } - echo " Building sabre/dav " . $version, "\n"; - + echo ' Building sabre/dav '.$version, "\n"; } -function clean() { - +function clean() +{ global $baseDir; echo " Removing build files\n"; - $outputDir = $baseDir . '/build/SabreDAV'; + $outputDir = $baseDir.'/build/SabreDAV'; if (is_dir($outputDir)) { - system('rm -r ' . $baseDir . '/build/SabreDAV'); + system('rm -r '.$baseDir.'/build/SabreDAV'); } - } -function composerupdate() { - +function composerupdate() +{ global $baseDir; echo " Updating composer packages to latest version\n\n"; - system('cd ' . $baseDir . '; composer update'); + system('cd '.$baseDir.'; composer update'); } -function test() { - +function test() +{ global $baseDir; echo " Running all unittests.\n"; echo " This may take a while.\n\n"; - system(__DIR__ . '/phpunit --configuration ' . $baseDir . '/tests/phpunit.xml.dist --stop-on-failure', $code); - if ($code != 0) { + system(__DIR__.'/phpunit --configuration '.$baseDir.'/tests/phpunit.xml.dist --stop-on-failure', $code); + if (0 != $code) { echo "PHPUnit reported error code $code\n"; die(1); } - } -function buildzip() { - +function buildzip() +{ global $baseDir, $version; echo " Generating composer.json\n"; - $input = json_decode(file_get_contents(__DIR__ . '/../composer.json'), true); + $input = json_decode(file_get_contents(__DIR__.'/../composer.json'), true); $newComposer = [ - "require" => $input['require'], - "config" => [ - "bin-dir" => "./bin", + 'require' => $input['require'], + 'config' => [ + 'bin-dir' => './bin', ], - "prefer-stable" => true, - "minimum-stability" => "alpha", + 'prefer-stable' => true, + 'minimum-stability' => 'alpha', ]; unset( $newComposer['require']['sabre/vobject'], @@ -143,8 +136,8 @@ function buildzip() { 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) { + system('cd build/SabreDAV; composer install -n', $code); + if (0 !== $code) { echo "Composer reported error code $code\n"; die(1); } @@ -163,15 +156,14 @@ function buildzip() { ]; foreach ($fileNames as $fileName) { echo " $fileName\n"; - rename('build/SabreDAV/vendor/sabre/dav/' . $fileName, 'build/SabreDAV/' . $fileName); + rename('build/SabreDAV/vendor/sabre/dav/'.$fileName, 'build/SabreDAV/'.$fileName); } // <zip destfile="build/SabreDAV-${sabredav.version}.zip" basedir="build/SabreDAV" prefix="SabreDAV/" /> echo "\n"; echo "Zipping the sabredav distribution\n\n"; - system('cd build; zip -qr sabredav-' . $version . '.zip SabreDAV'); - - echo "Done."; + system('cd build; zip -qr sabredav-'.$version.'.zip SabreDAV'); + echo 'Done.'; } |