Class: GitConfig
- Inherits:
-
StationModule
- Object
- StationModule
- GitConfig
- Defined in:
- lib/vagrant/conductor/modules/git-config/git-config.rb
Overview
todo: add option for mapping local .git-config file
Instance Method Summary collapse
- #fill(hash, global = false, path = '~/') ⇒ Object
- #provision ⇒ Object
- #set(key, value, global = false, path = '~/') ⇒ Object
Instance Method Details
#fill(hash, global = false, path = '~/') ⇒ Object
13 14 15 16 17 |
# File 'lib/vagrant/conductor/modules/git-config/git-config.rb', line 13 def fill(hash, global = false, path = '~/') hash.each do |key, value| set(key, value, global, path) end end |
#provision ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vagrant/conductor/modules/git-config/git-config.rb', line 19 def provision # Delete existing global .gitconfig file shell_provision(' echo "Setting git config" home=$(sudo -u vagrant pwd) if [ -f $home/.gitconfig ]; then rm -f $home/.gitconfig fi ') if args.is_a? String shell_provision( "echo \"$1\" > .gitconfig", [File.read(File.(args))], false ) elsif args.is_a? Hash fill(args, true) end end |
#set(key, value, global = false, path = '~/') ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/vagrant/conductor/modules/git-config/git-config.rb', line 4 def set(key, value, global = false, path = '~/') Station.module('commands').execute( "git config #{global ? '--global' : ''} #{key} \"#{value}\"", path ) end |