Module: Utilities

Included in:
Worklog::CLI
Defined in:
lib/git/worklog.rb

Instance Method Summary collapse

Instance Method Details

#default_git_emailObject



12
13
14
# File 'lib/git/worklog.rb', line 12

def default_git_email
  `git config user.email`.strip
end

#default_git_userObject



16
17
18
# File 'lib/git/worklog.rb', line 16

def default_git_user
  "#{default_git_username} <#{default_git_email}>"
end

#default_git_usernameObject



8
9
10
# File 'lib/git/worklog.rb', line 8

def default_git_username
  `git config user.name`.strip
end

#pwdObject



24
25
26
# File 'lib/git/worklog.rb', line 24

def pwd
  `pwd`
end

#reposObject



20
21
22
# File 'lib/git/worklog.rb', line 20

def repos
  `find . -type d -exec test -e '{}/.git' ';' -print -prune`.split("\n")
end

#root_repository_nameObject



28
29
30
# File 'lib/git/worklog.rb', line 28

def root_repository_name
  pwd.split('/').last
end

#user(name) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/git/worklog.rb', line 32

def user(name)
  if !name.nil?
    return name
  else
    return default_git_user
  end
end