From 438cea6363bb18c1d3e1d6d8d1c359f46c30b82c Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 15 Mar 2012 13:14:02 +0100 Subject: [PATCH] Regroup bootstrapers --- bin/compile | 10 +--------- bin/composer | 10 +--------- src/bootstrap.php | 25 +++++++++++++++++++++++++ tests/bootstrap.php | 15 +-------------- 4 files changed, 28 insertions(+), 32 deletions(-) create mode 100644 src/bootstrap.php diff --git a/bin/compile b/bin/compile index 589db50d1..3bb0fb73d 100755 --- a/bin/compile +++ b/bin/compile @@ -1,15 +1,7 @@ #!/usr/bin/env php + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +function includeIfExists($file) { + if (file_exists($file)) { + return include $file; + } +} + +if ((!$loader = includeIfExists(__DIR__.'/../../../.composer/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../vendor/.composer/autoload.php'))) { + die('You must set up the project dependencies, run the following commands:'.PHP_EOL. + 'curl -s http://getcomposer.org/installer | php'.PHP_EOL. + 'php composer.phar install'.PHP_EOL); +} + +return $loader; \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 39c661936..a4f2e7cec 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,18 +10,5 @@ * file that was distributed with this source code. */ -function autoload($file) { - if (file_exists($file)) { - return include $file; - } else { - return false; - } -} - -if ((!$loader = autoload(__DIR__.'/../../../.composer/autoload.php')) && (!$loader = autoload(__DIR__.'/../vendor/.composer/autoload.php'))) { - die('You must set up the project dependencies, run the following commands:'.PHP_EOL. - 'curl -s http://getcomposer.org/installer | php'.PHP_EOL. - 'php composer.phar install'.PHP_EOL); -} - +$loader = require __DIR__.'/../src/bootstrap.php'; $loader->add('Composer\Test', __DIR__);