From 39e2b9af1e7c7c23a23f634cd0b2726ae7fe54a4 Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Mon, 18 Aug 2014 13:40:40 -0700 Subject: [PATCH] Updating to use Burgomaster --- Makefile | 32 +++++++++ build/aws-autoloader.php | 35 ---------- build/packager.php | 140 ++++++--------------------------------- build/phar-stub.php | 5 -- composer.json | 1 - 5 files changed, 53 insertions(+), 160 deletions(-) create mode 100644 Makefile delete mode 100644 build/aws-autoloader.php delete mode 100644 build/phar-stub.php diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..bb5e63f7e1 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +all: clean coverage docs + +test: + vendor/bin/phpunit + +coverage: + vendor/bin/phpunit --coverage-html=build/artifacts/coverage + +integration: + vendor/bin/phpunit -c phpunit.functional.xml + +view-coverage: + open build/artifacts/coverage/index.html + +clean: + rm -rf build/artifacts + cd docs && make clean + +docs: + cd docs && make html + +view-docs: + open docs/_build/html/index.html + +package: burgomaster + time php build/packager.php + +burgomaster: + mkdir -p build/artifacts + curl -s https://raw.githubusercontent.com/mtdowling/Burgomaster/0.0.1/src/Burgomaster.php > build/artifacts/Burgomaster.php + +.PHONY: docs burgomaster diff --git a/build/aws-autoloader.php b/build/aws-autoloader.php deleted file mode 100644 index 2b7d7acf5e..0000000000 --- a/build/aws-autoloader.php +++ /dev/null @@ -1,35 +0,0 @@ -registerNamespaces(array( - 'Aws' => AWS_FILE_PREFIX, - 'Guzzle' => AWS_FILE_PREFIX, - 'Symfony' => AWS_FILE_PREFIX, - 'Doctrine' => AWS_FILE_PREFIX, - 'Psr' => AWS_FILE_PREFIX, - 'Monolog' => AWS_FILE_PREFIX -)); - -$classLoader->register(); - -return $classLoader; diff --git a/build/packager.php b/build/packager.php index f5dd768b43..96aaef513a 100644 --- a/build/packager.php +++ b/build/packager.php @@ -1,124 +1,26 @@ From $fromDir"); - - $total = 0; - foreach ($iter as $file) { - if (isset($exts[$file->getExtension()]) - || $file->getBaseName() == 'LICENSE' - ) { - $toPath = str_replace($fromDir, '', (string) $file); - $toPath = $baseDir . '/' . $toPath; - deep_copy((string) $file, $toPath); - $total++; - } - } - - debug_log(" Copied $total files"); -} - -function create_phar($baseDir, $dest) -{ - debug_log('Creating full phar file'); - $phar = new Phar($dest, 0, 'aws.phar'); - $phar->buildFromDirectory($baseDir); - $phar->setStub(file_get_contents(__DIR__ . '/phar-stub.php')); - - debug_log(" > Created at $dest"); -} - -function test_phar($baseDir, $phar) -{ - debug_log('Testing the phar'); - exec('php ' . __DIR__ . '/test_phar.php', $output, $ret); - if ($ret !== 0) { - die("Testing the phar failed with exit code {$ret}\n" - . implode("\n", $output)); - } - debug_log(' > Phar is OK: ' . implode("\n", $output)); +foreach (['README.md', 'LICENSE.md', 'NOTICE.md'] as $file) { + $burgomaster->deepCopy($file, $file); } -function create_zip($baseDir, $dest) -{ - debug_log('Creating zip file'); - chdir($baseDir); - exec("zip -r $dest ./"); - debug_log(" > Created at $dest"); - chdir(__DIR__); -} - -$baseDir = realpath(__DIR__ . '/..') . '/build/artifacts/staging'; - -create_staging_dir($baseDir); -create_phar($baseDir, __DIR__ . '/artifacts/aws.phar'); -test_phar($baseDir, __DIR__ . '/artifacts/aws.phar'); -create_zip($baseDir, __DIR__ . '/artifacts/aws.zip'); +// Copy each dependency to the staging directory. Copy *.php and *.pem files. +$burgomaster->recursiveCopy('src/Aws', 'Aws', ['php', 'json']); +$burgomaster->recursiveCopy('vendor/guzzle/guzzle/src/Guzzle', 'Guzzle', ['php', 'pem']); +$burgomaster->recursiveCopy('vendor/doctrine/cache/lib/Doctrine', 'Doctrine'); +$burgomaster->recursiveCopy('vendor/psr/log/Psr', 'Psr'); +$burgomaster->recursiveCopy('vendor/monolog/monolog/src/Monolog', 'Monlog'); +$burgomaster->recursiveCopy('vendor/symfony/event-dispatcher/Symfony', 'Symfony'); + +$burgomaster->createAutoloader(); +$burgomaster->createZip(__DIR__ . '/artifacts/aws.zip'); +$burgomaster->createPhar(__DIR__ . '/artifacts/aws.phar'); +$burgomaster->startSection('test_phar'); +$burgomaster->debug('Phar output: ' + . $burgomaster->exec('php ' . __DIR__ . '/test_phar.php')); +$burgomaster->endSection(); diff --git a/build/phar-stub.php b/build/phar-stub.php deleted file mode 100644 index 7807fc7b3e..0000000000 --- a/build/phar-stub.php +++ /dev/null @@ -1,5 +0,0 @@ -