Module: GitPair::Config
Instance Method Summary collapse
- #add_author(author) ⇒ Object
- #all_author_strings ⇒ Object
- #current_author ⇒ Object
- #current_email ⇒ Object
- #default_email ⇒ Object
- #pair_email ⇒ Object
- #remove_author(name) ⇒ Object
- #reset ⇒ Object
- #set_pair_email(email) ⇒ Object
- #switch(authors) ⇒ Object
Instance Method Details
#add_author(author) ⇒ Object
13 14 15 16 17 |
# File 'lib/git-pair/config.rb', line 13 def () unless Author.exists?() `git config --global --add git-pair.authors "#{.name} <#{.email}>"` end end |
#all_author_strings ⇒ Object
5 6 7 |
# File 'lib/git-pair/config.rb', line 5 def `git config --global --get-all git-pair.authors`.split("\n") end |
#current_author ⇒ Object
37 38 39 |
# File 'lib/git-pair/config.rb', line 37 def `git config --get user.name`.strip end |
#current_email ⇒ Object
41 42 43 |
# File 'lib/git-pair/config.rb', line 41 def current_email `git config --get user.email`.strip end |
#default_email ⇒ Object
33 34 35 |
# File 'lib/git-pair/config.rb', line 33 def default_email `git config --global --get user.email`.strip end |
#pair_email ⇒ Object
45 46 47 |
# File 'lib/git-pair/config.rb', line 45 def pair_email `git config --global --get git-pair.email`.strip end |
#remove_author(name) ⇒ Object
19 20 21 22 |
# File 'lib/git-pair/config.rb', line 19 def (name) `git config --global --unset-all git-pair.authors "^#{name} <"` `git config --global --remove-section git-pair` if .empty? end |
#reset ⇒ Object
29 30 31 |
# File 'lib/git-pair/config.rb', line 29 def reset `git config --remove-section user` end |
#set_pair_email(email) ⇒ Object
49 50 51 |
# File 'lib/git-pair/config.rb', line 49 def set_pair_email(email) `git config --global git-pair.email "#{email}"` end |
#switch(authors) ⇒ Object
24 25 26 27 |
# File 'lib/git-pair/config.rb', line 24 def switch() `git config user.name "#{.map { |a| a.name }.join(' & ')}"` `git config user.email "#{Author.email_address_for()}"` end |