homebysix / recipe-robot

A kick ass tool for creating AutoPkg recipes.
Apache License 2.0
301 stars 28 forks source link

Have RecipeIdentifierPrefix default to git user or mac user #63

Closed jgstew closed 8 years ago

jgstew commented 8 years ago

The function defined here is used to define the user identifier for the autopkg recipes: https://github.com/homebysix/recipe-robot/blob/master/scripts/recipe-robot#L372

It defaults to: com.github.your_name_here

It would be interesting if it could default to: com.github.(configured git user)

Typically this is contained in the file: ~/.gitconfig or ~/.config/git/config or /etc/gitconfig

The format is like an INI file, with sections, keys, values:

[user]
    name = jgstew

Or else, it would default to: com.github.( os.getusername() )

com.github.your_name_here could be a fall back value.

References:

jgstew commented 8 years ago

On a side note, I created this: http://orteil.dashnet.org/experiments/randomgen/?gen=https://gist.githubusercontent.com/jgstew/2edcb5b79c9d435d3c91/raw/39814518d78cf212ab7044d3eabf359e9259cecc/random_robot.txt

The repo is here: https://gist.github.com/jgstew/2edcb5b79c9d435d3c91

Based upon: http://pastebin.com/raw.php?i=nqQSHHbj

homebysix commented 8 years ago

@jgstew I think the problem is that the name in the gitconfig file is arbitrary. Yours may match your GitHub username, but mine is Elliot Jordan.

In fact, I can't find any instance of my GitHub username in a predictable preference or config file on my Mac. I suspect GitHub uses the email address to refer to me, and GitHub's website/app does the translation from email to username.

I agree that using your local Mac shortname is better than your_name_here (a string that was chosen specifically because it didn't match any existing GitHub user, but who knows how long that will remain true).

jgstew commented 8 years ago

GitHub does not allow hyphens in the username, so your_name_here is an invalid option, which is probably a good thing in this case.