Class: GitCommitAutouser::Config
- Inherits:
-
Object
- Object
- GitCommitAutouser::Config
- Defined in:
- lib/git_commit_autouser/config.rb
Defined Under Namespace
Classes: User
Constant Summary collapse
- USER_CONFIG_PREFIX =
"autouser-"
Class Method Summary collapse
Class Method Details
.users ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/git_commit_autouser/config.rb', line 6 def self.users config = {} `git config --get-regexp "#{USER_CONFIG_PREFIX}.+\."`.split("\n").map do |c| c.split(" ", 2) end.each do |c| data = c.first.match(/#{USER_CONFIG_PREFIX}(.+)\.(.+)/) config[data[1]] ||= {} config[data[1]][data[2]] = c.last end config.values.map do |c| User.new.tap do |u| u.url_regexp = Regexp.new(c["url-regexp"]) u.name = c["name"] u.email = c["email"] u.hub_config = File.(c["hub_config"]) end end end |