Fix bin/publish: use correct .env path for rspade_system Fix bin/publish script: prevent grep exit code 1 from terminating script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
133 lines
4.4 KiB
PHP
Executable File
133 lines
4.4 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
|
|
// Change to application directory to ensure all operations use correct paths
|
|
chdir(__DIR__);
|
|
|
|
define('LARAVEL_START', microtime(true));
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Environment File Initialization
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Ensure .env file exists before proceeding. If .env is missing but
|
|
| .env.dist is present, copy .env.dist to .env. If neither exists,
|
|
| fail with a clear error message.
|
|
|
|
|
*/
|
|
|
|
if (!file_exists(__DIR__.'/.env')) {
|
|
if (file_exists(__DIR__.'/.env.dist')) {
|
|
copy(__DIR__.'/.env.dist', __DIR__.'/.env');
|
|
echo "Created .env from .env.dist template.\n";
|
|
echo "Please review .env and update configuration as needed.\n\n";
|
|
} else {
|
|
echo "ERROR: No .env or .env.dist file found.\n";
|
|
echo "Cannot start application without environment configuration.\n";
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Early Command Interception
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Intercept rsx:framework:pull BEFORE Laravel loads. This allows the
|
|
| framework update script to run independently and replace the framework
|
|
| code without Laravel being initialized on potentially outdated code.
|
|
|
|
|
*/
|
|
|
|
if (isset($argv[1]) && $argv[1] === 'rsx:framework:pull') {
|
|
$script = __DIR__ . '/bin/framework-pull-upstream.sh';
|
|
if (!file_exists($script)) {
|
|
echo "ERROR: Framework update script not found: {$script}\n";
|
|
exit(1);
|
|
}
|
|
|
|
// Pass all arguments except 'artisan' and 'rsx:framework:pull'
|
|
$args = array_slice($argv, 2);
|
|
$cmd = 'bash ' . escapeshellarg($script) . ' ' . implode(' ', array_map('escapeshellarg', $args));
|
|
passthru($cmd, $exit_code);
|
|
exit($exit_code);
|
|
}
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Register The Auto Loader
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Composer provides a convenient, automatically generated class loader
|
|
| for our application. We just need to utilize it! We'll require it
|
|
| into the script here so that we do not have to worry about the
|
|
| loading of any of our classes manually. It's great to relax.
|
|
|
|
|
*/
|
|
|
|
require __DIR__.'/vendor/autoload.php';
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Initialize RSpade Framework
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Acquire the global application read lock before anything else happens.
|
|
| This ensures proper coordination between processes for operations like
|
|
| manifest rebuilding. This MUST happen before the manifest loads.
|
|
|
|
|
*/
|
|
|
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Log IDE Artisan Requests
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| When running in IDE context, log the artisan command and arguments
|
|
| for review. This helps track what commands the IDE is executing.
|
|
|
|
|
*/
|
|
|
|
if (function_exists('is_ide') && is_ide()) {
|
|
$command = implode(' ', $argv);
|
|
$timestamp = date('Y-m-d H:i:s');
|
|
$log_message = "[{$timestamp}] IDE artisan request: {$command}";
|
|
error_log($log_message . PHP_EOL, 3, storage_path('logs/laravel.log'));
|
|
}
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Run The Artisan Application
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| When we run the console application, the current CLI command will be
|
|
| executed in this console and the response sent back to a terminal
|
|
| or another output device for the developers. Here goes nothing!
|
|
|
|
|
*/
|
|
|
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
|
|
|
$status = $kernel->handle(
|
|
$input = new Symfony\Component\Console\Input\ArgvInput,
|
|
new Symfony\Component\Console\Output\ConsoleOutput
|
|
);
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Shutdown The Application
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Once Artisan has finished running, we will fire off the shutdown events
|
|
| so that any final work may be done by the application before we shut
|
|
| down the process. This is the last thing to happen to the request.
|
|
|
|
|
*/
|
|
|
|
$kernel->terminate($input, $status);
|
|
|
|
exit($status);
|