Skip to content

Commit

Permalink
Add GSoC Org that use GitHub
Browse files Browse the repository at this point in the history
Closes coala#36
  • Loading branch information
bekicot committed Jun 1, 2018
1 parent 55589c3 commit a478250
Show file tree
Hide file tree
Showing 10 changed files with 246 additions and 26 deletions.
25 changes: 1 addition & 24 deletions app/data/organizations.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="columns">
<div class="columns is-multiline">
{{#each-in model as |slug organization|}}
<div class="column is-one-third">
{{#link-to 'tasks' (query-params org=slug) tagName='div' class="card organization-card"}}
Expand Down
6 changes: 6 additions & 0 deletions lib/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
env: {
node: true,
browser: false
}
};
28 changes: 28 additions & 0 deletions lib/gsoc-org/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-env node */
'use strict';

const path = require('path');
const wikidataGsocOrg = require('./wikidataGsocOrg');

module.exports = {
name: 'gsoc-org',
preBuild: function () {
const fetch = this.project.require('node-fetch');
const fs = this.project.require('fs-extra');
if(this.app.env == 'production') {
const orgPath = path.join(this.app.project.root, 'app',
'data', 'organizations.js');

return wikidataGsocOrg(fetch).then((data) =>{
const orgDefinition = "export default " + JSON.stringify(data);
fs.writeFile(orgPath, orgDefinition);
});

} else {
return true;
}
},
isDevelopingAddon() {
return true;
}
};
83 changes: 83 additions & 0 deletions lib/gsoc-org/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions lib/gsoc-org/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "gsoc-org",
"keywords": [
"ember-addon"
],
"dependencies": {
"fetch": "^1.1.0",
"fs-extra": "^6.0.1",
"node-fetch": "^2.1.2"
}
}
35 changes: 35 additions & 0 deletions lib/gsoc-org/wikidataGsocOrg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const ENDPOINT = "https://query.wikidata.org/sparql?format=json&query=";
const QUERY = `
SELECT DISTINCT ?orgLabel ?githubUsername
WHERE {
?org wdt:P1344 wd:Q54276825.
?org wdt:P2037 ?githubUsername
SERVICE wikibase:label { bd:serviceParam wikibase:language "id,en". }
} ORDER BY ?orgLabel
`

module.exports = function(fetch) {
const toJson = (res) => {
return res.json();
};
const format = (json) => {
const mapToCompatibleOrg = (item) => {
return {
name: item['orgLabel']['value'],
trackers: [
{
type: 'github',
identifier: item['githubUsername']['value']
}
]
}
}
const toObject = (object, item) => {
return Object.assign(object, { [item['name']]: item});
}
return json['results']['bindings']
.map(mapToCompatibleOrg)
.reduce(toObject, {});
};
return fetch(ENDPOINT + encodeURIComponent(QUERY)).then(toJson).then(format);
}
58 changes: 58 additions & 0 deletions lib/gsoc-org/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


[email protected]:
version "1.0.1"
resolved "https://registry.yarnpkg.com/biskviit/-/biskviit-1.0.1.tgz#037a0cd4b71b9e331fd90a1122de17dc49e420a7"
dependencies:
psl "^1.1.7"

[email protected]:
version "0.1.12"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
dependencies:
iconv-lite "~0.4.13"

fetch@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/fetch/-/fetch-1.1.0.tgz#0a8279f06be37f9f0ebb567560a30a480da59a2e"
dependencies:
biskviit "1.0.1"
encoding "0.1.12"

fs-extra@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-6.0.1.tgz#8abc128f7946e310135ddc93b98bddb410e7a34b"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"

graceful-fs@^4.1.2, graceful-fs@^4.1.6:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"

iconv-lite@~0.4.13:
version "0.4.23"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63"
dependencies:
safer-buffer ">= 2.1.2 < 3"

jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
optionalDependencies:
graceful-fs "^4.1.6"

psl@^1.1.7:
version "1.1.27"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.27.tgz#2b2c77019db86855170d903532400bf71ee085b6"

"safer-buffer@>= 2.1.2 < 3":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"

universalify@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7"
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,10 @@
"linkifyjs": "^2.1.6",
"minimatch": "^3.0.3",
"moment": "^2.22.1"
},
"ember-addon": {
"paths": [
"lib/gsoc-org"
]
}
}
19 changes: 18 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,12 @@ binary-extensions@^1.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/binaryextensions/-/binaryextensions-2.1.1.tgz#3209a51ca4a4ad541a3b8d3d6a6d5b83a2485935"

[email protected]:
version "1.0.1"
resolved "https://registry.yarnpkg.com/biskviit/-/biskviit-1.0.1.tgz#037a0cd4b71b9e331fd90a1122de17dc49e420a7"
dependencies:
psl "^1.1.7"

bl@^1.0.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.2.tgz#a160911717103c07410cef63ef51b397c025af9c"
Expand Down Expand Up @@ -3028,7 +3034,7 @@ encodeurl@~1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"

encoding@^0.1.11:
encoding@0.1.12, encoding@^0.1.11:
version "0.1.12"
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
dependencies:
Expand Down Expand Up @@ -3561,6 +3567,13 @@ fbjs@^0.8.16:
setimmediate "^1.0.5"
ua-parser-js "^0.7.9"

fetch@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/fetch/-/fetch-1.1.0.tgz#0a8279f06be37f9f0ebb567560a30a480da59a2e"
dependencies:
biskviit "1.0.1"
encoding "0.1.12"

figures@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962"
Expand Down Expand Up @@ -6615,6 +6628,10 @@ pseudomap@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"

psl@^1.1.7:
version "1.1.27"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.27.tgz#2b2c77019db86855170d903532400bf71ee085b6"

pump@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.3.tgz#5dfe8311c33bbf6fc18261f9f34702c47c08a954"
Expand Down

0 comments on commit a478250

Please sign in to comment.