Class: Jets::Git::User
- Inherits:
-
Object
show all
- Extended by:
- Memoist
- Includes:
- GitCli
- Defined in:
- lib/jets/git/user.rb
Instance Method Summary
collapse
Methods included from GitCli
#git, #git?, #git_commits?, #git_folder?, #git_installed?
Instance Method Details
#first_name ⇒ Object
6
7
8
|
# File 'lib/jets/git/user.rb', line 6
def first_name
name.split(" ").first if name end
|
#git_config ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/jets/git/user.rb', line 20
def git_config
return {} if ENV["JETS_GIT_DISABLED"]
return {} unless git?
list = git("config --list")
lines = list.split("\n")
lines.select! { |l| l =~ /^user\./ }
lines.map { |l| l.split("=") }.to_h
end
|
#name ⇒ Object
10
11
12
|
# File 'lib/jets/git/user.rb', line 10
def name
saved[:git_user] || git_config["user.name"]
end
|
#saved ⇒ Object
14
15
16
17
18
|
# File 'lib/jets/git/user.rb', line 14
def saved
return {} unless File.exist?(".jets/gitinfo.yml")
data = YAML.load_file(".jets/gitinfo.yml")
ActiveSupport::HashWithIndifferentAccess.new(data)
end
|