Merge pull request #1999 from kkujala/master
Add carriage return checks to make.js.
This commit is contained in:
commit
ace05a7776
25
external/crlfchecker/crlfchecker.js
vendored
Normal file
25
external/crlfchecker/crlfchecker.js
vendored
Normal 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;
|
||||||
|
|
22
make.js
22
make.js
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
require('./external/shelljs/make');
|
require('./external/shelljs/make');
|
||||||
var builder = require('./external/builder/builder.js');
|
var builder = require('./external/builder/builder.js');
|
||||||
|
var crlfchecker = require('./external/crlfchecker/crlfchecker.js');
|
||||||
|
|
||||||
var ROOT_DIR = __dirname + '/', // absolute path to project's root
|
var ROOT_DIR = __dirname + '/', // absolute path to project's root
|
||||||
BUILD_DIR = 'build/',
|
BUILD_DIR = 'build/',
|
||||||
@ -218,6 +219,8 @@ target.bundle = function() {
|
|||||||
bundleVersion = exec('git log --format="%h" -n 1',
|
bundleVersion = exec('git log --format="%h" -n 1',
|
||||||
{silent: true}).output.replace('\n', '');
|
{silent: true}).output.replace('\n', '');
|
||||||
|
|
||||||
|
crlfchecker.checkIfCrlfIsPresent(SRC_FILES);
|
||||||
|
|
||||||
// This just preprocesses the empty pdf.js file, we don't actually want to
|
// This just preprocesses the empty pdf.js file, we don't actually want to
|
||||||
// preprocess everything yet since other build targets use this file.
|
// preprocess everything yet since other build targets use this file.
|
||||||
builder.preprocess('pdf.js', ROOT_DIR + BUILD_TARGET,
|
builder.preprocess('pdf.js', ROOT_DIR + BUILD_TARGET,
|
||||||
@ -673,15 +676,17 @@ target.lint = function() {
|
|||||||
echo();
|
echo();
|
||||||
echo('### Linting JS files (this can take a while!)');
|
echo('### Linting JS files (this can take a while!)');
|
||||||
|
|
||||||
var LINT_FILES = 'src/*.js \
|
var LINT_FILES = ['src/*.js',
|
||||||
web/*.js \
|
'web/*.js',
|
||||||
test/*.js \
|
'test/*.js',
|
||||||
test/unit/*.js \
|
'test/unit/*.js',
|
||||||
extensions/firefox/*.js \
|
'extensions/firefox/*.js',
|
||||||
extensions/firefox/components/*.js \
|
'extensions/firefox/components/*.js',
|
||||||
extensions/chrome/*.js';
|
'extensions/chrome/*.js'];
|
||||||
|
|
||||||
exec('gjslint --nojsdoc ' + LINT_FILES);
|
exec('gjslint --nojsdoc ' + LINT_FILES.join(' '));
|
||||||
|
|
||||||
|
crlfchecker.checkIfCrlfIsPresent(LINT_FILES);
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -694,3 +699,4 @@ target.clean = function() {
|
|||||||
|
|
||||||
rm('-rf', BUILD_DIR);
|
rm('-rf', BUILD_DIR);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user