From fab3da8f7f70a65796c4e9c1c17bc798e2f5e807 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Fri, 9 Aug 2019 10:13:55 +0800 Subject: [PATCH] Refactor --- .../{ExecuteInstallation.php => BsInstallCommand.php} | 8 ++------ .../{DisablePlugin.php => PluginDisableCommand.php} | 2 +- .../{EnablePlugin.php => PluginEnableCommand.php} | 2 +- app/Console/Kernel.php | 6 +++--- ...DisablePluginTest.php => PluginDisableCommandTest.php} | 2 +- .../{EnablePluginTest.php => PluginEnableCommandTest.php} | 2 +- 6 files changed, 9 insertions(+), 13 deletions(-) rename app/Console/Commands/{ExecuteInstallation.php => BsInstallCommand.php} (87%) rename app/Console/Commands/{DisablePlugin.php => PluginDisableCommand.php} (93%) rename app/Console/Commands/{EnablePlugin.php => PluginEnableCommand.php} (93%) rename tests/CommandsTest/{DisablePluginTest.php => PluginDisableCommandTest.php} (86%) rename tests/CommandsTest/{EnablePluginTest.php => PluginEnableCommandTest.php} (86%) diff --git a/app/Console/Commands/ExecuteInstallation.php b/app/Console/Commands/BsInstallCommand.php similarity index 87% rename from app/Console/Commands/ExecuteInstallation.php rename to app/Console/Commands/BsInstallCommand.php index 55bf2f4f..ba301480 100644 --- a/app/Console/Commands/ExecuteInstallation.php +++ b/app/Console/Commands/BsInstallCommand.php @@ -5,7 +5,7 @@ namespace App\Console\Commands; use App\Models\User; use Illuminate\Console\Command; -class ExecuteInstallation extends Command +class BsInstallCommand extends Command { protected $signature = 'bs:install {email} {password} {nickname}'; @@ -27,11 +27,7 @@ class ExecuteInstallation extends Command $this->call('jwt:secret', ['--no-interaction' => true]); $this->call('passport:keys', ['--no-interaction' => true]); - $siteUrl = url('/'); - if (ends_with($siteUrl, '/index.php')) { - $siteUrl = substr($siteUrl, 0, -10); - } - option(['site_url' => $siteUrl]); + option(['site_url' => url('/')]); $admin = new User; $admin->email = $this->argument('email'); diff --git a/app/Console/Commands/DisablePlugin.php b/app/Console/Commands/PluginDisableCommand.php similarity index 93% rename from app/Console/Commands/DisablePlugin.php rename to app/Console/Commands/PluginDisableCommand.php index 941f6a35..1424bd95 100644 --- a/app/Console/Commands/DisablePlugin.php +++ b/app/Console/Commands/PluginDisableCommand.php @@ -5,7 +5,7 @@ namespace App\Console\Commands; use App\Services\PluginManager; use Illuminate\Console\Command; -class DisablePlugin extends Command +class PluginDisableCommand extends Command { /** * The name and signature of the console command. diff --git a/app/Console/Commands/EnablePlugin.php b/app/Console/Commands/PluginEnableCommand.php similarity index 93% rename from app/Console/Commands/EnablePlugin.php rename to app/Console/Commands/PluginEnableCommand.php index aa7f8c8e..9beb1b94 100644 --- a/app/Console/Commands/EnablePlugin.php +++ b/app/Console/Commands/PluginEnableCommand.php @@ -5,7 +5,7 @@ namespace App\Console\Commands; use App\Services\PluginManager; use Illuminate\Console\Command; -class EnablePlugin extends Command +class PluginEnableCommand extends Command { /** * The name and signature of the console command. diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index a5dbd4f5..2f52666a 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -17,9 +17,9 @@ class Kernel extends ConsoleKernel Commands\SaltRandomCommand::class, Commands\MigratePlayersTable::class, Commands\MigrateCloset::class, - Commands\ExecuteInstallation::class, + Commands\BsInstallCommand::class, Commands\RegressLikesField::class, - Commands\EnablePlugin::class, - Commands\DisablePlugin::class, + Commands\PluginEnableCommand::class, + Commands\PluginDisableCommand::class, ]; } diff --git a/tests/CommandsTest/DisablePluginTest.php b/tests/CommandsTest/PluginDisableCommandTest.php similarity index 86% rename from tests/CommandsTest/DisablePluginTest.php rename to tests/CommandsTest/PluginDisableCommandTest.php index 8883941b..92a5ed16 100644 --- a/tests/CommandsTest/DisablePluginTest.php +++ b/tests/CommandsTest/PluginDisableCommandTest.php @@ -4,7 +4,7 @@ namespace Tests; use App\Services\PluginManager; -class DisablePluginTest extends TestCase +class PluginDisableCommandTest extends TestCase { public function testDisablePlugin() { diff --git a/tests/CommandsTest/EnablePluginTest.php b/tests/CommandsTest/PluginEnableCommandTest.php similarity index 86% rename from tests/CommandsTest/EnablePluginTest.php rename to tests/CommandsTest/PluginEnableCommandTest.php index 1423504d..7759b49d 100644 --- a/tests/CommandsTest/EnablePluginTest.php +++ b/tests/CommandsTest/PluginEnableCommandTest.php @@ -4,7 +4,7 @@ namespace Tests; use App\Services\PluginManager; -class EnablePluginTest extends TestCase +class PluginEnableCommandTest extends TestCase { public function testEnablePlugin() {