@jdeighan/coffee-utils 6.0.9 → 7.0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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 +107 -98
- package/src/debug_utils.js +93 -91
- package/src/fs_utils.coffee +3 -3
- package/src/fs_utils.js +3 -3
- package/src/indent_utils.coffee +1 -1
- package/src/indent_utils.js +1 -1
- package/src/log_utils.coffee +60 -46
- package/src/log_utils.js +66 -63
- package/src/taml.coffee +0 -1
- package/src/taml.js +0 -5
package/src/debug_utils.coffee
CHANGED
@@ -2,38 +2,31 @@
|
|
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
|
# ---------------------------------------------------------------------------
|
@@ -41,9 +34,10 @@ export setDEBUGDEBUG = (flag=true) ->
|
|
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
42
|
return
|
49
43
|
|
@@ -53,23 +47,23 @@ export setDebugging = (funcDoDebug=undef, funcDoLog=undef) ->
|
|
53
47
|
|
54
48
|
resetDebugging()
|
55
49
|
if isBoolean(funcDoDebug)
|
56
|
-
if DEBUGDEBUG
|
57
|
-
console.log "setDebugging #{funcDoDebug}"
|
58
50
|
debugging = funcDoDebug
|
51
|
+
if doDebugDebug
|
52
|
+
LOG "setDebugging(): debugging = #{funcDoDebug}"
|
59
53
|
else if isString(funcDoDebug)
|
60
54
|
debugging = false
|
61
55
|
lFuncNames = words(funcDoDebug)
|
62
56
|
assert isArray(lFuncNames), "words('#{funcDoDebug}') returned non-array"
|
63
|
-
|
57
|
+
shouldLogFunc = (funcName) ->
|
64
58
|
funcMatch(funcName, lFuncNames)
|
65
|
-
if
|
66
|
-
|
59
|
+
if doDebugDebug
|
60
|
+
LOG "setDebugging FUNCS: #{lFuncNames.join(',')}, debugging = false"
|
67
61
|
else if isFunction(funcDoDebug)
|
68
|
-
|
69
|
-
if
|
70
|
-
|
62
|
+
shouldLogFunc = funcDoDebug
|
63
|
+
if doDebugDebug
|
64
|
+
LOG "setDebugging to custom func"
|
71
65
|
else
|
72
|
-
croak "setDebugging(): bad parameter #{
|
66
|
+
croak "setDebugging(): bad parameter #{OL(funcDoDebug)}"
|
73
67
|
|
74
68
|
if funcDoLog
|
75
69
|
assert isFunction(funcDoLog), "setDebugging: arg 2 not a function"
|
@@ -93,52 +87,37 @@ export funcMatch = (curFunc, lFuncNames) ->
|
|
93
87
|
return false
|
94
88
|
|
95
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
|
96
94
|
|
97
|
-
|
98
|
-
|
99
|
-
return {debugging, shouldDebugFunc, shouldLogString}
|
100
|
-
|
101
|
-
# ---------------------------------------------------------------------------
|
102
|
-
|
103
|
-
setEnv = (hEnv) ->
|
104
|
-
|
105
|
-
{debugging, shouldDebugFunc, shouldLogString} = hEnv
|
106
|
-
return
|
107
|
-
|
108
|
-
# ---------------------------------------------------------------------------
|
109
|
-
|
110
|
-
export debug = (lArgs...) ->
|
111
|
-
|
112
|
-
# --- We want to allow item to be undef. Therefore, we need to
|
113
|
-
# distinguish between 1 arg sent vs. 2+ args sent
|
114
|
-
nArgs = lArgs.length
|
115
|
-
if DEBUGDEBUG
|
116
|
-
LOG "debug() called with #{nArgs} args"
|
117
|
-
[label, item] = lArgs
|
118
|
-
|
119
|
-
# --- We always need to manipulate the stack when we encounter
|
120
|
-
# either "enter X" or "return from X", so we can't short-circuit
|
121
|
-
# when debugging is off
|
122
|
-
|
123
|
-
assert isString(label),
|
124
|
-
"debug(): 1st arg #{oneline(label)} should be a string"
|
95
|
+
adjustStack = (str) ->
|
125
96
|
|
126
|
-
|
127
|
-
entering = returning = false
|
128
|
-
curFunc = undef
|
129
|
-
if (lMatches = label.match(///^
|
97
|
+
if (lMatches = str.match(///^
|
130
98
|
\s*
|
131
99
|
enter
|
132
100
|
\s+
|
133
101
|
([A-Za-z_][A-Za-z0-9_\.]*)
|
134
102
|
///))
|
135
|
-
entering = true
|
136
103
|
curFunc = lMatches[1]
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
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(///^
|
142
121
|
\s*
|
143
122
|
return
|
144
123
|
.+
|
@@ -146,43 +125,73 @@ export debug = (lArgs...) ->
|
|
146
125
|
\s+
|
147
126
|
([A-Za-z_][A-Za-z0-9_\.]*)
|
148
127
|
///))
|
149
|
-
returning = true
|
150
128
|
curFunc = lMatches[1]
|
151
|
-
|
152
|
-
if
|
153
|
-
LOG "RETURN FROM #{curFunc}
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
if (
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
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"
|
164
159
|
|
165
|
-
|
166
|
-
|
160
|
+
if doDebugDebug
|
161
|
+
if nArgs==1
|
162
|
+
LOG "debug('#{escapeStr(label)}')"
|
167
163
|
else
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
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}"
|
186
195
|
return
|
187
196
|
|
188
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,50 +37,43 @@ 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) {
|
@@ -92,27 +86,27 @@ export var setDebugging = function(funcDoDebug = undef, funcDoLog = undef) {
|
|
92
86
|
var lFuncNames;
|
93
87
|
resetDebugging();
|
94
88
|
if (isBoolean(funcDoDebug)) {
|
95
|
-
if (DEBUGDEBUG) {
|
96
|
-
console.log(`setDebugging ${funcDoDebug}`);
|
97
|
-
}
|
98
89
|
debugging = funcDoDebug;
|
90
|
+
if (doDebugDebug) {
|
91
|
+
LOG(`setDebugging(): debugging = ${funcDoDebug}`);
|
92
|
+
}
|
99
93
|
} else if (isString(funcDoDebug)) {
|
100
94
|
debugging = false;
|
101
95
|
lFuncNames = words(funcDoDebug);
|
102
96
|
assert(isArray(lFuncNames), `words('${funcDoDebug}') returned non-array`);
|
103
|
-
|
97
|
+
shouldLogFunc = function(funcName) {
|
104
98
|
return funcMatch(funcName, lFuncNames);
|
105
99
|
};
|
106
|
-
if (
|
107
|
-
|
100
|
+
if (doDebugDebug) {
|
101
|
+
LOG(`setDebugging FUNCS: ${lFuncNames.join(',')}, debugging = false`);
|
108
102
|
}
|
109
103
|
} else if (isFunction(funcDoDebug)) {
|
110
|
-
|
111
|
-
if (
|
112
|
-
|
104
|
+
shouldLogFunc = funcDoDebug;
|
105
|
+
if (doDebugDebug) {
|
106
|
+
LOG("setDebugging to custom func");
|
113
107
|
}
|
114
108
|
} else {
|
115
|
-
croak(`setDebugging(): bad parameter ${
|
109
|
+
croak(`setDebugging(): bad parameter ${OL(funcDoDebug)}`);
|
116
110
|
}
|
117
111
|
if (funcDoLog) {
|
118
112
|
assert(isFunction(funcDoLog), "setDebugging: arg 2 not a function");
|
@@ -136,79 +130,87 @@ export var funcMatch = function(curFunc, lFuncNames) {
|
|
136
130
|
};
|
137
131
|
|
138
132
|
// ---------------------------------------------------------------------------
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
(
|
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
|
+
}
|
146
160
|
};
|
147
161
|
|
148
162
|
// ---------------------------------------------------------------------------
|
149
163
|
export var debug = function(...lArgs) {
|
150
|
-
var
|
164
|
+
var auxPre, hEnv, hOptions, item, label, mainPre, nArgs, orgDebugging, trans, type;
|
151
165
|
// --- We want to allow item to be undef. Therefore, we need to
|
152
166
|
// distinguish between 1 arg sent vs. 2+ args sent
|
153
167
|
nArgs = lArgs.length;
|
154
|
-
|
155
|
-
LOG(`debug() called with ${nArgs} args`);
|
156
|
-
}
|
168
|
+
assert((nArgs === 1) || (nArgs === 2), `debug(): ${nArgs} args`);
|
157
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
|
+
}
|
158
178
|
// --- We always need to manipulate the stack when we encounter
|
159
179
|
// either "enter X" or "return from X", so we can't short-circuit
|
160
180
|
// when debugging is off
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
if (debugLevel === 0) {
|
185
|
-
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);
|
186
204
|
} else {
|
187
|
-
|
205
|
+
log(label, hOptions);
|
188
206
|
}
|
189
|
-
} else {
|
190
|
-
prefix = getPrefix(debugLevel, false); // no arrow
|
191
|
-
}
|
192
|
-
if (nArgs === 1) {
|
193
|
-
log(label, {prefix});
|
194
|
-
} else {
|
195
|
-
itemPrefix = removeArrow(prefix, false);
|
196
|
-
log(item, {label, prefix, itemPrefix});
|
197
|
-
}
|
198
|
-
} else if (DEBUGDEBUG) {
|
199
|
-
LOG(`shouldLogString('${label}') returned FALSE`);
|
200
207
|
}
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
setEnv(hInfo);
|
208
|
-
}
|
209
|
-
} else if (entering) {
|
210
|
-
if (debugging) {
|
211
|
-
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}`);
|
212
214
|
}
|
213
215
|
}
|
214
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);
|
package/src/indent_utils.coffee
CHANGED
@@ -41,7 +41,7 @@ export indentLevel = (str) ->
|
|
41
41
|
# ---------------------------------------------------------------------------
|
42
42
|
# indented - add indentation to each string in a block
|
43
43
|
|
44
|
-
export indented = (input, level=
|
44
|
+
export indented = (input, level=1) ->
|
45
45
|
|
46
46
|
assert (level >= 0), "indented(): negative level"
|
47
47
|
if level == 0
|
package/src/indent_utils.js
CHANGED
@@ -53,7 +53,7 @@ export var indentLevel = function(str) {
|
|
53
53
|
|
54
54
|
// ---------------------------------------------------------------------------
|
55
55
|
// indented - add indentation to each string in a block
|
56
|
-
export var indented = function(input, level =
|
56
|
+
export var indented = function(input, level = 1) {
|
57
57
|
var lInputLines, lLines, line, toAdd;
|
58
58
|
assert(level >= 0, "indented(): negative level");
|
59
59
|
if (level === 0) {
|