mm_os 2.6.5 → 2.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/com/plugin/index.js +33 -3
- package/package.json +1 -1
package/core/com/plugin/index.js
CHANGED
|
@@ -112,7 +112,8 @@ Plugin.prototype.zip = async function(name) {
|
|
|
112
112
|
* @returns {Boolean} 返回解压结果
|
|
113
113
|
*/
|
|
114
114
|
Plugin.prototype.unzip = async function(file) {
|
|
115
|
-
var
|
|
115
|
+
var name = file.basename().left(".");
|
|
116
|
+
var dir = `/cache/plugin/${name}`.fullname();
|
|
116
117
|
dir.addDir();
|
|
117
118
|
var ret;
|
|
118
119
|
try {
|
|
@@ -183,11 +184,13 @@ Plugin.prototype.install = async function(file) {
|
|
|
183
184
|
if (name) {
|
|
184
185
|
var dir = `/app/${app}/plugin/${name}`;
|
|
185
186
|
await this.copy_dir(dir_src, dir);
|
|
186
|
-
dir_src.delDir();
|
|
187
187
|
var cs = $.pool.plugin[app];
|
|
188
188
|
if (cs) {
|
|
189
|
-
await cs.update();
|
|
189
|
+
await cs.update(`/app/${app}/`.fullname());
|
|
190
190
|
await cs.exec(name, 'install');
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
ret.dir.delDir();
|
|
193
|
+
}, 3000)
|
|
191
194
|
}
|
|
192
195
|
return {
|
|
193
196
|
app,
|
|
@@ -201,6 +204,33 @@ Plugin.prototype.install = async function(file) {
|
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
206
|
|
|
207
|
+
// /**
|
|
208
|
+
// * 更新插件
|
|
209
|
+
// * @param {String} name 插件名称
|
|
210
|
+
// * @returns {Object} 返回更新结果
|
|
211
|
+
// */
|
|
212
|
+
// Plugin.prototype.update = async function(name) {
|
|
213
|
+
// var plus = this.get(name);
|
|
214
|
+
// if (plus) {
|
|
215
|
+
// var cg = plus.config;
|
|
216
|
+
// // 先将配置缓存
|
|
217
|
+
// var file = `/cache/config/${cg.app}_${cg.name}.json`;
|
|
218
|
+
// file.saveJson(cg);
|
|
219
|
+
|
|
220
|
+
// var dir = plus.filename.dirname();
|
|
221
|
+
|
|
222
|
+
// // 判断是否存在git仓库
|
|
223
|
+
// if (cg.git) {
|
|
224
|
+
// if (dir.hasDir('.git')) {
|
|
225
|
+
// // "git fetch";
|
|
226
|
+
// // "git reset --hard origin/master"
|
|
227
|
+
// }
|
|
228
|
+
// }
|
|
229
|
+
// } else {
|
|
230
|
+
// ret = $.ret.error("更新失败!原因:插件不存在");
|
|
231
|
+
// }
|
|
232
|
+
// }
|
|
233
|
+
|
|
204
234
|
module.exports = Plugin;
|
|
205
235
|
|
|
206
236
|
|