Module: Gas::GitConfig
- Defined in:
- lib/gas/git_config.rb
Overview
Module that class that interacts with the git config
Class Method Summary collapse
-
.change_user(user) ⇒ Object
Changes the user.
-
.current_user ⇒ Gas::User
Parse out the current user from the gitconfig.
Class Method Details
.change_user(user) ⇒ Object
Changes the user
20 21 22 23 |
# File 'lib/gas/git_config.rb', line 20 def self.change_user(user) `git config --global user.name "#{user.name}"` `git config --global user.email "#{user.email}"` end |
.current_user ⇒ Gas::User
Parse out the current user from the gitconfig
9 10 11 12 13 14 15 16 |
# File 'lib/gas/git_config.rb', line 9 def self.current_user name = `git config --global --get user.name` email = `git config --global --get user.email` return nil if name.nil? && email.nil? User.new name.delete("\n"), email.delete("\n") # git cli returns the name and email with \n at the end end |