@jdeighan/coffee-utils 6.0.7 → 7.0.0
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/package.json +1 -1
- package/src/DataStores.coffee +0 -1
- package/src/DataStores.js +0 -4
- package/src/arrow.coffee +21 -31
- package/src/arrow.js +29 -31
- package/src/call_stack.coffee +68 -21
- package/src/call_stack.js +71 -25
- package/src/coffee_utils.coffee +3 -2
- package/src/coffee_utils.js +8 -3
- package/src/debug_utils.coffee +109 -101
- package/src/debug_utils.js +95 -95
- package/src/fs_utils.coffee +3 -3
- package/src/fs_utils.js +3 -3
- package/src/log_utils.coffee +60 -46
- package/src/log_utils.js +66 -63
- package/src/taml.coffee +30 -4
- package/src/taml.js +35 -8
package/src/debug_utils.coffee
CHANGED
@@ -2,75 +2,68 @@
|
|
2
2
|
|
3
3
|
import {
|
4
4
|
assert, undef, error, croak, warn, isString, isFunction, isBoolean,
|
5
|
-
|
5
|
+
OL, escapeStr, isNumber, isArray, words, pass,
|
6
6
|
} from '@jdeighan/coffee-utils'
|
7
7
|
import {blockToArray} from '@jdeighan/coffee-utils/block'
|
8
8
|
import {untabify} from '@jdeighan/coffee-utils/indent'
|
9
9
|
import {slurp} from '@jdeighan/coffee-utils/fs'
|
10
10
|
import {CallStack} from '@jdeighan/coffee-utils/stack'
|
11
11
|
import {
|
12
|
-
log, LOG, setStringifier, orderedStringify,
|
12
|
+
log, logItem, LOG, setStringifier, orderedStringify,
|
13
13
|
} from '@jdeighan/coffee-utils/log'
|
14
|
-
import {getPrefix, arrow, removeArrow} from '@jdeighan/coffee-utils/arrow'
|
15
|
-
|
16
|
-
debugLevel = 0 # controls amount of indentation - we ensure it's never < 0
|
17
14
|
|
18
15
|
# --- These are saved/restored on the call stack
|
19
16
|
export debugging = false
|
20
|
-
|
21
|
-
# --- By default, when entering a function, keep the debugging flag
|
22
|
-
# as it was
|
23
|
-
shouldDebugFunc = (func) -> debugging
|
24
|
-
|
25
|
-
# --- By default, log everything when debugging flag is on
|
17
|
+
shouldLogFunc = (func) -> debugging
|
26
18
|
shouldLogString = (str) -> debugging
|
27
19
|
|
28
20
|
stack = new CallStack()
|
29
|
-
|
21
|
+
doDebugDebug = false
|
30
22
|
|
31
23
|
# ---------------------------------------------------------------------------
|
32
24
|
|
33
|
-
export
|
25
|
+
export debugDebug = (flag=true) ->
|
34
26
|
|
35
|
-
|
36
|
-
|
27
|
+
doDebugDebug = flag
|
28
|
+
if doDebugDebug
|
29
|
+
LOG "doDebugDebug = #{flag}"
|
37
30
|
return
|
38
31
|
|
39
32
|
# ---------------------------------------------------------------------------
|
40
33
|
|
41
|
-
|
34
|
+
resetDebugging = () ->
|
42
35
|
|
43
36
|
debugging = false
|
44
|
-
|
37
|
+
if doDebugDebug
|
38
|
+
LOG "resetDebugging() - debugging = false"
|
45
39
|
stack.reset()
|
46
|
-
|
40
|
+
shouldLogFunc = (func) -> debugging
|
47
41
|
shouldLogString = (str) -> debugging
|
48
|
-
if funcDoDebug
|
49
|
-
setDebugging funcDoDebug, funcDoLog
|
50
42
|
return
|
51
43
|
|
52
44
|
# ---------------------------------------------------------------------------
|
53
45
|
|
54
46
|
export setDebugging = (funcDoDebug=undef, funcDoLog=undef) ->
|
55
47
|
|
48
|
+
resetDebugging()
|
56
49
|
if isBoolean(funcDoDebug)
|
57
|
-
if DEBUGDEBUG
|
58
|
-
console.log "setDebugging #{funcDoDebug}"
|
59
50
|
debugging = funcDoDebug
|
51
|
+
if doDebugDebug
|
52
|
+
LOG "setDebugging(): debugging = #{funcDoDebug}"
|
60
53
|
else if isString(funcDoDebug)
|
61
54
|
debugging = false
|
62
55
|
lFuncNames = words(funcDoDebug)
|
63
56
|
assert isArray(lFuncNames), "words('#{funcDoDebug}') returned non-array"
|
64
|
-
|
57
|
+
shouldLogFunc = (funcName) ->
|
65
58
|
funcMatch(funcName, lFuncNames)
|
66
|
-
if
|
67
|
-
|
59
|
+
if doDebugDebug
|
60
|
+
LOG "setDebugging FUNCS: #{lFuncNames.join(',')}, debugging = false"
|
68
61
|
else if isFunction(funcDoDebug)
|
69
|
-
|
70
|
-
if
|
71
|
-
|
62
|
+
shouldLogFunc = funcDoDebug
|
63
|
+
if doDebugDebug
|
64
|
+
LOG "setDebugging to custom func"
|
72
65
|
else
|
73
|
-
croak "setDebugging(): bad parameter #{
|
66
|
+
croak "setDebugging(): bad parameter #{OL(funcDoDebug)}"
|
74
67
|
|
75
68
|
if funcDoLog
|
76
69
|
assert isFunction(funcDoLog), "setDebugging: arg 2 not a function"
|
@@ -94,52 +87,37 @@ export funcMatch = (curFunc, lFuncNames) ->
|
|
94
87
|
return false
|
95
88
|
|
96
89
|
# ---------------------------------------------------------------------------
|
90
|
+
# 1. adjust call stack on 'enter' or 'return from'
|
91
|
+
# 2. adjust debugging flag
|
92
|
+
# 3. return [mainPrefix, auxPrefix, hEnv] - hEnv can be undef
|
93
|
+
# 4. disable logging by setting mainPrefix to undef
|
97
94
|
|
98
|
-
|
99
|
-
|
100
|
-
return {debugging, shouldDebugFunc, shouldLogString}
|
101
|
-
|
102
|
-
# ---------------------------------------------------------------------------
|
103
|
-
|
104
|
-
setEnv = (hEnv) ->
|
105
|
-
|
106
|
-
{debugging, shouldDebugFunc, shouldLogString} = hEnv
|
107
|
-
return
|
108
|
-
|
109
|
-
# ---------------------------------------------------------------------------
|
110
|
-
|
111
|
-
export debug = (lArgs...) ->
|
112
|
-
|
113
|
-
# --- We want to allow item to be undef. Therefore, we need to
|
114
|
-
# distinguish between 1 arg sent vs. 2+ args sent
|
115
|
-
nArgs = lArgs.length
|
116
|
-
if DEBUGDEBUG
|
117
|
-
LOG "debug() called with #{nArgs} args"
|
118
|
-
[label, item] = lArgs
|
119
|
-
|
120
|
-
# --- We always need to manipulate the stack when we encounter
|
121
|
-
# either "enter X" or "return from X", so we can't short-circuit
|
122
|
-
# when debugging is off
|
123
|
-
|
124
|
-
assert isString(label),
|
125
|
-
"debug(): 1st arg #{oneline(label)} should be a string"
|
95
|
+
adjustStack = (str) ->
|
126
96
|
|
127
|
-
|
128
|
-
entering = returning = false
|
129
|
-
curFunc = undef
|
130
|
-
if (lMatches = label.match(///^
|
97
|
+
if (lMatches = str.match(///^
|
131
98
|
\s*
|
132
99
|
enter
|
133
100
|
\s+
|
134
101
|
([A-Za-z_][A-Za-z0-9_\.]*)
|
135
102
|
///))
|
136
|
-
entering = true
|
137
103
|
curFunc = lMatches[1]
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
104
|
+
hEnv = {
|
105
|
+
debugging
|
106
|
+
shouldLogFunc
|
107
|
+
shouldLogString
|
108
|
+
}
|
109
|
+
debugging = shouldLogFunc(curFunc)
|
110
|
+
if doDebugDebug
|
111
|
+
trans = "#{hEnv.debugging} => #{debugging}"
|
112
|
+
LOG " ENTER #{curFunc}, debugging: #{trans}"
|
113
|
+
[mainPre, auxPre, _] = stack.call(curFunc, hEnv, debugging)
|
114
|
+
return [
|
115
|
+
mainPre
|
116
|
+
auxPre
|
117
|
+
undef
|
118
|
+
if shouldLogFunc(curFunc) then 'enter' else undef
|
119
|
+
]
|
120
|
+
else if (lMatches = str.match(///^
|
143
121
|
\s*
|
144
122
|
return
|
145
123
|
.+
|
@@ -147,43 +125,73 @@ export debug = (lArgs...) ->
|
|
147
125
|
\s+
|
148
126
|
([A-Za-z_][A-Za-z0-9_\.]*)
|
149
127
|
///))
|
150
|
-
returning = true
|
151
128
|
curFunc = lMatches[1]
|
152
|
-
|
153
|
-
if
|
154
|
-
LOG "RETURN FROM #{curFunc}
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
if (
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
129
|
+
[mainPre, auxPre, hEnv] = stack.returnFrom(curFunc)
|
130
|
+
if doDebugDebug
|
131
|
+
LOG " RETURN FROM #{curFunc}"
|
132
|
+
return [
|
133
|
+
mainPre
|
134
|
+
auxPre
|
135
|
+
hEnv
|
136
|
+
if shouldLogFunc(curFunc) then 'return' else undef
|
137
|
+
]
|
138
|
+
else
|
139
|
+
[mainPre, auxPre, _] = stack.logStr()
|
140
|
+
return [
|
141
|
+
mainPre
|
142
|
+
auxPre
|
143
|
+
undef
|
144
|
+
if shouldLogString(str) then 'string' else undef
|
145
|
+
]
|
146
|
+
return
|
147
|
+
|
148
|
+
# ---------------------------------------------------------------------------
|
149
|
+
|
150
|
+
export debug = (lArgs...) ->
|
151
|
+
|
152
|
+
# --- We want to allow item to be undef. Therefore, we need to
|
153
|
+
# distinguish between 1 arg sent vs. 2+ args sent
|
154
|
+
nArgs = lArgs.length
|
155
|
+
assert (nArgs==1) || (nArgs==2), "debug(): #{nArgs} args"
|
156
|
+
[label, item] = lArgs
|
157
|
+
assert isString(label),
|
158
|
+
"debug(): 1st arg #{OL(label)} should be a string"
|
165
159
|
|
166
|
-
|
167
|
-
|
160
|
+
if doDebugDebug
|
161
|
+
if nArgs==1
|
162
|
+
LOG "debug('#{escapeStr(label)}')"
|
168
163
|
else
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
164
|
+
LOG "debug('#{escapeStr(label)}', #{typeof item})"
|
165
|
+
|
166
|
+
# --- We always need to manipulate the stack when we encounter
|
167
|
+
# either "enter X" or "return from X", so we can't short-circuit
|
168
|
+
# when debugging is off
|
169
|
+
|
170
|
+
[mainPre, auxPre, hEnv, type] = adjustStack(label)
|
171
|
+
hOptions = {prefix: mainPre, itemPrefix: auxPre}
|
172
|
+
switch type
|
173
|
+
when 'enter'
|
174
|
+
log label, hOptions
|
175
|
+
if item
|
176
|
+
# --- don't repeat the label
|
177
|
+
logItem undef, item, hOptions
|
178
|
+
when 'return'
|
179
|
+
log label, hOptions
|
180
|
+
if item
|
181
|
+
# --- don't repeat the label
|
182
|
+
logItem undef, item, hOptions
|
183
|
+
when 'string'
|
184
|
+
if item
|
185
|
+
logItem label, item, hOptions
|
186
|
+
else
|
187
|
+
log label, hOptions
|
188
|
+
|
189
|
+
if hEnv
|
190
|
+
orgDebugging = debugging
|
191
|
+
{debugging, shouldLogFunc, shouldLogString} = hEnv
|
192
|
+
if doDebugDebug
|
193
|
+
trans = "#{orgDebugging} => #{debugging}"
|
194
|
+
LOG " Restore hEnv: debugging: #{trans}"
|
187
195
|
return
|
188
196
|
|
189
197
|
# ---------------------------------------------------------------------------
|
package/src/debug_utils.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// Generated by CoffeeScript 2.6.1
|
2
2
|
// debug_utils.coffee
|
3
|
-
var
|
3
|
+
var adjustStack, doDebugDebug, reMethod, resetDebugging, shouldLogFunc, shouldLogString, stack;
|
4
4
|
|
5
5
|
import {
|
6
6
|
assert,
|
@@ -11,11 +11,12 @@ import {
|
|
11
11
|
isString,
|
12
12
|
isFunction,
|
13
13
|
isBoolean,
|
14
|
-
|
14
|
+
OL,
|
15
15
|
escapeStr,
|
16
16
|
isNumber,
|
17
17
|
isArray,
|
18
|
-
words
|
18
|
+
words,
|
19
|
+
pass
|
19
20
|
} from '@jdeighan/coffee-utils';
|
20
21
|
|
21
22
|
import {
|
@@ -36,85 +37,76 @@ import {
|
|
36
37
|
|
37
38
|
import {
|
38
39
|
log,
|
40
|
+
logItem,
|
39
41
|
LOG,
|
40
42
|
setStringifier,
|
41
43
|
orderedStringify
|
42
44
|
} from '@jdeighan/coffee-utils/log';
|
43
45
|
|
44
|
-
import {
|
45
|
-
getPrefix,
|
46
|
-
arrow,
|
47
|
-
removeArrow
|
48
|
-
} from '@jdeighan/coffee-utils/arrow';
|
49
|
-
|
50
|
-
debugLevel = 0; // controls amount of indentation - we ensure it's never < 0
|
51
|
-
|
52
|
-
|
53
46
|
// --- These are saved/restored on the call stack
|
54
47
|
export var debugging = false;
|
55
48
|
|
56
|
-
|
57
|
-
// as it was
|
58
|
-
shouldDebugFunc = function(func) {
|
49
|
+
shouldLogFunc = function(func) {
|
59
50
|
return debugging;
|
60
51
|
};
|
61
52
|
|
62
|
-
// --- By default, log everything when debugging flag is on
|
63
53
|
shouldLogString = function(str) {
|
64
54
|
return debugging;
|
65
55
|
};
|
66
56
|
|
67
57
|
stack = new CallStack();
|
68
58
|
|
69
|
-
|
59
|
+
doDebugDebug = false;
|
70
60
|
|
71
61
|
// ---------------------------------------------------------------------------
|
72
|
-
export var
|
73
|
-
|
74
|
-
|
62
|
+
export var debugDebug = function(flag = true) {
|
63
|
+
doDebugDebug = flag;
|
64
|
+
if (doDebugDebug) {
|
65
|
+
LOG(`doDebugDebug = ${flag}`);
|
66
|
+
}
|
75
67
|
};
|
76
68
|
|
77
69
|
// ---------------------------------------------------------------------------
|
78
|
-
|
70
|
+
resetDebugging = function() {
|
79
71
|
debugging = false;
|
80
|
-
|
72
|
+
if (doDebugDebug) {
|
73
|
+
LOG("resetDebugging() - debugging = false");
|
74
|
+
}
|
81
75
|
stack.reset();
|
82
|
-
|
76
|
+
shouldLogFunc = function(func) {
|
83
77
|
return debugging;
|
84
78
|
};
|
85
79
|
shouldLogString = function(str) {
|
86
80
|
return debugging;
|
87
81
|
};
|
88
|
-
if (funcDoDebug) {
|
89
|
-
setDebugging(funcDoDebug, funcDoLog);
|
90
|
-
}
|
91
82
|
};
|
92
83
|
|
93
84
|
// ---------------------------------------------------------------------------
|
94
85
|
export var setDebugging = function(funcDoDebug = undef, funcDoLog = undef) {
|
95
86
|
var lFuncNames;
|
87
|
+
resetDebugging();
|
96
88
|
if (isBoolean(funcDoDebug)) {
|
97
|
-
if (DEBUGDEBUG) {
|
98
|
-
console.log(`setDebugging ${funcDoDebug}`);
|
99
|
-
}
|
100
89
|
debugging = funcDoDebug;
|
90
|
+
if (doDebugDebug) {
|
91
|
+
LOG(`setDebugging(): debugging = ${funcDoDebug}`);
|
92
|
+
}
|
101
93
|
} else if (isString(funcDoDebug)) {
|
102
94
|
debugging = false;
|
103
95
|
lFuncNames = words(funcDoDebug);
|
104
96
|
assert(isArray(lFuncNames), `words('${funcDoDebug}') returned non-array`);
|
105
|
-
|
97
|
+
shouldLogFunc = function(funcName) {
|
106
98
|
return funcMatch(funcName, lFuncNames);
|
107
99
|
};
|
108
|
-
if (
|
109
|
-
|
100
|
+
if (doDebugDebug) {
|
101
|
+
LOG(`setDebugging FUNCS: ${lFuncNames.join(',')}, debugging = false`);
|
110
102
|
}
|
111
103
|
} else if (isFunction(funcDoDebug)) {
|
112
|
-
|
113
|
-
if (
|
114
|
-
|
104
|
+
shouldLogFunc = funcDoDebug;
|
105
|
+
if (doDebugDebug) {
|
106
|
+
LOG("setDebugging to custom func");
|
115
107
|
}
|
116
108
|
} else {
|
117
|
-
croak(`setDebugging(): bad parameter ${
|
109
|
+
croak(`setDebugging(): bad parameter ${OL(funcDoDebug)}`);
|
118
110
|
}
|
119
111
|
if (funcDoLog) {
|
120
112
|
assert(isFunction(funcDoLog), "setDebugging: arg 2 not a function");
|
@@ -138,79 +130,87 @@ export var funcMatch = function(curFunc, lFuncNames) {
|
|
138
130
|
};
|
139
131
|
|
140
132
|
// ---------------------------------------------------------------------------
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
(
|
133
|
+
// 1. adjust call stack on 'enter' or 'return from'
|
134
|
+
// 2. adjust debugging flag
|
135
|
+
// 3. return [mainPrefix, auxPrefix, hEnv] - hEnv can be undef
|
136
|
+
// 4. disable logging by setting mainPrefix to undef
|
137
|
+
adjustStack = function(str) {
|
138
|
+
var _, auxPre, curFunc, hEnv, lMatches, mainPre, trans;
|
139
|
+
if ((lMatches = str.match(/^\s*enter\s+([A-Za-z_][A-Za-z0-9_\.]*)/))) {
|
140
|
+
curFunc = lMatches[1];
|
141
|
+
hEnv = {debugging, shouldLogFunc, shouldLogString};
|
142
|
+
debugging = shouldLogFunc(curFunc);
|
143
|
+
if (doDebugDebug) {
|
144
|
+
trans = `${hEnv.debugging} => ${debugging}`;
|
145
|
+
LOG(` ENTER ${curFunc}, debugging: ${trans}`);
|
146
|
+
}
|
147
|
+
[mainPre, auxPre, _] = stack.call(curFunc, hEnv, debugging);
|
148
|
+
return [mainPre, auxPre, undef, shouldLogFunc(curFunc) ? 'enter' : undef];
|
149
|
+
} else if ((lMatches = str.match(/^\s*return.+from\s+([A-Za-z_][A-Za-z0-9_\.]*)/))) {
|
150
|
+
curFunc = lMatches[1];
|
151
|
+
[mainPre, auxPre, hEnv] = stack.returnFrom(curFunc);
|
152
|
+
if (doDebugDebug) {
|
153
|
+
LOG(` RETURN FROM ${curFunc}`);
|
154
|
+
}
|
155
|
+
return [mainPre, auxPre, hEnv, shouldLogFunc(curFunc) ? 'return' : undef];
|
156
|
+
} else {
|
157
|
+
[mainPre, auxPre, _] = stack.logStr();
|
158
|
+
return [mainPre, auxPre, undef, shouldLogString(str) ? 'string' : undef];
|
159
|
+
}
|
148
160
|
};
|
149
161
|
|
150
162
|
// ---------------------------------------------------------------------------
|
151
163
|
export var debug = function(...lArgs) {
|
152
|
-
var
|
164
|
+
var auxPre, hEnv, hOptions, item, label, mainPre, nArgs, orgDebugging, trans, type;
|
153
165
|
// --- We want to allow item to be undef. Therefore, we need to
|
154
166
|
// distinguish between 1 arg sent vs. 2+ args sent
|
155
167
|
nArgs = lArgs.length;
|
156
|
-
|
157
|
-
LOG(`debug() called with ${nArgs} args`);
|
158
|
-
}
|
168
|
+
assert((nArgs === 1) || (nArgs === 2), `debug(): ${nArgs} args`);
|
159
169
|
[label, item] = lArgs;
|
170
|
+
assert(isString(label), `debug(): 1st arg ${OL(label)} should be a string`);
|
171
|
+
if (doDebugDebug) {
|
172
|
+
if (nArgs === 1) {
|
173
|
+
LOG(`debug('${escapeStr(label)}')`);
|
174
|
+
} else {
|
175
|
+
LOG(`debug('${escapeStr(label)}', ${typeof item})`);
|
176
|
+
}
|
177
|
+
}
|
160
178
|
// --- We always need to manipulate the stack when we encounter
|
161
179
|
// either "enter X" or "return from X", so we can't short-circuit
|
162
180
|
// when debugging is off
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
if (debugLevel === 0) {
|
187
|
-
prefix = arrow;
|
181
|
+
[mainPre, auxPre, hEnv, type] = adjustStack(label);
|
182
|
+
hOptions = {
|
183
|
+
prefix: mainPre,
|
184
|
+
itemPrefix: auxPre
|
185
|
+
};
|
186
|
+
switch (type) {
|
187
|
+
case 'enter':
|
188
|
+
log(label, hOptions);
|
189
|
+
if (item) {
|
190
|
+
// --- don't repeat the label
|
191
|
+
logItem(undef, item, hOptions);
|
192
|
+
}
|
193
|
+
break;
|
194
|
+
case 'return':
|
195
|
+
log(label, hOptions);
|
196
|
+
if (item) {
|
197
|
+
// --- don't repeat the label
|
198
|
+
logItem(undef, item, hOptions);
|
199
|
+
}
|
200
|
+
break;
|
201
|
+
case 'string':
|
202
|
+
if (item) {
|
203
|
+
logItem(label, item, hOptions);
|
188
204
|
} else {
|
189
|
-
|
205
|
+
log(label, hOptions);
|
190
206
|
}
|
191
|
-
} else {
|
192
|
-
prefix = getPrefix(debugLevel, false); // no arrow
|
193
|
-
}
|
194
|
-
if (nArgs === 1) {
|
195
|
-
log(label, {prefix});
|
196
|
-
} else {
|
197
|
-
itemPrefix = removeArrow(prefix, false);
|
198
|
-
log(item, {label, prefix, itemPrefix});
|
199
|
-
}
|
200
|
-
} else if (DEBUGDEBUG) {
|
201
|
-
LOG(`shouldLogString('${label}') returned FALSE`);
|
202
207
|
}
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
setEnv(hInfo);
|
210
|
-
}
|
211
|
-
} else if (entering) {
|
212
|
-
if (debugging) {
|
213
|
-
debugLevel += 1;
|
208
|
+
if (hEnv) {
|
209
|
+
orgDebugging = debugging;
|
210
|
+
({debugging, shouldLogFunc, shouldLogString} = hEnv);
|
211
|
+
if (doDebugDebug) {
|
212
|
+
trans = `${orgDebugging} => ${debugging}`;
|
213
|
+
LOG(` Restore hEnv: debugging: ${trans}`);
|
214
214
|
}
|
215
215
|
}
|
216
216
|
};
|
package/src/fs_utils.coffee
CHANGED
@@ -84,7 +84,7 @@ export getFullPath = (filepath) ->
|
|
84
84
|
|
85
85
|
# --- If report is true, missing source files are not an error
|
86
86
|
# but both missing source files and successful copies
|
87
|
-
# are reported via
|
87
|
+
# are reported via LOG
|
88
88
|
|
89
89
|
export backup = (file, from, to, report=false) ->
|
90
90
|
src = mkpath(from, file)
|
@@ -92,10 +92,10 @@ export backup = (file, from, to, report=false) ->
|
|
92
92
|
|
93
93
|
if report
|
94
94
|
if fs.existsSync(src)
|
95
|
-
|
95
|
+
LOG "OK #{file}"
|
96
96
|
fs.copyFileSync(src, dest)
|
97
97
|
else
|
98
|
-
|
98
|
+
LOG "MISSING #{src}"
|
99
99
|
else
|
100
100
|
fs.copyFileSync(src, dest)
|
101
101
|
|
package/src/fs_utils.js
CHANGED
@@ -103,17 +103,17 @@ export var getFullPath = function(filepath) {
|
|
103
103
|
|
104
104
|
// --- If report is true, missing source files are not an error
|
105
105
|
// but both missing source files and successful copies
|
106
|
-
// are reported via
|
106
|
+
// are reported via LOG
|
107
107
|
export var backup = function(file, from, to, report = false) {
|
108
108
|
var dest, src;
|
109
109
|
src = mkpath(from, file);
|
110
110
|
dest = mkpath(to, file);
|
111
111
|
if (report) {
|
112
112
|
if (fs.existsSync(src)) {
|
113
|
-
|
113
|
+
LOG(`OK ${file}`);
|
114
114
|
return fs.copyFileSync(src, dest);
|
115
115
|
} else {
|
116
|
-
return
|
116
|
+
return LOG(`MISSING ${src}`);
|
117
117
|
}
|
118
118
|
} else {
|
119
119
|
return fs.copyFileSync(src, dest);
|