From dd7cb283b82980f76ceb1244b5e0dc2e14f7efa1 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 19 Oct 2017 09:37:42 -0500 Subject: [PATCH] Sync installation stats show on site --- CONTRIBUTING.md | 2 ++ _includes/app.html | 3 +++ _layouts/app.html | 13 +++++++++++++ apps/index.html | 2 +- index.html | 2 +- script/sync-data | 10 +++++++--- 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index be6b3e2..c822c24 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,6 +54,8 @@ screenshots: authors: [ your-username, other-usernames ] # The repository where the code is located repository: your-username/your-app +# The address where this app is deployed +host: https://my-probot-app.awesomecloudhost.com --- Any documentation can go here. Many apps just use their README.md here. diff --git a/_includes/app.html b/_includes/app.html index 9f505b6..6c690f3 100644 --- a/_includes/app.html +++ b/_includes/app.html @@ -4,6 +4,9 @@

{{ app.description }}

+ {% if app.installations %} +
{% octicon cloud-download heigh:16 class:"v-align-middle" %} {{ app.installations }}
+ {% endif %}
{% octicon star heigh:16 class:"v-align-middle" %} {{ app.stars }}
{% for author in app.authors %} diff --git a/_layouts/app.html b/_layouts/app.html index f1ec0d9..63e96e8 100644 --- a/_layouts/app.html +++ b/_layouts/app.html @@ -15,6 +15,9 @@ layout: default Add to GitHub
+ {% if page.installations %} +
{% octicon cloud-download heigh:16 class:"v-align-middle" %} {{ page.installations }}
+ {% endif %}
{% octicon star heigh:16 class:"v-align-middle" %} {{ page.stars }}
@@ -69,6 +72,16 @@ layout: default {{ content }}
+
+ {% if page.organizations %} +

Used By

+ {% for org in page.organizations %} + + + + {% endfor %} + {% endif %} +
diff --git a/apps/index.html b/apps/index.html index 6f601a0..a372dbd 100644 --- a/apps/index.html +++ b/apps/index.html @@ -8,7 +8,7 @@ title: Featured Apps

{{ page.title }}

- {% assign apps = site.apps | sort: 'stars' | reverse %} + {% assign apps = site.apps | sort: 'installations' | reverse %} {% for app in apps %} {% include app.html app=app %} {% endfor %} diff --git a/index.html b/index.html index 2ba4224..68a7b5c 100644 --- a/index.html +++ b/index.html @@ -31,7 +31,7 @@ layout: default

- {% assign apps = site.apps | sort: 'stars' | reverse %} + {% assign apps = site.apps | sort: 'installations' | reverse %} {% for app in apps limit:6 %} {% include app.html app=app %} {% endfor %} diff --git a/script/sync-data b/script/sync-data index 4cb5958..d325082 100755 --- a/script/sync-data +++ b/script/sync-data @@ -18,9 +18,13 @@ files.each do |path| app['updated'] = repo[:pushed_at].to_s if app['host'] - stats = JSON.parse(URI(app['host'] + '/stats').open.read) - app['installations'] = stats['installations'] - app['organizations'] = stats['popular'].map { |org| org['login'] } + begin + stats = JSON.parse(URI(app['host'] + '/probot/stats').open.read) + app['installations'] = stats['installations'] + app['organizations'] = stats['popular'].map { |org| org['login'] } + rescue => e + warn e.message + end end content = File.read(path)