Skip to content

Commit

Permalink
Add simple license check (#143)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Varga <[email protected]>
Co-authored-by: Jack McDade <[email protected]>
  • Loading branch information
3 people authored Aug 11, 2023
1 parent 740d414 commit 23543aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Commands/StaticSiteGenerate.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ public function handle()
{
Partyline::bind($this);

if (config('statamic.editions.pro') && ! config('statamic.system.license_key')) {
$this->error('Statamic Pro is enabled but no site license was found.');
$this->warn('Please set a valid Statamic License Key in your .env file.');
$confirmationText = 'By continuing you agree that this build is for testing purposes only. Do you wish to continue?';

if (! $this->option('no-interaction') && ! $this->confirm($confirmationText)) {
$this->line('Static site generation canceled.');

return 0;
}
}

if (! $workers = $this->option('workers')) {
$this->comment('You may be able to speed up site generation significantly by installing spatie/fork and using multiple workers (requires PHP 8+).');
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Concerns/RunsGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ protected function generate($options = [])
{
$this->assertFalse($this->files->exists($this->destination));

$options['--no-interaction'] ??= true;

$this
->artisan('statamic:ssg:generate', $options)
->doesntExpectOutputToContain('pages not generated');
Expand Down

0 comments on commit 23543aa

Please sign in to comment.