2012-12-18 01:15:19 +08:00
|
|
|
/*
|
2013-02-01 21:17:08 +08:00
|
|
|
Leaflet building, testing and linting scripts.
|
2011-12-12 08:32:53 +08:00
|
|
|
|
2012-12-18 01:15:19 +08:00
|
|
|
To use, install Node, then run the following commands in the project root:
|
2011-12-12 08:32:53 +08:00
|
|
|
|
2012-12-18 01:15:19 +08:00
|
|
|
npm install -g jake
|
2013-02-08 01:00:15 +08:00
|
|
|
npm install
|
2012-07-12 15:39:22 +08:00
|
|
|
|
2013-02-08 01:00:15 +08:00
|
|
|
To check the code for errors and build Leaflet from source, run "jake".
|
|
|
|
To run the tests, run "jake test".
|
2012-02-13 22:25:57 +08:00
|
|
|
|
2012-12-18 01:15:19 +08:00
|
|
|
For a custom build, open build/build.html in the browser and follow the instructions.
|
|
|
|
*/
|
2012-02-13 22:25:57 +08:00
|
|
|
|
2012-12-18 01:15:19 +08:00
|
|
|
var build = require('./build/build.js');
|
2012-02-13 22:25:57 +08:00
|
|
|
|
2013-11-08 23:55:58 +08:00
|
|
|
function hint(msg, paths) {
|
|
|
|
return function () {
|
|
|
|
console.log(msg);
|
2013-11-13 04:53:07 +08:00
|
|
|
jake.exec('node node_modules/jshint/bin/jshint -c ' + paths,
|
2013-11-08 23:55:58 +08:00
|
|
|
{printStdout: true}, function () {
|
|
|
|
console.log('\tCheck passed.\n');
|
|
|
|
complete();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-18 01:15:19 +08:00
|
|
|
desc('Check Leaflet source for errors with JSHint');
|
2013-11-08 23:55:58 +08:00
|
|
|
task('lint', {async: true}, hint('Checking for JS errors...', 'build/hintrc.js src'));
|
|
|
|
|
|
|
|
desc('Check Leaflet specs source for errors with JSHint');
|
|
|
|
task('lintspec', {async: true}, hint('Checking for specs JS errors...', 'spec/spec.hintrc.js spec/suites'));
|
2011-12-13 01:54:03 +08:00
|
|
|
|
2011-12-13 03:48:20 +08:00
|
|
|
desc('Combine and compress Leaflet source files');
|
2013-11-28 20:56:32 +08:00
|
|
|
task('build', {async: true}, function () {
|
|
|
|
build.build(complete);
|
|
|
|
});
|
2011-12-12 04:45:49 +08:00
|
|
|
|
2013-02-01 21:17:08 +08:00
|
|
|
desc('Run PhantomJS tests');
|
2013-11-08 23:55:58 +08:00
|
|
|
task('test', ['lint', 'lintspec'], {async: true}, function () {
|
|
|
|
build.test(complete);
|
|
|
|
});
|
|
|
|
|
|
|
|
task('default', ['test', 'build']);
|
2013-01-30 22:06:19 +08:00
|
|
|
|
2013-11-08 23:55:58 +08:00
|
|
|
jake.addListener('complete', function () {
|
|
|
|
process.exit();
|
|
|
|
});
|