forked from ioBroker/ioBroker.repositories
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
60 lines (57 loc) · 2.27 KB
/
gulpfile.js
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
const gulp = require('gulp');
const request = require('request');
// check if all adapters in stable have the version attribute
// and published attribute
gulp.task('init', done => {
const scripts = require('./lib/scripts');
scripts.init(function () {
done();
});
});
gulp.task('stable', done => {
const build = require('./lib/build');
const tools = require('./lib/tools');
tools.getRepositoryFile('https://raw.githubusercontent.com/' + tools.appName + '/' + tools.appName + '.repositories/master/sources-dist-stable.json', (err, data) => {
if (err) {
console.error(err);
if (!data) process.exit(1);
}
build.getStats((err, stats) => {
if (stats) {
for (const adapter in stats) {
if (stats.hasOwnProperty(adapter) && data[adapter]) {
data[adapter].stat = stats[adapter];
}
}
}
build.processRepository(data, ['--file', '/var/www/download/sources-dist-latest.json'], () => {
done();
});
});
});
});
gulp.task('latest', done => {
const build = require('./lib/build');
const tools = require('./lib/tools');
request('https://raw.githubusercontent.com/' + tools.appName + '/' + tools.appName + '.repositories/master/sources-dist-stable.json', (err, resp, body) => {
const latest = JSON.parse(body);
tools.getRepositoryFile('https://raw.githubusercontent.com/' + tools.appName + '/' + tools.appName + '.repositories/master/sources-dist.json', latest, (err, data) => {
if (err) {
console.error(err);
if (!data) process.exit(1);
}
build.getStats((err, stats) => {
if (stats) {
for (const adapter in stats) {
if (stats.hasOwnProperty(adapter) && data[adapter]) {
data[adapter].stat = stats[adapter];
}
}
}
build.processRepository(data, ['--file', '/var/www/download/sources-dist.json', '--shields', '/var/www/download/img'], () => {
done();
});
});
});
});
});