-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #36
- Loading branch information
Showing
8 changed files
with
227 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
env: { | ||
node: true, | ||
browser: false | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters