summaryrefslogtreecommitdiff
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
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
-rw-r--r--.gitignore3
-rw-r--r--.mailmap6
-rw-r--r--CONTRIBUTING.md9
-rwxr-xr-xautogen.sh5
-rwxr-xr-xmaint/autocontrib45
-rw-r--r--man/rcm.7.mustache (renamed from man/rcm.7)15
6 files changed, 68 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index f915ceb..c039fa7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,6 @@ homebrew-formulae
release-arch
deb-build
rcm-*
+
+# Other generated files
+man/rcm.7
diff --git a/.mailmap b/.mailmap
new file mode 100644
index 0000000..68cc9bb
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1,6 @@
+George Brocklehurst <george@thoughtbot.com> <george.brocklehurst@gmail.com>
+George Brocklehurst <george@thoughtbot.com> <george@georgebrock.com>
+Javier López <linux.kitten@gmail.com> <kitten@openbsdbox>
+Mike Burns <mburns@thoughtbot.com> <mike@mike-burns.com>
+Pablo Olmos de Aguilera Corradini <pablo@glatelier.org>
+Patrick Brisbin <pat@thoughtbot.com> <pbrisbin@gmail.com>
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 62509ea..fcf9da1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,7 +6,7 @@ Overview
- We do not currently have a test suite.
- Update `NEWS.md.in`.
-- Update `rcm.7`.
+- Update `.mailmap`.
- Submit a pull request on GitHub.
Explanation
@@ -21,8 +21,11 @@ release. Bugfixes should be marked with `BUGFIX`. Small things (typos,
code style) should be grouped but with multiple authors (`Documentation
updates thanks to Dan Croak and Roberto Pedroso`).
-Ensure your name is in the list of contributors in `man/rcm.7`. These
-are alphabetical.
+We use your name and email address as produced by `git-shortlog(1)`. You
+can change how this is formatted by modifying `.mailmap`. More details
+on that file can be found in the git [Documentation/mailmap.txt][mailmap].
Submit a pull request using GitHub. If there is a relevant bug, mention
it in the commit message (`Fixes #42.`).
+
+[mailmap]: https://github.com/git/git/blob/6a907786af835ac15962be53f1492f2
diff --git a/autogen.sh b/autogen.sh
index 248f54a..f8969de 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,3 +1,6 @@
#!/bin/sh
-aclocal && autoconf && automake --add-missing --copy
+aclocal &&
+ autoconf &&
+ automake --add-missing --copy &&
+ ./maint/autocontrib man/rcm.7.mustache
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
diff --git a/man/rcm.7 b/man/rcm.7.mustache
index 71b99f4..8956e5d 100644
--- a/man/rcm.7
+++ b/man/rcm.7.mustache
@@ -239,15 +239,8 @@ is maintained by
.An "Mike Burns" Aq Mt mburns@thoughtbot.com
and
.Lk http://thoughtbot.se thoughtbot
-.Sh CONTIRBUTORS
+.Sh CONTRIBUTORS
.An -split
-.An "Anton Ilin" Aq Mt anton@ilin.dn.ua
-.An "Caleb Land" Aq Mt caleb@land.fm
-.An "Dan Croak" Aq Mt dan@thoughtbot.com
-.An "Daniel Watson" Aq Mt dbwatson@vectorspace.org
-.An "George Brocklehurst" Aq Mt george@thoughtbot.com
-.An "Javier López" Aq Mt linux.kitten@gmail.com
-.An "Jordan Eldredge" Aq Mt jordaneldredge@gmail.com
-.An "Pablo Olmos de Aguilera Corradini" Aq Mt pablo@glatelier.org
-.An "Patrick Brisbin" Aq Mt pat@thoughtbot.com
-.An "Roberto Pedroso" Aq Mt roberto@rpedroso.com
+{{#contributors}}
+.An "{{{name}}}" Aq Mt {{{email}}}
+{{/contributors}}