Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use autoload file from root-library vendor dir if it exists, fixes GH-7

  • Loading branch information...
commit 98fc11456974b167039d498501bb6edb23ef9745 1 parent d164989
Mateusz Heleniak authored
View
7 bin/compile
@@ -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
7 bin/satis
@@ -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
25 src/bootstrap.php
@@ -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
2  tests/bootstrap.php
@@ -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__);
Please sign in to comment.
Something went wrong with that request. Please try again.