class GitMonthCommits
Constants
- VERSION
Attributes
time[W]
Public Instance Methods
compare()
click to toggle source
# File lib/git_month_commits.rb, line 18 def compare since = nil untill = nil repo.walk(repo.last_commit).each do |commit| untill = commit if untill.nil? && commit.time < until_time break if commit.time < since_time since = commit end "#{since.oid}...#{untill.oid}" end
github_url()
click to toggle source
# File lib/git_month_commits.rb, line 8 def github_url repo_url = repo.config["remote.origin.url"] raise "not found remote.origin.url" if repo_url.nil? if match = repo_url.match(/git@github.com:(.*).git/) url = "https://github.com/#{match[1]}/compare/" end url + compare end
repo()
click to toggle source
# File lib/git_month_commits.rb, line 41 def repo @repo ||= Rugged::Repository.discover(".") end
since_time()
click to toggle source
# File lib/git_month_commits.rb, line 29 def since_time time.last_month.beginning_of_month end
time()
click to toggle source
# File lib/git_month_commits.rb, line 37 def time @time ||= Time.new end
until_time()
click to toggle source
# File lib/git_month_commits.rb, line 33 def until_time time.last_month.end_of_month end