Authored by xuqi

sync code

... ... @@ -7,3 +7,7 @@ db/**
packages/
.idea/
code/
.gitmodules
... ...
[submodule "code/yoho-blk"]
path = code/yoho-blk
url = http://git.yoho.cn/fe/yoho-blk.git
... ... @@ -101,19 +101,33 @@ class Build {
_cloneCode() {
var self = this;
var syncCodeScript;
var update;
if(sh.ls(config.codeDir).indexOf(this.project.name) > -1) {
syncCodeScript = `git pull origin ${this.branch}`;
update = true;
syncCodeScript = 'git submodule update';
} else {
syncCodeScript = `git submodule add ${this.project.gitlab}`;
syncCodeScript = `git submodule add -f ${this.project.gitlab}`;
}
// let clone_script = `git clone -b develop ${this.project.gitlab}`;
this._log(`>>>>>>>>> ${syncCodeScript} >>>>>>>>>>>`);
return new Promise((resolve, reject) => {
this._state('sync code');
if (update) {
sh.cd(self.codePath);
var pullChild = sh.exec(`git pull origin ${self.branch}`, {
silent: true
});
if (pullChild.code !== 0) {
reject(new Error(`pull code fail`));
}
}
// 回到上级目录更新
sh.cd(config.codeDir);
let child = sh.exec(syncCodeScript, {
... ... @@ -129,10 +143,6 @@ class Build {
flags: 'a'
}));
// child.stderr.on('data', (data) => {
// self._log(data);
// });
child.on('close', (code) => {
if (code == 0) {
console.log('sync code success');
... ...
... ... @@ -19,11 +19,8 @@ gulp.task('upQiniu', () => {
// 找到对应项目对应的版本的静态资源上传至七牛cdn
gulp.src(path.join(__dirname, `../../packages/${name}/${time}/${name}/**`)).pipe(
qiniu({
// accessKey: 'RcJ--8b9E4ND8J_SRPsWvb4lGqK3cr92gKi5xmuF',
accessKey: 'cY9B5ZgON_7McTS5zV5nTeRyQ98MOcVD7W4eGVbE',
// secretKey: 'xfFfRTdje-LxoPSQH619PeGtcJZT19UNCwXGTOfo',
secretKey: 'RduqgmK7cAtaQvdIa1ax_zzmMsnv9ac-Ka0uF6wG',
// bucket: 'yohotest'
bucket: 'yohocdn'
}, {
dir: name
... ...