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 the setup command #33

Merged
merged 2 commits into from
Jun 22, 2020
Merged
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
27 changes: 13 additions & 14 deletions src/Console/Commands/SetupProduction.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public function handle(): void
$this->checkAdminUserAccount();
$this->checkVendorAssets();

$this->line('');
$this->info('Your application is ready!');
$this->info('✅ Your application is ready!');
$this->line('');
}

Expand All @@ -61,15 +60,15 @@ public function handle(): void
protected function checkEnvironment(): void
{
if (file_exists(base_path('.env'))) {
$this->line('✅ .env file already exists');
$this->info('✅ .env file already exists');

return;
}

$createFile = $this->confirm('The .env file does not yet exist. Would you like to create it now?', true);

if ($createFile && copy(base_path('.env.example'), base_path('.env'))) {
$this->line('✅ .env file has been created');
$this->info('✅ .env file has been created');
$this->call('key:generate');

return;
Expand All @@ -90,7 +89,7 @@ protected function checkApplicationKey(): void
$this->call('key:generate');
}

$this->line('✅ Application key has been set');
$this->info('✅ Application key has been set');
}

/**
Expand All @@ -99,7 +98,7 @@ protected function checkApplicationKey(): void
protected function checkAppUrl(): void
{
if (config('app.url') !== 'http://localhost') {
$this->line('✅ Application url set to ' . config('app.url'));
$this->info('✅ Application url set to ' . config('app.url'));

return;
}
Expand All @@ -114,7 +113,7 @@ protected function checkDatabaseConnection(): void
{
try {
DB::connection()->getPdo();
$this->line('✅ Database connection successful.');
$this->info('✅ Database connection successful.');
} catch (Exception $e) {
try {
if (!$this->createDatabaseCredentials()) {
Expand Down Expand Up @@ -183,7 +182,7 @@ protected function createDatabaseCredentials(): bool
protected function checkMigrations(): void
{
if (!$this->pendingMigrations()) {
$this->line('✅ Database migrations are up to date');
$this->info('✅ Database migrations are up to date');

return;
}
Expand All @@ -210,7 +209,7 @@ protected function runMigrations(): bool
}

$this->call('migrate');
$this->line('✅ Database migrations successful');
$this->info('✅ Database migrations successful');

return true;
}
Expand All @@ -221,7 +220,7 @@ protected function runMigrations(): bool
protected function checkAdminUserAccount(): void
{
if (User::count()) {
$this->line('✅ Admin user account exists');
$this->info('✅ Admin user account exists');

return;
}
Expand All @@ -238,7 +237,7 @@ protected function checkAdminUserAccount(): void
protected function getCompanyName(): string
{
$this->line('');
$this->info('Creating first admin user account and company/workspace');
$this->line('Creating first admin user account and company/workspace');
$companyName = $this->ask('Company/Workspace name');

if (!$companyName) {
Expand All @@ -254,7 +253,7 @@ protected function getCompanyName(): string
protected function createAdminUserAccount(string $companyName): User
{
$this->line('');
$this->info('Create the administrator user account');
$this->line('Create the administrator user account');

$name = $this->getUserParam('name');
$email = $this->getUserParam('email');
Expand Down Expand Up @@ -323,13 +322,13 @@ protected function storeWorkspace(User $user, string $companyName): Workspace
*/
protected function checkVendorAssets(): void
{
$this->call('vendor:publish', [
$this->callSilent('vendor:publish', [
'--provider' => SendportalBaseServiceProvider::class,
'--tag' => 'sendportal-assets',
'--force' => true
]);

$this->info('Published frontend assets');
$this->info('Published frontend assets');
}

/**
Expand Down