mirror of
https://github.com/ForkAwesome/Fork-Awesome
synced 2024-05-03 23:23:12 +02:00
18 lines
522 B
Ruby
18 lines
522 B
Ruby
##
|
|
# 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
|