Permalink
Browse files

Merge pull request #8 from mheleniak/autoloaders

use autoload file from root-library vendor dir if it exists, fixes GH-7
  • Loading branch information...
2 parents d164989 + 98fc114 commit 586ff805777829dd79eb921d9960e3d0d7909895 @Seldaek Seldaek committed Apr 1, 2012
Showing with 28 additions and 13 deletions.
  1. +1 −6 bin/compile
  2. +1 −6 bin/satis
  3. +25 −0 src/bootstrap.php
  4. +1 −1 tests/bootstrap.php
View
@@ -1,12 +1,7 @@
#!/usr/bin/env php
<?php
-if (!@include __DIR__.'/../vendor/.composer/autoload.php') {
- die('You must set up the project dependencies, run the following commands:
-wget http://getcomposer.org/composer.phar
-php composer.phar install
-');
-}
+require __DIR__.'/../src/bootstrap.php';
use Composer\Satis\Compiler;
View
@@ -1,12 +1,7 @@
#!/usr/bin/env php
<?php
-if (!@include __DIR__.'/../vendor/.composer/autoload.php') {
- die('You must set up the project dependencies, run the following commands:
-wget http://getcomposer.org/composer.phar
-php composer.phar install
-');
-}
+require __DIR__.'/../src/bootstrap.php';
use Composer\Satis\Console\Application;
View
@@ -0,0 +1,25 @@
+<?php
+
+/*
+ * This file is part of Satis.
+ *
+ * (c) Nils Adermann <naderman@naderman.de>
+ * Jordi Boggiano <j.boggiano@seld.be>
+ *
+ * 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;
View
@@ -10,5 +10,5 @@
* file that was distributed with this source code.
*/
-$loader = require __DIR__.'/../vendor/.composer/autoload.php';
+$loader = require __DIR__.'/../src/bootstrap.php';
$loader->add('Composer\Test', __DIR__);

0 comments on commit 586ff80

Please sign in to comment.