Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve bin #97

Merged
merged 6 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading