Skip to content

Commit d04f953

Browse files
committed
Consistently quote paths in debug and error output
1 parent a0c6998 commit d04f953

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Cookbook.nancy.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ first for files in `source/Places/Vladivostok`, then in `source/places`, and
5757
finally in `source`. Hence, the actual list of files used to assemble the
5858
page is:
5959

60-
$paste{env,NANCY_TMPDIR=/tmp/cookbook-dest.$$,sh,-c,rm -rf ${NANCY_TMPDIR} && DEBUG="*" ./bin/run.js --path Places/Vladivostok test/cookbook-example-website-src ${NANCY_TMPDIR} 2>&1 | grep Found | cut -d " " -f 4 | sort | uniq | sed -e 's|^test/cookbook-example-website-src\(.*\)$|* `source\1`|' && rm -rf ${NANCY_TMPDIR}}
60+
$paste{env,NANCY_TMPDIR=/tmp/cookbook-dest.$$,sh,-c,rm -rf ${NANCY_TMPDIR} && DEBUG="*" ./bin/run.js --path Places/Vladivostok test/cookbook-example-website-src ${NANCY_TMPDIR} 2>&1 | grep Found | cut -d " " -f 4 | sort | uniq | sed -e 's|^'\''test/cookbook-example-website-src\(.*\)'\''$|* `source\1`|' && rm -rf ${NANCY_TMPDIR}}
6161

6262
For the site’s index page, the file `index/logo.in.html` will be used for the
6363
logo fragment, which can refer to the larger graphic desired.

src/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function expand(inputs: string[], outputPath: string, buildPath = ''): vo
7070
if (stats.isDirectory()) {
7171
dirs.push(object)
7272
} else {
73-
throw new Error(`${object} is not a file or directory`)
73+
throw new Error(`'${object}' is not a file or directory`)
7474
}
7575
}
7676
}
@@ -106,14 +106,14 @@ export function expand(inputs: string[], outputPath: string, buildPath = ''): vo
106106
}
107107

108108
const getFile = (leaf: string) => {
109-
debug(`Searching for ${leaf}`)
109+
debug(`Searching for '${leaf}'`)
110110
const startPath = path.dirname(baseFile)
111111
const fileOrExec = findOnPath(startPath.split(path.sep), leaf)
112112
?? which.sync(leaf, {nothrow: true})
113113
if (fileOrExec === null) {
114114
throw new Error(`cannot find '${leaf}' while expanding '${baseFile}'`)
115115
}
116-
debug(`Found ${fileOrExec}`)
116+
debug(`Found '${fileOrExec}'`)
117117
return fileOrExec
118118
}
119119

@@ -223,9 +223,9 @@ export function expand(inputs: string[], outputPath: string, buildPath = ''): vo
223223

224224
const processFile = (baseFile: File, filePath: string): void => {
225225
const outputFile = getOutputPath(baseFile)
226-
debug(`Processing file ${filePath}`)
226+
debug(`Processing file '${filePath}'`)
227227
if (templateRegex.exec(filePath)) {
228-
debug(`Expanding ${baseFile} to ${outputFile}`)
228+
debug(`Expanding '${baseFile}' to '${outputFile}'`)
229229
fs.writeFileSync(outputFile, expandFile(baseFile, filePath))
230230
} else if (!noCopyRegex.exec(filePath)) {
231231
fs.copyFileSync(filePath, outputFile)
@@ -239,7 +239,7 @@ export function expand(inputs: string[], outputPath: string, buildPath = ''): vo
239239
}
240240
if (isDirectory(dirent)) {
241241
const outputDir = getOutputPath(object)
242-
debug(`Entering directory ${object}`)
242+
debug(`Entering directory '${object}'`)
243243
fs.ensureDirSync(outputDir)
244244
for (const childDirent of dirent) {
245245
if (childDirent.name[0] !== '.') {

0 commit comments

Comments
 (0)