...
|
...
|
@@ -11,6 +11,7 @@ import sh from 'shelljs'; |
|
|
import ssh from 'ssh2';
|
|
|
import fs from 'fs';
|
|
|
import path from 'path';
|
|
|
import rp from 'request-promise';
|
|
|
|
|
|
import config from '../../config/config';
|
|
|
import ws from '../../lib/ws';
|
...
|
...
|
@@ -31,6 +32,11 @@ class Deploy { |
|
|
|
|
|
return this._deploy().then(() => {
|
|
|
self._state('deploying');
|
|
|
}).then(() => {
|
|
|
self._flush();
|
|
|
self._state('flushing');
|
|
|
}).then(() => {
|
|
|
self._state('deploy success');
|
|
|
}).catch(e => {
|
|
|
console.error(e);
|
|
|
self._state('fail');
|
...
|
...
|
@@ -59,13 +65,25 @@ class Deploy { |
|
|
})
|
|
|
}
|
|
|
|
|
|
_flush() {
|
|
|
var self = this;
|
|
|
|
|
|
return rp({
|
|
|
uri: 'http://flushcache.yoho.cn/flushdaction.php',
|
|
|
type: 'GET',
|
|
|
qs: {
|
|
|
url: `http://cdn.yoho.cn/${self.project.name}/${self.building.version}/`
|
|
|
}
|
|
|
}).then(data => {
|
|
|
console.log(data);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
async _state(state) {
|
|
|
ws.broadcast(`/deploy/${this.project._id}`, {
|
|
|
host: this.info.host,
|
|
|
state: state
|
|
|
});
|
|
|
await DeployInfo.updateState(this.info._id, state);
|
|
|
}
|
|
|
|
|
|
_log(msg) {
|
...
|
...
|
|