diff options
Diffstat (limited to 'snippets/Fork-Awesome-1.2.0/src/doc/_plugins/all-contributors-generator.rb')
-rw-r--r-- | snippets/Fork-Awesome-1.2.0/src/doc/_plugins/all-contributors-generator.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/snippets/Fork-Awesome-1.2.0/src/doc/_plugins/all-contributors-generator.rb b/snippets/Fork-Awesome-1.2.0/src/doc/_plugins/all-contributors-generator.rb new file mode 100644 index 0000000..85d0328 --- /dev/null +++ b/snippets/Fork-Awesome-1.2.0/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 + site.pages.each do |page| + page.data['total_contributors'] = total_contributors + end + end + end +end |