Module: Devkit::GitIdentity
- Defined in:
- lib/devkit/git_identity.rb
Class Method Summary collapse
Class Method Details
.check(identity) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/devkit/git_identity.rb', line 6 def check(identity) config = identity["Full Name"] == %x[git config --global user.name].chomp && identity["Email"] == %x[git config --global user.email].chomp && identity["Github Id"] == %x[git config --global github.user].chomp if config puts "Git config switch successfull.".green else puts "Problem switching to #{identity['Full Name']}.".red end end |
.choose(identity) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/devkit/git_identity.rb', line 23 def choose(identity) print "Switching git config to #{identity['Full Name']}, ".blue $stdout.flush system("git config --global user.name '#{identity['Full Name']}'") system("git config --global user.email #{identity['Email']}") system("git config --global github.user #{identity['Github Id']}") check(identity) end |
.drop ⇒ Object
33 34 35 36 37 38 |
# File 'lib/devkit/git_identity.rb', line 33 def drop puts "Dropping git config".blue system("git config --global --unset-all user.name") system("git config --global --unset-all user.email") system("git config --global --unset-all github.user") end |
.status ⇒ Object
18 19 20 21 |
# File 'lib/devkit/git_identity.rb', line 18 def status username = `git config --global user.name` print username end |