Skip to content

Commit

Permalink
Fix issues + enhancements 馃殌
Browse files Browse the repository at this point in the history
  • Loading branch information
pH-7 committed Oct 24, 2021
1 parent 6baf3bc commit 45cc872
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/Command/Markdown/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class Builder

public function __construct(array $data)
{
$this->probjectName = $data['name'];
$this->projectName = $data['name'];
$this->heading = $data['heading'];
$this->description = $data['description'];
$this->projectRequirements = $data['requirements'];
$this->requirements = $data['requirements'];
$this->authorName = $data['author'];
$this->authorEmail = $data['email'];
$this->authorWebpage = $data['webpage'];
Expand Down Expand Up @@ -70,7 +70,7 @@ private function parse(string $contents): string
':DESCRIPTION:',
':REQUIREMENTS:',
':AUTHOR-NAME:',
':EMAIL:',
':AUTHOR-EMAIL:',
':AUTHOR-URL:',
':LICENSE-NAME:',
':LICENSE-LINK:',
Expand Down
25 changes: 19 additions & 6 deletions src/Command/Markdown/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ private function treatFields(InputInterface $input, OutputInterface $output): ar
$name = $this->promptName($io);
$heading = $this->promptHeading($io);
$description = $this->promptDescription($io);
$requirements = $this->promptRequirements($io);
$author = $this->promptAuthor($io);
$email = $this->promptEmail($io);
$webpage = $this->promptHomepageUrl($io);
Expand All @@ -84,6 +85,7 @@ private function treatFields(InputInterface $input, OutputInterface $output): ar
'name' => $name,
'heading' => $heading,
'description' => $description,
'requirements' => $requirements,
'author' => $author,
'email' => $email,
'webpage' => $webpage,
Expand All @@ -99,21 +101,21 @@ private function treatFields(InputInterface $input, OutputInterface $output): ar

private function promptName(SymfonyStyle $io): string
{
$heading = $io->ask('Project Name');
$name = $io->ask('Project Name');

if (!$this->isFieldFilled($heading)) {
if (!$this->isFieldFilled($name)) {
throw new EmptyFieldException('Mention a name for your project 馃樅');
}

return $heading;
return $name;
}

private function promptHeading(SymfonyStyle $io): string
{
$heading = $io->ask('Project Heading');
$heading = $io->ask('Project Heading/Summary');

if (!$this->isFieldFilled($heading)) {
throw new EmptyFieldException('Mention the README heading.');
throw new EmptyFieldException('Mention the README heading or a small summary.');
}

return $heading;
Expand All @@ -130,6 +132,17 @@ private function promptDescription(SymfonyStyle $io): string
return $description;
}

private function promptRequirements(SymfonyStyle $io): string
{
$requirements = $io->ask('Requirements / Installation?');

if (!$this->isFieldFilled($requirements)) {
throw new EmptyFieldException('What are the requirements/Installation steps for this project?');
}

return $requirements;
}

private function promptAuthor(SymfonyStyle $io): string
{
$authorName = $io->ask('Author Name');
Expand All @@ -143,7 +156,7 @@ private function promptAuthor(SymfonyStyle $io): string

private function promptEmail(SymfonyStyle $io): string
{
$email = $io->ask('Author Email');
$email = $io->ask('Author Email (will be also used for your gravatar)');

if (!$this->isFieldFilled($email)) {
throw new EmptyFieldException('Author email is required.');
Expand Down
10 changes: 4 additions & 6 deletions src/Command/Markdown/view/readme-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,21 @@

## 馃獎 Author

I'm **[:AUTHOR-NAME:][:AUTHOR-URL:]**. A passionate, zen & dedicated software engineer 馃槉
I'm **[:AUTHOR-NAME:](:AUTHOR-URL:)**. A passionate, zen & dedicated software engineer 馃槉

You can contact me at: *:AUTHOR-EMAIL:*

![[github-url]][github-image]][github-url]
[![:GITHUB-USERNAME:][github-image]](https://github.com/:GITHUB-USERNAME:)

---

[![:AUTHOR-NAME:](:GRAVATAR:)](:AUTHOR-URL: ":AUTHOR-NAME:, a Software Developer")
[![:AUTHOR-NAME:](:GRAVATAR-IMAGE:)](:AUTHOR-URL: ":AUTHOR-NAME:, a Software Developer")

## 馃搩 License

pH2Gravatar is distributed under [:LICENSE-NAME:](:LICENSE-LINK:) license 馃殌 Enjoy! 鉂わ笍

<!-- GitHub's Markdown reference links -->
[author-url]: :AUTHOR-URL:
[license-url]: :LICENSE-LINK:
[github-url]: https://github.com/:GITHUB-USERNAME:
[github-image]: https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white

<!-- Generated by README Generator CLI: https://github.com/pH-7 -->

0 comments on commit 45cc872

Please sign in to comment.