Conditions | 1 |
Paths | 4 |
Total Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | 'use strict' |
||
10 | Kits.list = function (callback) { |
||
11 | var stopSpinner = util.output.wait('Loading available starter kits') |
||
12 | unirest.get('https://api.github.com/search/repositories?q=user:includable-modules+in:name+starter-') |
||
13 | .header('User-Agent', 'includable-cli v' + pkg.version) |
||
14 | .end(function (response) { |
||
15 | if (response.error || !response.body) { |
||
16 | stopSpinner(response.error) |
||
17 | process.exit() |
||
18 | } |
||
19 | |||
20 | stopSpinner() |
||
21 | var list = response.body.items.map(function (item) { |
||
22 | return item.name.replace(/^starter-/, '') |
||
23 | }).sort(function (a, b) { |
||
24 | if (a === 'basic') { |
||
25 | return -1 |
||
26 | } |
||
27 | if (b === 'basic') { |
||
28 | return 1 |
||
29 | } |
||
30 | return a > b ? 1 : -1 |
||
31 | }) |
||
32 | |||
33 | callback(list) |
||
34 | }) |
||
35 | } |
||
36 | |||
38 |