forked from tagspaces/tagspaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-tests.js
77 lines (67 loc) · 1.9 KB
/
setup-tests.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const fs = require('fs-extra');
const pathLib = require('path');
fs.outputFileSync(
pathLib.join(__dirname, '../release/app/.env'),
'KEY=e2eTestKey',
);
/* const sh = require('shelljs');
const path = require('path');
// const fs = require('fs-extra');
if (!sh.which('git')) {
sh.echo('Sorry, this script requires git');
sh.exit(1);
}
if (!sh.which('yarn')) {
sh.echo('Sorry, this script requires yarn');
sh.exit(1);
}
const extensionDir = path.resolve(__dirname, '../tests');
if (!sh.test('-d', extensionDir)) {
sh.mkdir(extensionDir);
}
sh.cd(extensionDir); */
/**
* @Deprecated use github action script for setup instead
*/
/*
const extensionBranch = 'master';
const extensionList = [
{
path: 'testdata',
url: 'https://github.com/tagspaces/testdata'
}
];
extensionList.forEach(extension => {
if (sh.test('-d', extension.path)) {
sh.cd(extension.path);
sh.exec('git checkout ' + extensionBranch);
sh.exec('git pull');
} else {
sh.exec('git clone -b ' + extensionBranch + ' ' + extension.url);
sh.cd(extension.path);
}
sh.cd('..');
});
// Download
const winUrl = 'https://dl.min.io/server/minio/release/windows-amd64/minio.exe';
const linuxUrl = 'https://dl.min.io/server/minio/release/linux-amd64/minio';
const macUrl = 'https://dl.min.io/server/minio/release/darwin-amd64/minio';
const isWin = /^win/.test(process.platform);
const isMac = /^darwin/.test(process.platform);
const isLinux = /^linux/.test(process.platform);
const url = isWin ? winUrl : isMac ? macUrl : isLinux ? linuxUrl : undefined;
const outDir = path.resolve(__dirname, '../tests/bin');
if (!sh.test('-d', outDir)) {
sh.mkdir(outDir);
sh.cd(outDir);
sh.exec('curl -O -J ' + url);
if (!isWin) {
sh.exec('chmod -R +x .');
}
}
*/
/* const outFile = path.join(outDir, 'minio.exe');
if (!fs.existsSync(outFile)) {
//! sh.test('-d', 'bin') ||
sh.exec('curl -O -J ' + outFile + ' ' + url);
} */