summaryrefslogtreecommitdiff
path: root/maint
diff options
context:
space:
mode:
authorGravatar Mike Burns <mike@mike-burns.com>2014-03-19 17:44:50 +0100
committerGravatar Mike Burns <mike@mike-burns.com>2014-03-20 16:54:45 +0100
commit6dcd69174d3c0258bf525ee2a7e184b30fad0fd3 (patch)
treee5d04d144ae78df3ae27338b72c6f3ebc3207d9f /maint
parentf28664edeef1659c868780b58d8cfced88676dd1 (diff)
Generate the list of contributors from git
Instead of requiring contributors to update rcm(7), pull the list of contributors from the git log instead. The `rcm.7` file has been moved to `rcm.7.mustache`. The `autogen.sh` command will write `rcm.7` using autocontrib, a quick script included in this commit. This commit adds a `.mailmap` file, used by git-shortlog(1) to produce correct and useful names and email addresses. An initial `.mailmap` has been added to correct some existing email addresses and duplications. `.mailmap` is documented in [Documentation/mailmap.txt][mailmap] for git. This adds a maintainer dependency on Ruby and the mustache gem. The autocontrib program is spiked out in Ruby due to my familarity with the language, but the choice of templating language (mustache) allows flexibility for switching languages later. This is a dependency requirement only for people who run `autogen.sh` -- maintainers. This adds a maintainer dependency on git. Again, this is only for maintainers, and many (all?) of them need git to get rcm's source anyway. Thanks to Patrick Brisbin and George Brocklehurst for the review. [mailmap]: https://github.com/git/git/blob/6a907786af835ac15962be53f1492f23e044f479/Documentation/mailmap.txt
Diffstat (limited to 'maint')
-rwxr-xr-xmaint/autocontrib45
1 files changed, 45 insertions, 0 deletions
diff --git a/maint/autocontrib b/maint/autocontrib
new file mode 100755
index 0000000..f0eaf66
--- /dev/null
+++ b/maint/autocontrib
@@ -0,0 +1,45 @@
+#!/usr/bin/env ruby
+
+begin
+ require 'mustache'
+rescue LoadError
+ $stderr.puts <<-HERE
+Error: This project requires the mustache Ruby gem in order to finish
+the maintainer setup. Please install it and re-run autocontrib.
+
+The mustache gem can be installed using gem:
+
+ gem install mustache
+ HERE
+ exit 1
+end
+
+class ContributorView < Mustache
+ def contributors
+ @_contributors ||= raw_contributors
+ end
+
+ private
+
+ def raw_contributors
+ shortlog.map do |contributor_line|
+ if contributor_line =~ /\d+\s+(.+)\s+<(.+)>/
+ { :name => $1, :email => $2 }
+ end
+ end.compact
+ end
+
+ def shortlog
+ `git shortlog -es`.split("\n")
+ end
+end
+
+
+contributor_view = ContributorView.new
+
+ARGV.each do |template_filename|
+ output_filename = template_filename.sub(/\.mustache$/, '')
+ contributor_view.template_file = template_filename
+ output = contributor_view.render
+ File.write(output_filename, output)
+end