mirror of
https://github.com/jbcr/core.git
synced 2026-03-24 17:02:13 +01:00
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Bolt\ComposerScripts;
|
|
|
|
use Composer\Script\Event;
|
|
|
|
class CreateProjectScript extends Script
|
|
{
|
|
public static function execute(Event $event): void
|
|
{
|
|
parent::init('Running composer "post-create-project-cmd" scripts');
|
|
|
|
self::deleteGitignore();
|
|
self::createReadme();
|
|
|
|
chdir(parent::getProjectFolder($event));
|
|
|
|
self::run('php bin/console bolt:reset-secret');
|
|
self::run('php bin/console bolt:copy-themes --ansi');
|
|
if (self::isTtySupported()) {
|
|
self::run('php bin/console bolt:welcome --ansi');
|
|
}
|
|
}
|
|
|
|
private static function deleteGitignore(): void
|
|
{
|
|
if (file_exists('public/.gitignore')) {
|
|
unlink('public/.gitignore');
|
|
}
|
|
if (file_exists('config/extensions/.gitignore')) {
|
|
unlink('config/extensions/.gitignore');
|
|
}
|
|
}
|
|
|
|
private static function createReadme(): void
|
|
{
|
|
if (file_exists('README_project.md')) {
|
|
rename('README_project.md', 'README.md');
|
|
}
|
|
}
|
|
}
|