1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Create crlfchecker module and use it in make.js.

Provide names of the files that contain crlf in the output.
Exit(1) is used instead of throw.
This commit is contained in:
Kalervo Kujala 2012-08-20 20:33:41 +03:00
parent 83eb405f2f
commit 2ffd3ae1c7
2 changed files with 28 additions and 28 deletions

25
external/crlfchecker/crlfchecker.js vendored Normal file
View file

@ -0,0 +1,25 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
function checkIfCrlfIsPresent(files) {
var failed = [];
(ls(files)).forEach(function checkCrlf(file) {
if ((cat(file)).match(/.*\r.*/)) {
failed.push(file);
}
});
if (failed.length) {
var errorMessage =
'Please remove carriage return\'s from\n' + failed.join('\n') + '\n' +
'Also check your setting for: git config core.autocrlf.';
echo();
echo(errorMessage);
exit(1);
}
}
exports.checkIfCrlfIsPresent = checkIfCrlfIsPresent;