Skip to content

Instantly share code, notes, and snippets.

@janjiss
Created July 2, 2013 10:34
Show Gist options
  • Select an option

  • Save janjiss/5908296 to your computer and use it in GitHub Desktop.

Select an option

Save janjiss/5908296 to your computer and use it in GitHub Desktop.
require "pry"
require "grit"
COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
def days_in_month(month, year = Time.now.year)
return 29 if month == 2 && Date.gregorian_leap?(year)
COMMON_YEAR_DAYS_IN_MONTH[month]
end
repo = Grit::Repo.new("/home/likewise-open/DIATOMSIA/janism/Jiff3")
commits = []
branches = [ "dev"]
branches.each_with_index do |branch, index|
commits_for_branch = repo.commits(branch, 10000).map {|commit| {:author => commit.author.to_s, :message => commit.message.to_s, :date => commit.date}}
commits.concat(commits_for_branch)
end
commits.select! {|e| e[:author].include?("Janis") && e[:date].month == Time.now.month}
commits.sort! {|x,y| x[:date] <=> y[:date]}
commits.each do |commit|
puts commit[:date].to_s
puts commit[:message]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment