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

Add Ignition #341

Closed
wants to merge 1 commit into from
Closed
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
28 changes: 28 additions & 0 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ protected function configure()
->addOption('github', null, InputOption::VALUE_OPTIONAL, 'Create a new repository on GitHub', false)
->addOption('organization', null, InputOption::VALUE_REQUIRED, 'The GitHub organization to create the new repository for')
->addOption('database', null, InputOption::VALUE_REQUIRED, 'The database driver your application will use')
->addOption('ignition', null, InputOption::VALUE_NONE, 'Installs Ignition for an improved error page')
->addOption('stack', null, InputOption::VALUE_OPTIONAL, 'The Breeze / Jetstream stack that should be installed')
->addOption('breeze', null, InputOption::VALUE_NONE, 'Installs the Laravel Breeze scaffolding')
->addOption('jet', null, InputOption::VALUE_NONE, 'Installs the Laravel Jetstream scaffolding')
Expand Down Expand Up @@ -94,6 +95,10 @@ protected function interact(InputInterface $input, OutputInterface $output)
));
}

if (! $input->getOption('ignition')) {
$input->setOption('ignition', confirm(label: 'Would you like to install Ignition?', default: false));
}

if (! $input->getOption('breeze') && ! $input->getOption('jet')) {
match (select(
label: 'Would you like to install a starter kit?',
Expand Down Expand Up @@ -201,6 +206,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->createRepository($directory, $input, $output);
}

if ($input->getOption('ignition')) {
$this->installIgnition($directory, $input, $output);
}

if ($input->getOption('breeze')) {
$this->installBreeze($directory, $input, $output);
} elseif ($input->getOption('jet')) {
Expand Down Expand Up @@ -391,6 +400,25 @@ protected function uncommentDatabaseConfiguration(string $directory)
);
}

/**
* Install Laravel Ignition into the application.
*
* @param string $directory
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return void
*/
protected function installIgnition(string $directory, InputInterface $input, OutputInterface $output)
{
$commands = array_filter([
$this->findComposer().' require spatie/laravel-ignition --dev',
]);

$this->runCommands($commands, $input, $output, workingPath: $directory);

$this->commitChanges('Install Ignition', $directory, $input, $output);
}

/**
* Install Laravel Breeze into the application.
*
Expand Down