diff --git a/composer.json b/composer.json index 6a42c21..b516d75 100644 --- a/composer.json +++ b/composer.json @@ -41,6 +41,9 @@ "test": [ "vendor/bin/phpcs" ], - "post-create-project-cmd": "Roots\\Sage\\PostCreateProject::removeBootstrap" + "post-create-project-cmd": [ + "Roots\\Sage\\PostCreateProject::updateHeaders", + "Roots\\Sage\\PostCreateProject::removeBootstrap" + ] } } diff --git a/src/lib/Sage/PostCreateProject.php b/src/lib/Sage/PostCreateProject.php index df9eb58..37489cb 100755 --- a/src/lib/Sage/PostCreateProject.php +++ b/src/lib/Sage/PostCreateProject.php @@ -6,11 +6,39 @@ use Composer\Script\Event; class PostCreateProject { + public static function updateHeaders(Event $event) + { + // @codingStandardsIgnoreStart + $io = $event->getIO(); + + if ($io->isInteractive()) { + $io->write('Define theme headers. Press enter key for default.'); + + $theme_headers_default = [ + 'name' => 'Sage Starter Theme', + 'uri' => 'https://roots.io/sage/', + 'description' => 'Sage is a WordPress starter theme.', + 'version' => '9.0.0-beta.2', + 'author' => 'Roots', + 'author_uri' => 'https://roots.io/' + ]; + $theme_headers = [ + 'name' => $io->ask('Theme Name ['.$theme_headers_default['name'].']: ', $theme_headers_default['name']), + 'uri' => $io->ask('Theme URI ['.$theme_headers_default['uri'].']: ', $theme_headers_default['uri']), + 'description' => $io->ask('Theme Description ['.$theme_headers_default['description'].']: ', $theme_headers_default['description']), + 'version' => $io->ask('Theme Version ['.$theme_headers_default['version'].']: ', $theme_headers_default['version']), + 'author' => $io->ask('Theme Author ['.$theme_headers_default['author'].']: ', $theme_headers_default['author']), + 'author_uri' => $io->ask('Theme Author URI ['.$theme_headers_default['author_uri'].']: ', $theme_headers_default['author_uri']) + ]; + + file_put_contents('style.css', str_replace($theme_headers_default, $theme_headers, file_get_contents('style.css'))); + } + } + public static function removeBootstrap(Event $event) { $io = $event->getIO(); - // @codingStandardsIgnoreStart if ($io->isInteractive()) { if ($io->askConfirmation('Remove Bootstrap? [y,N]? ', false)) { file_put_contents('package.json', str_replace(' "bootstrap": "^4.0.0-alpha.6",' . "\n", '', file_get_contents('package.json'))); @@ -23,6 +51,6 @@ class PostCreateProject file_put_contents('assets/styles/layouts/_header.scss', ''); } } - // @codingStandardsIgnoreEnd } + // @codingStandardsIgnoreEnd } diff --git a/style.css b/style.css index 8a395ac..23cd888 100644 --- a/style.css +++ b/style.css @@ -1,7 +1,7 @@ /* Theme Name: Sage Starter Theme Theme URI: https://roots.io/sage/ -Description: Sage is a WordPress starter theme. Contribute on GitHub +Description: Sage is a WordPress starter theme. Version: 9.0.0-beta.2 Author: Roots Author URI: https://roots.io/