Skip to content
Draft
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
13 changes: 13 additions & 0 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function handle(): int
$this->discoverEnvironment();
$this->collectInstallationPreferences();
$this->performInstallation();
$this->displayGitignoreSuggestions();
$this->outro();

return self::SUCCESS;
Expand Down Expand Up @@ -140,6 +141,18 @@ protected function performInstallation(): void
$this->storeConfig();
}

protected function displayGitignoreSuggestions(): void
{
if (! $this->input->isInteractive()) {
return;
}

$this->newLine();
$this->info('Suggested .gitignore entry for Boost:');
$this->line('# Laravel Boost');
$this->line('boost.json');
}

protected function outro(): void
{
$url = 'https://laravel.com/docs/boost';
Expand Down
42 changes: 42 additions & 0 deletions tests/Feature/Console/InstallCommandGitignoreTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

use Laravel\Boost\Console\Enums\Theme;
use Laravel\Boost\Console\InstallCommand;
use Laravel\Boost\Install\AgentsDetector;
use Laravel\Boost\Install\Cloud;
use Laravel\Boost\Install\Nightwatch;
use Laravel\Boost\Install\Sail;
use Laravel\Boost\Support\Config;
use Laravel\Prompts\Terminal;

beforeEach(function (): void {
$this->app->instance(InstallCommand::class, new class(app(AgentsDetector::class), app(Cloud::class), app(Config::class), app(Nightwatch::class), app(Sail::class), app(Terminal::class)) extends InstallCommand
{
protected function displayBoostHeader(string $featureName, string $projectName, ?Theme $theme = null): void {}

protected function discoverEnvironment(): void {}

protected function collectInstallationPreferences(): void {}

protected function performInstallation(): void {}

protected function outro(): void {}
});
});

it('shows suggested gitignore entries in interactive installs', function (): void {
$this->artisan('boost:install')
->expectsOutputToContain('Suggested .gitignore entry for Boost:')
->expectsOutputToContain('# Laravel Boost')
->expectsOutputToContain('boost.json')
->assertSuccessful();
});

it('does not show suggested gitignore entries in non-interactive installs', function (): void {
$this->artisan('boost:install', ['--no-interaction' => true])
->doesntExpectOutputToContain('Suggested .gitignore entry for Boost:')
->doesntExpectOutputToContain('boost.json')
->assertSuccessful();
});
Loading