mirror of
https://github.com/ForkAwesome/Fork-Awesome
synced 2026-03-14 14:35:49 +01:00
Merge pull request #164 from ForkAwesome/contributor-badge
Updates automatically the number of contributors in the README file.
This commit is contained in:
commit
ad6b42da71
2 changed files with 18 additions and 1 deletions
|
|
@ -4,7 +4,7 @@
|
|||
### {{ site.forkawesome.tagline }}
|
||||
|
||||
[](https://www.npmjs.com/package/fork-awesome)
|
||||
[](CONTRIBUTORS.md)
|
||||
[](CONTRIBUTORS.md)
|
||||
[](https://www.jsdelivr.com/package/npm/fork-awesome)
|
||||
[](https://cdnjs.com/libraries/fork-awesome)
|
||||
[](https://travis-ci.org/ForkAwesome/Fork-Awesome)
|
||||
|
|
|
|||
17
src/doc/_plugins/all-contributors-generator.rb
Normal file
17
src/doc/_plugins/all-contributors-generator.rb
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue