@@ -101,6 +101,10 @@ SPEC = [path
|
|||||||
for path in ifind('test/spec')
|
for path in ifind('test/spec')
|
||||||
if path.endswith('.js')]
|
if path.endswith('.js')]
|
||||||
|
|
||||||
|
TASKS = [path
|
||||||
|
for path in ifind('tasks')
|
||||||
|
if path.endswith('.js')]
|
||||||
|
|
||||||
SRC = [path
|
SRC = [path
|
||||||
for path in ifind('src/ol')
|
for path in ifind('src/ol')
|
||||||
if path.endswith('.js')
|
if path.endswith('.js')
|
||||||
@@ -123,14 +127,14 @@ def report_sizes(t):
|
|||||||
virtual('default', 'build')
|
virtual('default', 'build')
|
||||||
|
|
||||||
|
|
||||||
virtual('ci', 'lint', 'jshint', 'build', 'test',
|
virtual('ci', 'lint', 'build', 'test',
|
||||||
'build/examples/all.combined.js', 'check-examples', 'apidoc')
|
'build/examples/all.combined.js', 'check-examples', 'apidoc')
|
||||||
|
|
||||||
|
|
||||||
virtual('build', 'build/ol.css', 'build/ol.js', 'build/ol-debug.js')
|
virtual('build', 'build/ol.css', 'build/ol.js', 'build/ol-debug.js')
|
||||||
|
|
||||||
|
|
||||||
virtual('check', 'lint', 'build/ol.js', 'jshint', 'test')
|
virtual('check', 'lint', 'build/ol.js', 'test')
|
||||||
|
|
||||||
|
|
||||||
virtual('todo', 'fixme')
|
virtual('todo', 'fixme')
|
||||||
@@ -307,7 +311,7 @@ def serve(t):
|
|||||||
|
|
||||||
|
|
||||||
virtual('lint', 'build/lint-timestamp', 'build/check-requires-timestamp',
|
virtual('lint', 'build/lint-timestamp', 'build/check-requires-timestamp',
|
||||||
'build/check-whitespace-timestamp')
|
'build/check-whitespace-timestamp', 'jshint')
|
||||||
|
|
||||||
|
|
||||||
@target('build/lint-timestamp', SRC, EXAMPLES_SRC, SPEC, precious=True)
|
@target('build/lint-timestamp', SRC, EXAMPLES_SRC, SPEC, precious=True)
|
||||||
@@ -322,7 +326,7 @@ def build_lint_src_timestamp(t):
|
|||||||
|
|
||||||
virtual('jshint', 'build/jshint-timestamp')
|
virtual('jshint', 'build/jshint-timestamp')
|
||||||
|
|
||||||
@target('build/jshint-timestamp', SRC, EXAMPLES_SRC, SPEC,
|
@target('build/jshint-timestamp', SRC, EXAMPLES_SRC, SPEC, TASKS,
|
||||||
precious=True)
|
precious=True)
|
||||||
def build_jshint_timestamp(t):
|
def build_jshint_timestamp(t):
|
||||||
t.run(variables.JSHINT, '--verbose', t.newer(t.dependencies))
|
t.run(variables.JSHINT, '--verbose', t.newer(t.dependencies))
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"curly": true,
|
||||||
|
"eqeqeq": true,
|
||||||
|
"indent": 2,
|
||||||
|
"latedef": true,
|
||||||
|
"newcap": true,
|
||||||
|
"nonew": true,
|
||||||
|
"quotmark": "single",
|
||||||
|
"undef": true,
|
||||||
|
"trailing": true,
|
||||||
|
"maxlen": 80,
|
||||||
|
"globals": {
|
||||||
|
"__dirname": false,
|
||||||
|
"exports": true,
|
||||||
|
"module": false,
|
||||||
|
"process": false,
|
||||||
|
"require": false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,8 +26,8 @@ function getConfig(configPath, callback) {
|
|||||||
var obj;
|
var obj;
|
||||||
try {
|
try {
|
||||||
obj = JSON.parse(String(data));
|
obj = JSON.parse(String(data));
|
||||||
} catch (err) {
|
} catch (err2) {
|
||||||
callback(new Error('Trouble parsing file as JSON: ' + options.config));
|
callback(new Error('Trouble parsing file as JSON: ' + configPath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var patterns = obj.exports;
|
var patterns = obj.exports;
|
||||||
@@ -224,7 +224,7 @@ if (require.main === module) {
|
|||||||
fse.outputFile.bind(fse, options.output)
|
fse.outputFile.bind(fse, options.output)
|
||||||
], function(err) {
|
], function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err.message);
|
process.stderr.write(err.message + '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
} else {
|
} else {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
|||||||
@@ -59,14 +59,14 @@ function generateExterns(typedefs, symbols, externs) {
|
|||||||
|
|
||||||
function nameToJS(name) {
|
function nameToJS(name) {
|
||||||
processedSymbols[name] = true;
|
processedSymbols[name] = true;
|
||||||
if (name.indexOf('.') == -1) {
|
if (name.indexOf('.') === -1) {
|
||||||
name = 'var ' + name;
|
name = 'var ' + name;
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function noGoogTypes(typesWithGoog) {
|
function noGoogTypes(typesWithGoog) {
|
||||||
typesWithoutGoog = [];
|
var typesWithoutGoog = [];
|
||||||
typesWithGoog.forEach(function(type) {
|
typesWithGoog.forEach(function(type) {
|
||||||
typesWithoutGoog.push(type.replace(/^goog\..*$/, '*'));
|
typesWithoutGoog.push(type.replace(/^goog\..*$/, '*'));
|
||||||
});
|
});
|
||||||
@@ -91,7 +91,7 @@ function generateExterns(typedefs, symbols, externs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lines.push('/**');
|
lines.push('/**');
|
||||||
if (symbol.kind == 'class') {
|
if (symbol.kind === 'class') {
|
||||||
constructors[name] = true;
|
constructors[name] = true;
|
||||||
lines.push(' * @constructor');
|
lines.push(' * @constructor');
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ function generateExterns(typedefs, symbols, externs) {
|
|||||||
lines.push(' * @template ' + symbol.template);
|
lines.push(' * @template ' + symbol.template);
|
||||||
}
|
}
|
||||||
lines.push(' */');
|
lines.push(' */');
|
||||||
if (symbol.kind == 'function' || symbol.kind == 'class') {
|
if (symbol.kind === 'function' || symbol.kind === 'class') {
|
||||||
lines.push(nameToJS(name) + ' = function(' + args.join(', ') + ') {};');
|
lines.push(nameToJS(name) + ' = function(' + args.join(', ') + ') {};');
|
||||||
} else {
|
} else {
|
||||||
lines.push(nameToJS(name) + ';');
|
lines.push(nameToJS(name) + ';');
|
||||||
@@ -181,7 +181,7 @@ if (require.main === module) {
|
|||||||
fse.outputFile.bind(fse, options.output)
|
fse.outputFile.bind(fse, options.output)
|
||||||
], function(err) {
|
], function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err.message);
|
process.stderr.write(err.message + '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
} else {
|
} else {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
|||||||
+29
-29
@@ -51,7 +51,7 @@ function getNewerExterns(date, callback) {
|
|||||||
walker.on('file', function(root, stats, next) {
|
walker.on('file', function(root, stats, next) {
|
||||||
var sourcePath = path.join(root, stats.name);
|
var sourcePath = path.join(root, stats.name);
|
||||||
externsPaths.forEach(function(path) {
|
externsPaths.forEach(function(path) {
|
||||||
if (sourcePath == path && stats.mtime > date) {
|
if (sourcePath === path && stats.mtime > date) {
|
||||||
newer = true;
|
newer = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -97,6 +97,33 @@ function getNewer(date, newer, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the JSDoc output.
|
||||||
|
* @param {string} output JSDoc output
|
||||||
|
* @return {Object} Symbol and define info.
|
||||||
|
*/
|
||||||
|
function parseOutput(output) {
|
||||||
|
if (!output) {
|
||||||
|
throw new Error('Expected JSON output');
|
||||||
|
}
|
||||||
|
|
||||||
|
var info;
|
||||||
|
try {
|
||||||
|
info = JSON.parse(String(output));
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error('Failed to parse output as JSON: ' + output);
|
||||||
|
}
|
||||||
|
if (!Array.isArray(info.symbols)) {
|
||||||
|
throw new Error('Expected symbols array: ' + output);
|
||||||
|
}
|
||||||
|
if (!Array.isArray(info.defines)) {
|
||||||
|
throw new Error('Expected defines array: ' + output);
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spawn JSDoc.
|
* Spawn JSDoc.
|
||||||
* @param {Array.<string>} paths Paths to source files.
|
* @param {Array.<string>} paths Paths to source files.
|
||||||
@@ -142,33 +169,6 @@ function spawnJSDoc(paths, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse the JSDoc output.
|
|
||||||
* @param {string} output JSDoc output
|
|
||||||
* @return {Object} Symbol and define info.
|
|
||||||
*/
|
|
||||||
function parseOutput(output) {
|
|
||||||
if (!output) {
|
|
||||||
throw new Error('Expected JSON output');
|
|
||||||
}
|
|
||||||
|
|
||||||
var info;
|
|
||||||
try {
|
|
||||||
info = JSON.parse(String(output));
|
|
||||||
} catch (err) {
|
|
||||||
throw new Error('Failed to parse output as JSON: ' + output);
|
|
||||||
}
|
|
||||||
if (!Array.isArray(info.symbols)) {
|
|
||||||
throw new Error('Expected symbols array: ' + output);
|
|
||||||
}
|
|
||||||
if (!Array.isArray(info.defines)) {
|
|
||||||
throw new Error('Expected defines array: ' + output);
|
|
||||||
}
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given the path to a source file, get the list of provides.
|
* Given the path to a source file, get the list of provides.
|
||||||
* @param {string} srcPath Path to source file.
|
* @param {string} srcPath Path to source file.
|
||||||
@@ -268,7 +268,7 @@ function main(callback) {
|
|||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
main(function(err) {
|
main(function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err.message);
|
process.stderr.write(err.message + '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
} else {
|
} else {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ async.waterfall([
|
|||||||
writeExampleList
|
writeExampleList
|
||||||
], function(err) {
|
], function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
process.stderr.write(err + '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -42,13 +42,13 @@ function listen(min, max, server, callback) {
|
|||||||
*/
|
*/
|
||||||
serve.createServer(function(err, server) {
|
serve.createServer(function(err, server) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err.message);
|
process.stderr.write(err.message + '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
listen(3001, 3005, server, function(err) {
|
listen(3001, 3005, server, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('Server failed to start: ' + err.message);
|
process.stderr.write('Server failed to start: ' + err.message + '\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user