This repository has been archived by the owner on Apr 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.coffee
79 lines (69 loc) · 2.16 KB
/
index.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Promise = require 'bluebird'
Octokat = require 'octokat'
{p, log} = require 'lightsaber'
{sortBy} = require 'lodash'
$ = require 'jquery'
DataTable = require 'datatables'
{
a
img
raw
render
renderable
table
tbody
td
th
thead
tr
} = require 'teacup'
EXPECTED =
'Made By': '[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)'
'Project': '[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)'
'IRC': '[![](https://img.shields.io/badge/freejs-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)'
main = ->
github = new Octokat
# need account, otherwise api throttled :(
username: "8DvrWa6nBCevZt"
password: "wojY4o9yWyRKDN"
github.orgs('ipfs').repos.fetch()
.then (repos) -> getReadmes repos
.then (repos) -> show matrix repos
.then -> $('table').DataTable paging: false
getReadmes = (repos) ->
repos = sortBy repos, 'name'
Promise.map repos, (repo) ->
repo.readme.read()
.then (readmeText) -> repo.readmeText = readmeText
.catch -> repo.readmeText = null
.then -> repos
matrix = renderable (repos) ->
table ->
thead ->
tr ->
th -> "Repository"
th -> "Travis CI"
th -> "Circle CI"
th -> "README"
for expectedName of EXPECTED
th -> expectedName
tbody ->
for repo in repos
tr ->
td repo.name
td -> travis repo.name
td -> circle repo.name
td -> check repo.readmeText?
for expectedName, expectedValue of EXPECTED
td -> check (repo.readmeText? and repo.readmeText?.indexOf(expectedValue) isnt -1)
check = (success) -> if success then '✓' else '✗'
travis = renderable (repoName) ->
a href: "https://travis-ci.org/ipfs/#{repoName}", ->
img src: "https://travis-ci.org/ipfs/#{repoName}.svg?branch=master"
circle = renderable (repoName) ->
a href: "https://circleci.com/gh/ipfs/#{repoName}", ->
img src: "https://circleci.com/gh/ipfs/#{repoName}.svg?style=svg"
show = (html) ->
content = document.getElementById 'content'
content.innerHTML = html
main()