Skip to content

Commit 45cc872

Browse files
committed
Fix issues + enhancements 🚀
1 parent 6baf3bc commit 45cc872

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

src/Command/Markdown/Builder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ class Builder
3333

3434
public function __construct(array $data)
3535
{
36-
$this->probjectName = $data['name'];
36+
$this->projectName = $data['name'];
3737
$this->heading = $data['heading'];
3838
$this->description = $data['description'];
39-
$this->projectRequirements = $data['requirements'];
39+
$this->requirements = $data['requirements'];
4040
$this->authorName = $data['author'];
4141
$this->authorEmail = $data['email'];
4242
$this->authorWebpage = $data['webpage'];
@@ -70,7 +70,7 @@ private function parse(string $contents): string
7070
':DESCRIPTION:',
7171
':REQUIREMENTS:',
7272
':AUTHOR-NAME:',
73-
':EMAIL:',
73+
':AUTHOR-EMAIL:',
7474
':AUTHOR-URL:',
7575
':LICENSE-NAME:',
7676
':LICENSE-LINK:',

src/Command/Markdown/Generator.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private function treatFields(InputInterface $input, OutputInterface $output): ar
7474
$name = $this->promptName($io);
7575
$heading = $this->promptHeading($io);
7676
$description = $this->promptDescription($io);
77+
$requirements = $this->promptRequirements($io);
7778
$author = $this->promptAuthor($io);
7879
$email = $this->promptEmail($io);
7980
$webpage = $this->promptHomepageUrl($io);
@@ -84,6 +85,7 @@ private function treatFields(InputInterface $input, OutputInterface $output): ar
8485
'name' => $name,
8586
'heading' => $heading,
8687
'description' => $description,
88+
'requirements' => $requirements,
8789
'author' => $author,
8890
'email' => $email,
8991
'webpage' => $webpage,
@@ -99,21 +101,21 @@ private function treatFields(InputInterface $input, OutputInterface $output): ar
99101

100102
private function promptName(SymfonyStyle $io): string
101103
{
102-
$heading = $io->ask('Project Name');
104+
$name = $io->ask('Project Name');
103105

104-
if (!$this->isFieldFilled($heading)) {
106+
if (!$this->isFieldFilled($name)) {
105107
throw new EmptyFieldException('Mention a name for your project 😺');
106108
}
107109

108-
return $heading;
110+
return $name;
109111
}
110112

111113
private function promptHeading(SymfonyStyle $io): string
112114
{
113-
$heading = $io->ask('Project Heading');
115+
$heading = $io->ask('Project Heading/Summary');
114116

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

119121
return $heading;
@@ -130,6 +132,17 @@ private function promptDescription(SymfonyStyle $io): string
130132
return $description;
131133
}
132134

135+
private function promptRequirements(SymfonyStyle $io): string
136+
{
137+
$requirements = $io->ask('Requirements / Installation?');
138+
139+
if (!$this->isFieldFilled($requirements)) {
140+
throw new EmptyFieldException('What are the requirements/Installation steps for this project?');
141+
}
142+
143+
return $requirements;
144+
}
145+
133146
private function promptAuthor(SymfonyStyle $io): string
134147
{
135148
$authorName = $io->ask('Author Name');
@@ -143,7 +156,7 @@ private function promptAuthor(SymfonyStyle $io): string
143156

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

148161
if (!$this->isFieldFilled($email)) {
149162
throw new EmptyFieldException('Author email is required.');

src/Command/Markdown/view/readme-template.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,21 @@
1818

1919
## 🪄 Author
2020

21-
I'm **[:AUTHOR-NAME:][:AUTHOR-URL:]**. A passionate, zen & dedicated software engineer 😊
21+
I'm **[:AUTHOR-NAME:](:AUTHOR-URL:)**. A passionate, zen & dedicated software engineer 😊
2222

23+
You can contact me at: *:AUTHOR-EMAIL:*
2324

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

2627
---
2728

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

3031
## 📃 License
3132

3233
pH2Gravatar is distributed under [:LICENSE-NAME:](:LICENSE-LINK:) license 🚀 Enjoy! ❤️
3334

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

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

0 commit comments

Comments
 (0)