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
path: root/src/doc
diff options
context:
space:
mode:
authorJulien Deswaef <judeswae@thoughtworks.com>2019-02-17 00:22:18 +0300
committerJulien Deswaef <judeswae@thoughtworks.com>2019-02-17 00:22:18 +0300
commita89b53a39aa59563c5bdf2167aa99fd12ca675e9 (patch)
tree46941533d4ce73c7557d6f0a38dc9452add4c6ee /src/doc
parent20906a5856b4343ca339be5efc294f2460824a54 (diff)
Updates automatically the number of contributors in the README file.
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/README.md-nobuild2
-rw-r--r--src/doc/_plugins/all-contributors-generator.rb17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/doc/README.md-nobuild b/src/doc/README.md-nobuild
index 8212f3da4..867babbf9 100644
--- a/src/doc/README.md-nobuild
+++ b/src/doc/README.md-nobuild
@@ -4,7 +4,7 @@
### {{ site.forkawesome.tagline }}
[![npm](https://img.shields.io/npm/v/fork-awesome.svg?style=flat&colorB=CB3837)](https://www.npmjs.com/package/fork-awesome)
-[![All Contributors](https://img.shields.io/badge/all_contributors-112-orange.svg?style=flat-square)](CONTRIBUTORS.md)
+[![All Contributors](https://img.shields.io/badge/all_contributors-{{ page.total_contributors }}-orange.svg?style=flat-square)](CONTRIBUTORS.md)
[![JSDeliver](https://data.jsdelivr.com/v1/package/npm/fork-awesome/badge)](https://www.jsdelivr.com/package/npm/fork-awesome)
[![CDNJS](https://img.shields.io/cdnjs/v/fork-awesome.svg?style=flat-square)](https://cdnjs.com/libraries/fork-awesome)
[![Build Status](https://travis-ci.org/ForkAwesome/Fork-Awesome.svg?branch=master)](https://travis-ci.org/ForkAwesome/Fork-Awesome)
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