Class: Git
- Inherits:
-
Object
- Object
- Git
- Defined in:
- lib/git-amnesia/git.rb
Class Method Summary collapse
- .amnesia_max ⇒ Object
- .author_name ⇒ Object
- .logs(repos) ⇒ Object
- .other_dirs ⇒ Object
- .repos ⇒ Object
- .workspace ⇒ Object
Class Method Details
.amnesia_max ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/git-amnesia/git.rb', line 14 def self.amnesia_max count = `git config amnesia.count`.trim.to_i if $?.exitstatus == 0 count else @amnesia_count_default end end |
.author_name ⇒ Object
23 24 25 |
# File 'lib/git-amnesia/git.rb', line 23 def self. `git config user.name`.trim end |
.logs(repos) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/git-amnesia/git.rb', line 38 def self.logs(repos) logs = [] repos.each do |repo| cmd = "cd '#{repo}' 2>/dev/null" + " && git log --max-count=#{Git.amnesia_max} --author='#{Git.author_name}'" + " --pretty=format:'%at::#{repo.basename}::%s' 2>/dev/null" log = `#{cmd}` if $?.exitstatus == 0 logs += log.explode.map { |l| Log.new(l) } end end logs end |
.other_dirs ⇒ Object
10 11 12 |
# File 'lib/git-amnesia/git.rb', line 10 def self.other_dirs `git config dir.others | envsubst`.split_dirs.explode end |
.repos ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/git-amnesia/git.rb', line 27 def self.repos workspace = Git.workspace repos = Git.other_dirs if !workspace.empty? repos += `ls #{workspace}`.explode.map do |r| r.prepend("#{workspace}/") end end repos end |
.workspace ⇒ Object
6 7 8 |
# File 'lib/git-amnesia/git.rb', line 6 def self.workspace `git config dir.workspace | envsubst`.trim end |