Skip to content

Commit

Permalink
Merge pull request #97 from szepeviktor/patch-1
Browse files Browse the repository at this point in the history
Improve bin
  • Loading branch information
BrianHenryIE authored Apr 25, 2024
2 parents 53cb03e + f372d02 commit a88e1a7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
43 changes: 24 additions & 19 deletions bin/strauss
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
#!/usr/bin/env php
<?php
call_user_func(function ($version) {
if( ! Phar::running() ) {
if (is_file($autoload = getcwd() . '/vendor/autoload.php')) {
require $autoload;
} elseif (is_file($autoload = getcwd() . '/../../autoload.php')) {
require $autoload;
}
$autoloaders = Phar::running() === ''
? [
getcwd() . '/vendor/autoload.php',
getcwd() . '/../../autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../../autoload.php',
]
: [
__DIR__ . '/../vendor/autoload.php',
];

if ( is_file( $autoload = __DIR__ . '/../vendor/autoload.php' ) ) {
require( $autoload );
} elseif ( is_file( $autoload = __DIR__ . '/../../../autoload.php' ) ) {
require( $autoload );
} else {
fwrite( STDERR,
'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
);
exit( 1 );
foreach ($autoloaders as $autoloader) {
if (!is_file($autoloader)) {
continue;
}
} else {
include __DIR__ . '/../vendor/autoload.php';
require $autoloader;
break;
}

if (!class_exists(BrianHenryIE\Strauss\Console\Application::class)) {
fwrite(STDERR,
'You must set up the project dependencies, run the following commands:' . PHP_EOL
. 'curl -s https://getcomposer.org/installer | php' . PHP_EOL
. 'php composer.phar install' . PHP_EOL
);
exit(1);
}

$app = new BrianHenryIE\Strauss\Console\Application($version);
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ parameters:
level: 7
paths:
- src
- bin/strauss
bootstrapFiles:
- phpstanbootstrap.php
ignoreErrors:
Expand Down

0 comments on commit a88e1a7

Please sign in to comment.