From b0b484ba1854c61d3b0c71b770bbba849aefc011 Mon Sep 17 00:00:00 2001 From: nightpool Date: Sun, 9 Sep 2018 19:31:42 -0400 Subject: Add rake task for generating AUTHORS.md (#8661) * add rake task for generating AUTHORS.md * update AUTHORS.md * rubocop --- lib/tasks/repo.rake | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lib/tasks/repo.rake (limited to 'lib/tasks') diff --git a/lib/tasks/repo.rake b/lib/tasks/repo.rake new file mode 100644 index 000000000..216e37ef2 --- /dev/null +++ b/lib/tasks/repo.rake @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +namespace :repo do + desc 'Generate the authors.md file' + task :authors do + file = File.open('AUTHORS.md', 'w') + file << <<~HEADER + Mastodon is available on [GitHub](https://github.com/tootsuite/mastodon) + and provided thanks to the work of the following contributors: + + HEADER + + url = 'https://api.github.com/repos/tootsuite/mastodon/contributors?anon=1' + HttpLog.config.compact_log = true + while url.present? + response = HTTP.get(url) + contributors = Oj.load(response.body) + contributors.each do |c| + file << "* [#{c['login']}](#{c['html_url']})\n" if c['login'] + file << "* [#{c['name']}](#{c['email']})\n" if c['name'] + end + url = LinkHeader.parse(response.headers['Link']).find_link(%w(rel next))&.href + end + + file << <<~FOOTER + + This document is provided for informational purposes only. Since it is only updated once per release, the version you are looking at may be currently out of date. To see the full list of contributors, consider looking at the [git history](https://github.com/tootsuite/mastodon/graphs/contributors) instead. + FOOTER + end +end -- cgit