1 | (function() {
|
2 | module.exports = function($) {
|
3 | var normalizePathToArray, wrapList;
|
4 | ({normalizePathToArray, wrapList} = $.fn);
|
5 |
|
6 | return $.recover_ = async function(source) {
|
7 | var filename, groupSource, i, len, msg, pathBak;
|
8 | groupSource = normalizePathToArray(source);
|
9 | msg = `recovered ${wrapList(source)}`;
|
10 | for (i = 0, len = groupSource.length; i < len; i++) {
|
11 | source = groupSource[i];
|
12 | pathBak = `${source}.bak`;
|
13 | if (!(await $.isExisted_(pathBak))) {
|
14 | $.info('recover', `'${pathBak}' not found`);
|
15 | continue;
|
16 | }
|
17 | filename = $.getFilename(source);
|
18 | $.info.pause('$.recover_');
|
19 | await $.chain($).remove_(source).copy_(pathBak, null, filename).remove_(pathBak);
|
20 | $.info.resume('$.recover_');
|
21 | }
|
22 | $.info('recover', msg);
|
23 | return $;
|
24 | };
|
25 | };
|
26 |
|
27 | }).call(this);
|