Class: Git2Mite::GitRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/git2mite/git_repo.rb

Instance Method Summary collapse

Instance Method Details

#commits(start_date, end_date) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/git2mite/git_repo.rb', line 8

def commits(start_date, end_date)
  lines = []
  IO.popen("git log --pretty=format:%ai\\|%s\\|%ae --no-merges --before=#{end_date + 1} --after=#{start_date}") do |io|
    while line = io.gets
      date, message, author = line.split('|')
      lines.unshift [Date.parse(date), message.strip, author.strip]
    end
    lines
  end
end

#is_git_repo?Boolean

Returns:

  • (Boolean)


3
4
5
6
# File 'lib/git2mite/git_repo.rb', line 3

def is_git_repo?
  status = `git status 2>&1`
  !status.downcase.include?('not a git repo')
end