mirror of
https://github.com/zeropingheroes/lancache-autofill
synced 2024-11-10 02:14:12 +00:00
Switching from console app class to full app class
Old: Illuminate\Console\Application New: Illuminate\Foundation\Application To allow for loading of service providers
This commit is contained in:
parent
b795f1dcde
commit
1a8ceb1ad5
2 changed files with 60 additions and 27 deletions
|
@ -2,18 +2,9 @@
|
|||
<?php
|
||||
|
||||
use Dotenv\Dotenv;
|
||||
use Illuminate\Console\Application;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Zeropingheroes\LancacheAutofill\Commands\App\{
|
||||
InitialiseDatabase, InitialiseDownloadsDirectory
|
||||
};
|
||||
use Zeropingheroes\LancacheAutofill\Commands\Steam\{
|
||||
AuthoriseAccount, Dequeue, Initialise, QueueApp, QueuePopularApps, Requeue, SearchApps, ShowQueue, StartDownloading, UpdateAppList
|
||||
};
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
|
@ -22,8 +13,20 @@ $dotenv = new Dotenv(__DIR__);
|
|||
$dotenv->load();
|
||||
$dotenv->required(['DOWNLOADS_DIRECTORY', 'STEAMCMD_PATH']);
|
||||
|
||||
// Set up the console app
|
||||
$app = new Application(new Container, new Dispatcher, '5.5');
|
||||
// Create the application
|
||||
$app = new Illuminate\Foundation\Application(realpath(__DIR__));
|
||||
|
||||
// Register the console kernel
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Console\Kernel::class,
|
||||
Zeropingheroes\LancacheAutofill\Console\Kernel::class
|
||||
);
|
||||
|
||||
// Register the exception handler
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||
Zeropingheroes\LancacheAutofill\Exceptions\Handler::class
|
||||
);
|
||||
|
||||
// Set up the SQLite database connection
|
||||
$capsule = new Capsule;
|
||||
|
@ -34,20 +37,13 @@ $capsule->addConnection([
|
|||
$capsule->setAsGlobal();
|
||||
$capsule->bootEloquent();
|
||||
|
||||
// Make commands available
|
||||
$app->add(new InitialiseDatabase);
|
||||
$app->add(new InitialiseDownloadsDirectory);
|
||||
// Run the console application
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
$status = $kernel->handle(
|
||||
$input = new ArgvInput,
|
||||
new ConsoleOutput
|
||||
);
|
||||
|
||||
$app->add(new Initialise);
|
||||
$app->add(new UpdateAppList);
|
||||
$app->add(new SearchApps);
|
||||
$app->add(new QueueApp);
|
||||
$app->add(new QueuePopularApps);
|
||||
$app->add(new ShowQueue);
|
||||
$app->add(new StartDownloading);
|
||||
$app->add(new AuthoriseAccount);
|
||||
$app->add(new Dequeue);
|
||||
$app->add(new Requeue);
|
||||
|
||||
// Run the console app
|
||||
$app->run(new ArgvInput(), new ConsoleOutput());
|
||||
// Send output to the console once finished
|
||||
$kernel->terminate($input, $status);
|
||||
exit($status);
|
||||
|
|
37
src/Console/Kernel.php
Normal file
37
src/Console/Kernel.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Zeropingheroes\LancacheAutofill\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
use Zeropingheroes\LancacheAutofill\Commands\Steam\{
|
||||
AuthoriseAccount, Dequeue, Initialise, QueueApp, QueuePopularApps, QueueUsersApps, Requeue, SearchApps, ShowQueue, StartDownloading, UpdateAppList
|
||||
};
|
||||
use Zeropingheroes\LancacheAutofill\Commands\App\{
|
||||
InitialiseDatabase, InitialiseDownloadsDirectory
|
||||
};
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
InitialiseDatabase::class,
|
||||
InitialiseDownloadsDirectory::class,
|
||||
|
||||
Initialise::class,
|
||||
UpdateAppList::class,
|
||||
SearchApps::class,
|
||||
QueueApp::class,
|
||||
QueuePopularApps::class,
|
||||
QueueUsersApps::class,
|
||||
ShowQueue::class,
|
||||
StartDownloading::class,
|
||||
AuthoriseAccount::class,
|
||||
Dequeue::class,
|
||||
Requeue::class,
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue