1 | const shelljs = require('shelljs');
|
2 | const path = require('path');
|
3 | const fs = require('fs');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function fsExistsSync(path) {
|
10 | try {
|
11 | fs.accessSync(path, fs.F_OK);
|
12 | } catch(e) {
|
13 | return false;
|
14 | }
|
15 | return true;
|
16 | }
|
17 |
|
18 |
|
19 | exports.publish = function({
|
20 | repo_url,
|
21 | build_type,
|
22 | username,
|
23 | password,
|
24 | }) {
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | const svnWorkDir = '.mole-tools-tmp/svn/' + build_type;
|
31 | shelljs.rm('-rf', svnWorkDir);
|
32 |
|
33 | shelljs.mkdir('-p', svnWorkDir);
|
34 | shelljs.cd(svnWorkDir);
|
35 | shelljs.exec('svn checkout '+ repo_url + ' ../'+build_type +' --username '+ username + ' --password ' + password)
|
36 |
|
37 | shelljs.rm('-rf', ['./lib', './css', './script', './index.html', './icon', './wgt', './html', './image', './res', './modules', './config.xml', './public'])
|
38 | shelljs.exec('svn delete ./wgt');
|
39 | shelljs.exec('svn delete ./icon');
|
40 | shelljs.exec('svn delete ./index.html');
|
41 | shelljs.exec('svn delete ./css');
|
42 | shelljs.exec('svn delete ./lib');
|
43 | shelljs.exec('svn delete ./html');
|
44 | shelljs.exec('svn delete ./image');
|
45 | shelljs.exec('svn delete ./res ');
|
46 | shelljs.exec('svn delete ./modules ');
|
47 | shelljs.exec('svn delete ./video ');
|
48 | shelljs.exec('svn delete ./lib ');
|
49 | shelljs.exec('svn delete ./config.xml');
|
50 | shelljs.cp('-rf', ['../../../public', '../../../res', '../../../modules', '../../../config.xml'], './');
|
51 | shelljs.exec('svn add . --no-ignore --force');
|
52 | const publishUser = shelljs.exec('echo $USER');
|
53 | shelljs.exec(`svn commit -m "auto commit ${build_type} by ${publishUser}"`);
|
54 | shelljs.cd('../../../');
|
55 | } |
\ | No newline at end of file |