diff --git a/resources/views/components/new-line.php b/resources/views/components/new-line.php
new file mode 100644
index 00000000..7c89b545
--- /dev/null
+++ b/resources/views/components/new-line.php
@@ -0,0 +1 @@
+
diff --git a/src/Console/Thanks.php b/src/Console/Thanks.php
index 5f418f21..10583b41 100644
--- a/src/Console/Thanks.php
+++ b/src/Console/Thanks.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Pest\Console;
+use Pest\Support\View;
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\OutputInterface;
@@ -15,18 +16,14 @@ use Symfony\Component\Console\Question\ConfirmationQuestion;
final class Thanks
{
/**
- * The Command messages.
+ * The support options.
*
- * @var array
+ * @var array
*/
private const FUNDING_MESSAGES = [
- '',
- ' - Star or contribute to Pest:',
- ' https://github.com/pestphp/pest>',
- ' - Tweet something about Pest on Twitter:',
- ' https://twitter.com/pestphp>',
- ' - Sponsor the creator:',
- ' https://github.com/sponsors/nunomaduro>',
+ 'Star the project on GitHub' => 'https://github.com/pestphp/pest',
+ 'Tweet about the project' => 'https://twitter.com/pestphp',
+ 'Sponsor the project' => 'https://github.com/sponsors/nunomaduro',
];
/**
@@ -46,7 +43,7 @@ final class Thanks
new ArrayInput([]),
$this->output,
new ConfirmationQuestion(
- 'Can you quickly star our GitHub repository>? 🙏🏻',
+ ' Would you like to show your support by starring the project on GitHub?>',
true,
)
);
@@ -63,8 +60,15 @@ final class Thanks
}
}
- foreach (self::FUNDING_MESSAGES as $message) {
- $this->output->writeln($message);
+ View::render('components.new-line');
+
+ foreach (self::FUNDING_MESSAGES as $message => $link) {
+ View::render('components.two-column-detail', [
+ 'left' => $message,
+ 'right' => $link,
+ ]);
}
+
+ View::render('components.new-line');
}
}
diff --git a/src/Plugins/Init.php b/src/Plugins/Init.php
index 4650d117..641012e6 100644
--- a/src/Plugins/Init.php
+++ b/src/Plugins/Init.php
@@ -6,6 +6,7 @@ namespace Pest\Plugins;
use Pest\Console\Thanks;
use Pest\Contracts\Plugins\HandlesArguments;
+use Pest\Support\View;
use Pest\TestSuite;
use Symfony\Component\Console\Output\OutputInterface;
@@ -61,61 +62,37 @@ final class Init implements HandlesArguments
$testsBaseDir = "{$this->testSuite->rootPath}/tests";
if (! is_dir($testsBaseDir)) {
- if (! mkdir($testsBaseDir) && ! is_dir($testsBaseDir)) {
- $this->output->writeln(sprintf(
- "\n ERROR > Directory `%s` was not created.>",
- $testsBaseDir
- ));
-
- return;
- }
-
- $this->output->writeln(
- ' DONE > Created `tests` directory.>',
- );
+ mkdir($testsBaseDir);
}
+ $this->output->writeln([
+ '',
+ ' INFO > Preparing tests directory.>',
+ '',
+ ]);
+
foreach (self::STUBS as $from => $to) {
$fromPath = __DIR__."/../../stubs/init/{$from}";
$toPath = "{$this->testSuite->rootPath}/{$to}";
if (file_exists($toPath)) {
- $this->output->writeln(sprintf(
- ' INFO > File `%s` already exists, skipped.>',
- $to
- ));
+ View::render('components.two-column-detail', [
+ 'left' => $to,
+ 'right' => 'File already exists.',
+ ]);
continue;
}
- if ($from === 'phpunit.xml' && file_exists($toPath.'.dist')) {
- $this->output->writeln(sprintf(
- ' INFO > File `%s` already exists, skipped.>',
- $to.'.dist'
- ));
+ copy($fromPath, $toPath);
- continue;
- }
-
- if (! copy($fromPath, $toPath)) {
- $this->output->writeln(sprintf(
- '[WARNING] Failed to copy stub `%s` to `%s`>',
- $from,
- $toPath
- ));
-
- continue;
- }
-
- $this->output->writeln(sprintf(
- ' DONE > Created `%s` file.>',
- $to
- ));
+ View::render('components.two-column-detail', [
+ 'left' => $to,
+ 'right' => 'File created.',
+ ]);
}
- $this->output->writeln(
- "\n DONE > Pest initialised.>\n",
- );
+ View::render('components.new-line');
(new Thanks($this->output))();