You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def user_name:
(ENV['GIT_COMMITTER_NAME'] || github_user_name || `git config user.name` || `<GITHUB_USERNAME>` ).strip
end
def github_user_name
github_user_name = `security find-internet-password -s github.com | grep acct | sed 's/"acct"<blob>="//g' | sed 's/"//g'`.strip
is_valid = github_user_name.empty? or github_user_name.include? '@'
return is_valid ? nil : github_user_name
end
I'll readily admit that my understanding of this code seems to be a bit confused. The is_valid boolean seems to be checking if the username is invalid and returning nil if the username is either blank or contains an @. Despite the confusing variable name, the code seems fine to me at a glance. However on my machine:
The GIT_COMMITTER_NAME environment variable is not set
security find-internet-password -s github.com | grep acct | sed 's/"acct"<blob>="//g' | sed 's/"//g' returns [email protected]
git config user.name returns Steven Barnett
<GITHUB_USERNAME> is not a valid terminal command (and possibly shouldn't have been in back-ticks?)
Comparing that with the output in the podspec file, I can only surmise that github_user_name was returned instead of git config user.name
Furthermore, even if the bug regarding returning an e-mail is resolved, I believe that git config user.name should be favored over the security ... solution, as this uses a username set explicitly by the developer rather than attempting to infer it
The text was updated successfully, but these errors were encountered:
After creating a new pod I noticed that the
s.authors
field of the podspec file was incorrect:After tracing through the CocoaPods source code and now the pod-template source code, I found the issue in this file:
https://github.com/CocoaPods/pod-template/blob/633a6b7c870865f57680c3b6bb3dfb40f39eefcd/setup/TemplateConfigurator.rb
I'll readily admit that my understanding of this code seems to be a bit confused. The
is_valid
boolean seems to be checking if the username is invalid and returningnil
if the username is either blank or contains an@
. Despite the confusing variable name, the code seems fine to me at a glance. However on my machine:GIT_COMMITTER_NAME
environment variable is not setsecurity find-internet-password -s github.com | grep acct | sed 's/"acct"<blob>="//g' | sed 's/"//g'
returns[email protected]
git config user.name
returnsSteven Barnett
<GITHUB_USERNAME>
is not a valid terminal command (and possibly shouldn't have been in back-ticks?)Comparing that with the output in the podspec file, I can only surmise that
github_user_name
was returned instead ofgit config user.name
Furthermore, even if the bug regarding returning an e-mail is resolved, I believe that
git config user.name
should be favored over thesecurity ...
solution, as this uses a username set explicitly by the developer rather than attempting to infer itThe text was updated successfully, but these errors were encountered: