Ruby git changelog


/ Published in: Ruby
Save to your folder(s)

Generates a ChangeLog from git repository.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.