-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid empty author and email #5355
Conversation
src/compiler/crystal/tools/init.cr
Outdated
end | ||
|
||
def self.fetch_github_name | ||
default = "[your-github-name]" | ||
default = "your-github-name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep brackets as an easy placeholder designation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sija Yeah I wanted to keep brackets too, but then it will fail to parse shard.yml
authors:
- [your-name-here] <[your-email-here]>
Outputs:
in /home/main/blog/shard.yml: Expected SCALAR but was SEQUENCE_START at line 5, column 5
3.
4. authors:
5. - [your-name-here] <[your-email-here]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just quote it in the ECR
file?
@@ -44,17 +44,21 @@ module Crystal | |||
end | |||
|
|||
def self.fetch_author | |||
return "[your-name-here]" unless system(WHICH_GIT_COMMAND) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if system(WHICH_GIT COMMAND)
user_name = `git config --get user.name`.strip
user_name = nil if user_name.empty?
end
user_name || "[your-name-here]"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
src/compiler/crystal/tools/init.cr
Outdated
end | ||
|
||
def self.fetch_email | ||
return "[your-email-here]" unless system(WHICH_GIT_COMMAND) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
src/compiler/crystal/tools/init.cr
Outdated
github_name = `git config --get github.name`.strip | ||
github_name = nil if github_name.empty? | ||
end | ||
github_name || "your-github-here" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your-github-here
-> your-github-name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@RX14 Can this PR get merged before |
@faustinoaq no because 0.24.1 has already been tagged. |
User may not also have
user.email
anduser.name
configured, sofetch_email
andfetch_author
will return an empty string (instead of"[your-email-here]"
or"[your-name-here]"
).Suggested on amberframework/amber#434 (comment)