Commit 61bea8294199142dba186c06d9cd263b1355de2d
initial
Dominic Tarr committed on 11/1/2016, 7:45:39 AMFiles changed
LICENSE | added |
README.md | added |
issues.js | added |
package.json | added |
LICENSE | ||
---|---|---|
@@ -1,0 +1,22 @@ | ||
1 … | +Copyright (c) 2016 'Dominic Tarr' | |
2 … | + | |
3 … | +Permission is hereby granted, free of charge, | |
4 … | +to any person obtaining a copy of this software and | |
5 … | +associated documentation files (the "Software"), to | |
6 … | +deal in the Software without restriction, including | |
7 … | +without limitation the rights to use, copy, modify, | |
8 … | +merge, publish, distribute, sublicense, and/or sell | |
9 … | +copies of the Software, and to permit persons to whom | |
10 … | +the Software is furnished to do so, | |
11 … | +subject to the following conditions: | |
12 … | + | |
13 … | +The above copyright notice and this permission notice | |
14 … | +shall be included in all copies or substantial portions of the Software. | |
15 … | + | |
16 … | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
17 … | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |
18 … | +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
19 … | +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR | |
20 … | +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
21 … | +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
22 … | +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
README.md | ||
---|---|---|
@@ -1,0 +1,8 @@ | ||
1 … | +# issue-queue | |
2 … | + | |
3 … | +display all the open issues on repos by an author. (prototype) | |
4 … | + | |
5 … | + | |
6 … | +## License | |
7 … | + | |
8 … | +MIT |
issues.js | |||
---|---|---|---|
@@ -1,0 +1,80 @@ | |||
1 … | +var pull = require('pull-stream') | ||
2 … | +var Paramap = require('pull-paramap') | ||
3 … | + | ||
4 … | +function lookup (issue, cb) { | ||
5 … | + pull( | ||
6 … | + sbot.links({dest: issue.key, values: true}), | ||
7 … | + pull.collect(function (err, ary) { | ||
8 … | + issue.related = ary | ||
9 … | + cb(null, issue) | ||
10 … | + }) | ||
11 … | + ) | ||
12 … | + | ||
13 … | + | ||
14 … | +} | ||
15 … | +//a closed issue | ||
16 … | +var key = '%Kp398hekpWi1hvJ2n2P4IBY7wn49PG++jgoyqixxC+U=.sha256' | ||
17 … | + | ||
18 … | +require('ssb-client')(function (err, sbot) { | ||
19 … | +sbot.whoami(function (err, me) { | ||
20 … | + var self_id = me.id | ||
21 … | + | ||
22 … | + pull( | ||
23 … | + sbot.query.read({query: [ | ||
24 … | + {$filter: { | ||
25 … | + value: {content: {type: 'issue'}} | ||
26 … | + }} | ||
27 … | + ]}), | ||
28 … | + pull.through(function (issue) { | ||
29 … | + issue.open = true //open by default! | ||
30 … | + }), | ||
31 … | + Paramap(function (issue, cb) { | ||
32 … | + sbot.get(issue.value.content.project, function (err, msg) { | ||
33 … | + issue.owner = msg.author | ||
34 … | + cb(null, issue) | ||
35 … | + }) | ||
36 … | + | ||
37 … | + }), | ||
38 … | + pull.collect(function (err, ary) { | ||
39 … | + | ||
40 … | + function find(key) { | ||
41 … | + for(var i = 0; i < ary.length; i++) | ||
42 … | + if(ary[i].key === key) return ary[i] | ||
43 … | + } | ||
44 … | + | ||
45 … | + pull( | ||
46 … | + sbot.query.read({query: [ | ||
47 … | + {$filter: { | ||
48 … | + value: {content: {type: 'issue-edit'}} | ||
49 … | + }} | ||
50 … | + ]}), | ||
51 … | + pull.drain(function (issue) { | ||
52 … | + var parent, open | ||
53 … | + if(issue.value.content.issue) { | ||
54 … | + parent = issue.value.content.issue | ||
55 … | + open = issue.value.content.open | ||
56 … | + } | ||
57 … | + else { | ||
58 … | + parent = issue.value.content.issues[0].link | ||
59 … | + open = issue.value.content.issues[0].open | ||
60 … | + } | ||
61 … | + | ||
62 … | + var op = find(parent) | ||
63 … | + if(op) { op.open = open; op.edited = parent } | ||
64 … | + }, function () { | ||
65 … | + console.log('drain', ary) | ||
66 … | + pull( | ||
67 … | + pull.values(ary), | ||
68 … | + pull.filter(function (op) { return op.open && op.owner === self_id}), | ||
69 … | + pull.through(console.log), | ||
70 … | + pull.collect(function (err, ary) { | ||
71 … | + console.log(JSON.stringify(ary, null, 2)) | ||
72 … | + sbot.close() | ||
73 … | + }) | ||
74 … | + ) | ||
75 … | + }) | ||
76 … | + ) | ||
77 … | + }) | ||
78 … | + ) | ||
79 … | +})}) | ||
80 … | + |
package.json | ||
---|---|---|
@@ -1,0 +1,21 @@ | ||
1 … | +{ | |
2 … | + "name": "issue-queue", | |
3 … | + "description": "", | |
4 … | + "version": "0.0.0", | |
5 … | + "homepage": "https://github.com/dominictarr/issue-queue", | |
6 … | + "repository": { | |
7 … | + "type": "git", | |
8 … | + "url": "git://github.com/dominictarr/issue-queue.git" | |
9 … | + }, | |
10 … | + "dependencies": { | |
11 … | + "pull-paramap": "^1.2.0", | |
12 … | + "pull-stream": "^3.5.0", | |
13 … | + "ssb-client": "^4.3.0" | |
14 … | + }, | |
15 … | + "devDependencies": {}, | |
16 … | + "scripts": { | |
17 … | + "test": "set -e; for t in test/*.js; do node $t; done" | |
18 … | + }, | |
19 … | + "author": "'Dominic Tarr' <dominic.tarr@gmail.com> (dominictarr.com)", | |
20 … | + "license": "MIT" | |
21 … | +} |
Built with git-ssb-web