edestecd / puppet-software

Puppet Module to install various Desktop Software
GNU General Public License v3.0
8 stars 7 forks source link

Global .git/config and .git/ignore #8

Closed bittner closed 6 years ago

bittner commented 7 years ago

Would it make sense to also provide the option to install system-global and user-global Git configuration, including a generic set of patterns in a global .gitignore file?

  class { 'software::vcsscm::git':
    ensure    => present,
    gitconfig => true,
    gitignore => true,
  }

This would install:

Examples

FILE: /etc/gitconfig

# System-global Git configuration. https://git-scm.com/docs/git-config#FILES

[alias]
    permission-reset = "!git diff -p | grep -E \"^(diff|old mode|new mode)\" | sed -e \"s/^old/NEW/;s/^new/old/;s/^NEW/new/\" | git apply"
    undo-commit = reset --soft HEAD^

FILE: /etc/skel/.config/git/config

# User-global Git configuration. See /etc/gitconfig for more settings.

[sequence]
    editor = emacs -nw

FILE: /etc/skel/.config/git/ignore

# Global Git Ignore. https://git-scm.com/docs/gitignore

# Special files and folder of various OSes
.AppleDesktop
.AppleDB
.AppleDouble
.apdisk
.com.apple.timemachine.donotpresent
Desktop.ini
.directory
*.DS_Store
.fseventsd
.fuse_hidden*
.LSOverride
Network Trash Folder
.nfs*
$RECYCLE.BIN/
.Spotlight-V100
.TemporaryItems
Temporary Items
.Trash-*
.Trashes
.VolumeIcon.icns

# Various cache files and folders
.cache
.eggs/
*.egg-info/
.eslintcache
Thumbs.db
webassets-cache

# Build files and folders
**/material-design-icons/*/ios/*.imageset/Contents.json
**/material-design-icons/sprites/
**/material-design-icons/iconfont/
**/material-design-icons/*/drawable-anydpi-v21/*.xml
**/material-design-icons/**/*.png
**/material-design-icons/*/svg/design/*.svg
__pycache__/
*.py[cod]
*$py.class

# Editor and IDE files and folders
.idea
*.stTheme.cache
*.sublime-project
*.sublime-workspace
*.tmlanguage.cache
*.tmPreferences.cache
GitHub.sublime-settings

# Environments
.env
.venv
env/
venv/
ENV/

References

bittner commented 7 years ago

@edestecd If that's roughly okay for you I'd prepare another PR.

edestecd commented 7 years ago

Yea, managing git config files seams like a nice feature to add.

Could gitconfig or gitignore be a hash or path to a template. I'm not sure what defaults would be sensible for everyone. I assume many may want different settings there.

bittner commented 7 years ago

Difficult to say. What would you suggest in detail?

I would start just with files, and later extend the feature set to a dictionary that allows to set details of those files (technically by help of a template). -- Update: That seems complicated. Your idea is much better: Allow gitconfig and gitignore to be file or Puppet URL values.

bittner commented 6 years ago

Yay! :tada: -- Thanks for your awesome support!