1234567891011121314151617181920212223242526272829303132 |
- #
- # Cookbook:: workstation
- # Recipe:: _git
- #
- # Copyright:: 2022, The Authors, All Rights Reserved.
- include_recipe %w{git hub}
- include_recipe 'workstation::_user'
- include_recipe 'workstation::_ssh-ident'
- username = node['my_workstation']['default_user'].first[0]
- node['workstation']['_git']['scope'].each do |scope_git, git_options|
- if scope_git.match(/^file_/)
- gitconfig_file = $' # String after the match (ref: https://ruby-doc.org/core-2.5.1/Regexp.html#class-Regexp-label-Special+global+variables)
- scope_git = 'file'
- end
- git_options.each do |k, v|
- git_config k do
- value v.to_s
- scope scope_git
- user username if %w{global file}.include?(scope_git)
- config_file gitconfig_file if scope_git == 'file'
- end
- end
- end
- directory node['workstation']['_git']['hooksPath'] do
- recursive true
- end
|