Project

General

Profile

Download (1.04 KB) Statistics
| Branch: | Tag: | Revision:

foreman_docker / release / changelog @ cefce4bc

1
#!/usr/bin/env ruby
2
# Taken from foreman core (https://github.com/theforeman/foreman)
3
# changelog generates two files, Contributors and CHANGELOG with all changes
4
# from git. These should be included in every foreman-docker release.
5

    
6
cmd = `git log --pretty='format:%ci::%an <%ae>::%s'`
7

    
8
list = {}
9
list_order = []
10
contributors = []
11
changelog_file = "CHANGELOG"
12
contributors_file = "Contributors"
13

    
14
cmd.each_line do |l|
15
  date, author, subject = l.chomp.split("::")
16
  date, _time, _zone = date.split(" ")
17

    
18
  id = "#{date}\t#{author}"
19
  unless list[id]
20
    list[id] = []
21
    list_order << { :id => id, :value => list[id] }
22
  end
23
  list[id] << subject
24
  contributors << author
25
end
26

    
27
# list.each do |id, value|
28
file = File.new(changelog_file, "w")
29
list_order.each do |i|
30
  id = i[:id]
31
  value = i[:value]
32

    
33
  file.puts "#{id}"
34
  file.puts value.map { |e| "\t* #{e}" }.join("\n")
35
  file.puts "\n"
36
end
37
file.close
38
file = File.new(contributors_file, "w")
39
file.puts "Contributors (sorted alphabetically)"
40
file.puts "\n"
41
file.puts contributors.sort.uniq.join("\n")
42
file.close