We Recommend

Beginning Ruby: From Novice to Professional Beginning Ruby: From Novice to Professional
Beginning Ruby is a thoroughly contemporary guide for every type of reader wanting to learn Ruby, from novice programmers to web developers to Ruby newcomers. It starts by explaining the principles behind object-oriented programming and within a few chapters builds toward creating a genuine Ruby application.


Posted By

felipec on 05/16/08


Tagged

ruby git


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

georg


Ruby git changelog


Published in: Ruby 


Generates a ChangeLog from git repository.

  1. #!/usr/bin/env ruby
  2.  
  3. cmd=`git-log --pretty='format:%ci::%an <%ae>::%s'`
  4.  
  5. list = {}
  6. list_order = []
  7.  
  8. cmd.each do |l|
  9. date, author, subject = l.chomp.split("::")
  10. date, time, zone = date.split(" ")
  11.  
  12. id = "#{date}\t#{author}"
  13. if not list[id]
  14. list[id] = []
  15. list_order << {:id => id, :value => list[id]}
  16. end
  17. list[id] << subject
  18. end
  19.  
  20. # list.each do |id, value|
  21. list_order.each do |i|
  22. id = i[:id]
  23. value = i[:value]
  24.  
  25. puts "#{id}"
  26. puts value.map { |e| "\t* #{e}" }.join("\n")
  27. puts "\n"
  28. end

Report this snippet 

You need to login to post a comment.