about summary refs log tree commit diff
path: root/lib/tasks
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-09-11 16:51:26 +0200
committerThibaut Girka <thib@sitedethib.com>2018-09-11 16:51:26 +0200
commitcd99255698354f3b5ec1c0d5d9bc1b4fb9bffdf3 (patch)
tree0486b73191a98645e0620fefe8743f4a0c44bef5 /lib/tasks
parent65f625cf237feb55a21495606d5e2c258bbe50cc (diff)
parentbda0f7ac7353a63b42ca99b2e7d4e80a3b03b850 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
	app/controllers/oauth/authorizations_controller.rb

Just two changes being too close to one another.
Took both.
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/repo.rake30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/tasks/repo.rake b/lib/tasks/repo.rake
new file mode 100644
index 000000000..367859e94
--- /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']}](mailto:#{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