Skip to content
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

Merged
merged 6 commits into from Jan 2, 2018
Merged

Avoid empty author and email #5355

merged 6 commits into from Jan 2, 2018

Conversation

faustinoaq
Copy link
Contributor

User may not also have user.email and user.name configured, so fetch_email and fetch_author will return an empty string (instead of "[your-email-here]" or "[your-name-here]").

Suggested on amberframework/amber#434 (comment)

end

def self.fetch_github_name
default = "[your-github-name]"
default = "your-github-name"
Copy link
Contributor

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.

Copy link
Contributor Author

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]>

Copy link
Contributor

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)
Copy link
Contributor

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]"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

end

def self.fetch_email
return "[your-email-here]" unless system(WHICH_GIT_COMMAND)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

github_name = `git config --get github.name`.strip
github_name = nil if github_name.empty?
end
github_name || "your-github-here"
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@faustinoaq
Copy link
Contributor Author

@RX14 Can this PR get merged before v0.24.1?

@RX14
Copy link
Contributor

RX14 commented Dec 15, 2017

@faustinoaq no because 0.24.1 has already been tagged.

@RX14 RX14 added this to the Next milestone Jan 2, 2018
@RX14 RX14 merged commit 2bff41d into crystal-lang:master Jan 2, 2018
lukeasrodgers pushed a commit to lukeasrodgers/crystal that referenced this pull request Jan 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants