Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ForkAwesome/Fork-Awesome.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/_plugins/all-contributors-generator.rb')
-rw-r--r--src/doc/_plugins/all-contributors-generator.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/doc/_plugins/all-contributors-generator.rb b/src/doc/_plugins/all-contributors-generator.rb
new file mode 100644
index 000000000..a69e77f50
--- /dev/null
+++ b/src/doc/_plugins/all-contributors-generator.rb
@@ -0,0 +1,17 @@
+##
+# Generate an all-contributors badge with the number of contributors
+
+require "json"
+
+module Jekyll
+ class AllContributors < Generator
+ def generate(site)
+ all_contributors_rc = File.read(File.join(Dir.pwd, '.all-contributorsrc'))
+ all_contributors = JSON.parse(all_contributors_rc)
+ total_contributors = all_contributors['contributors'].length
+
+ readme = site.pages.detect {|page| page.name == 'README.md-nobuild'}
+ readme.data['total_contributors'] = total_contributors
+ end
+ end
+end