Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f8219f0
require prompts
jasonvarga Aug 4, 2023
a67c889
wip
jasonvarga Aug 4, 2023
9dcc4ef
hot pink
jasonvarga Aug 4, 2023
3ef198a
get starter kits from statamic.com
jasonvarga Aug 11, 2023
6261570
format the suggestions a bit nicer
jasonvarga Aug 11, 2023
111014f
prompt starring
jasonvarga Aug 11, 2023
47e14da
prompt making user
jasonvarga Aug 11, 2023
ec0ecb4
prompt entering license key
jasonvarga Aug 11, 2023
b03109f
prompt single site license installation
jasonvarga Aug 11, 2023
f036a5b
remove whitespace after composer install
jasonvarga Aug 11, 2023
8f41edb
Create a super is now default
jackmcdade Aug 11, 2023
72bd5d8
New ASCII art
jackmcdade Aug 11, 2023
3cce035
Slightly tweak HotPink for contrast, also use Teal
jackmcdade Aug 11, 2023
c65d047
Go teal here too
jackmcdade Aug 11, 2023
223ef19
👋 💖
jackmcdade Aug 11, 2023
52104d2
Ask to make user ahead of time
jasonvarga Aug 11, 2023
e29c972
Ask to spread joy earlier, and open the browser while composer runs. …
jasonvarga Aug 11, 2023
a6abc27
use package
jasonvarga Aug 11, 2023
ac315ba
adjust output
jasonvarga Aug 11, 2023
13f9ad2
add initialize and interact methods, and add name text field when mis…
jasonvarga Aug 14, 2023
b0893e9
fallback
jasonvarga Aug 14, 2023
35f5e95
wip
jasonvarga Aug 14, 2023
15d55e7
wip
jasonvarga Aug 14, 2023
0a6b576
push to the right a couple of spaces to line up with prompts
jasonvarga Aug 14, 2023
533d846
space
jasonvarga Aug 14, 2023
fe06da2
put user creation back to no as the default
jasonvarga Aug 14, 2023
870e12e
output a line when you dont choose to star
jasonvarga Aug 14, 2023
9612689
nah
jasonvarga Aug 14, 2023
932d1ba
words
jasonvarga Aug 14, 2023
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
Prev Previous commit
Next Next commit
Ask to spread joy earlier, and open the browser while composer runs. …
…Adjust little bits.
  • Loading branch information
jasonvarga committed Aug 11, 2023
commit e29c972009b0cadac2f5cb17bf17e20a7382be9f
59 changes: 44 additions & 15 deletions src/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class NewCommand extends Command
public $baseInstallSuccessful;
public $shouldUpdateCliToVersion = false;
public $makeUser = false;
public $spreadJoy = false;

/**
* Configure the command options.
Expand Down Expand Up @@ -91,13 +92,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
->askForRepo()
->validateStarterKitLicense()
->askToMakeSuperUser()
->askToSpreadJoy()
->readySetGo()
->installBaseProject()
->installStarterKit()
->makeSuperUser()
->notifyIfOldCliVersion()
->showSuccessMessage()
->showPostInstallInstructions()
->askToSpreadJoy();
->showPostInstallInstructions();

return 0;
}
Expand Down Expand Up @@ -393,6 +395,34 @@ protected function confirmSingleSiteLicense()
return $this;
}

/**
* Final confirmation
*
* @return $this
*/
protected function readySetGo()
{
if (! $this->input->isInteractive()) {
return $this;
}

if (! confirm('Ready?', yes: "Let's do this!")) {
return $this->exitInstallation();
}

if ($this->spreadJoy) {
if (PHP_OS_FAMILY == 'Darwin') {
exec('open https://github.com/statamic/cms');
} elseif (PHP_OS_FAMILY == 'Windows') {
exec('start https://github.com/statamic/cms');
} elseif (PHP_OS_FAMILY == 'Linux') {
exec('xdg-open https://github.com/statamic/cms');
}
}

return $this;
}

/**
* Install base project.
*
Expand Down Expand Up @@ -491,8 +521,8 @@ protected function askToMakeSuperUser()
$this->makeUser = confirm('Create a super user?', true);

$this->output->write($this->makeUser
? "Great. You'll be prompted for details after installation."
: 'No problem. You can create one later with <comment>php please make:user</comment>.'
? " Great. You'll be prompted for details after installation."
: ' No problem. You can create one later with <comment>php please make:user</comment>.'
);

$this->output->write(PHP_EOL.PHP_EOL);
Expand Down Expand Up @@ -623,6 +653,10 @@ protected function showSuccessMessage()
{
$this->output->writeln(PHP_EOL."<info>[✔] Statamic has been successfully installed into the <comment>{$this->relativePath}</comment> directory.</info>");

if (! $this->spreadJoy) {
$this->output->writeln('Spread some joy and star our GitHub repo! https://github.com/statamic/cms');
}

$this->output->writeln('Build something rad!');

return $this;
Expand Down Expand Up @@ -659,18 +693,13 @@ protected function askToSpreadJoy()
return $this;
}

$this->output->write(PHP_EOL);

if (! confirm('Would you like to spread the joy of Statamic by starring the repo?', false, 'Absolutely', 'Maybe later')) {
return $this;
}
$response = select('Would you like to spread the joy of Statamic by starring the repo?', [
$yes = "Absolutely. I'll star it while you finish installing.",
$no = 'Maybe later',
], $no);

if (PHP_OS_FAMILY == 'Darwin') {
exec('open https://github.com/statamic/cms');
} elseif (PHP_OS_FAMILY == 'Windows') {
exec('start https://github.com/statamic/cms');
} elseif (PHP_OS_FAMILY == 'Linux') {
exec('xdg-open https://github.com/statamic/cms');
if ($this->spreadJoy = $response === $yes) {
$this->output->write(' Awesome. The browser will open when the installation begins.'.PHP_EOL.PHP_EOL);
}

return $this;
Expand Down