Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: autoloading to work in both phar/composer contexts
- Loading branch information
Showing
2 changed files
with
15 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
phar: phar-composer.phar | ||
php -d phar.readonly=off phar-composer.phar build niktux/karma | ||
|
||
local-phar: phar-composer.phar | ||
php -d phar.readonly=off phar-composer.phar build . | ||
|
||
phar-composer.phar: | ||
wget https://github.com/clue/phar-composer/releases/download/v1.0.0/phar-composer.phar | ||
wget -q https://github.com/clue/phar-composer/releases/download/v1.0.0/phar-composer.phar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
require __DIR__ . '/vendor/autoload.php'; | ||
// Karma can be installed by phar or by composer (deprecated). Autoload.php is located differently in these cases | ||
// Phar location needs to be tested first (__DIR__ is equals to phar://...) | ||
$locations = [__DIR__ . '/vendor/autoload.php', __DIR__ . '/../../autoload.php']; | ||
foreach($locations as $file) | ||
{ | ||
if (file_exists($file)) | ||
{ | ||
require $file; | ||
break; | ||
} | ||
} | ||
|
||
$console = new Karma\Console(new Karma\Application()); | ||
$console->run(); |