include version info in top comment, close #2276

This commit is contained in:
Vladimir Agafonkin 2013-12-26 18:46:00 +02:00
parent abdf0c2afa
commit 9ae1623910
3 changed files with 14 additions and 7 deletions

View File

@ -12,7 +12,8 @@ To run the tests, run "jake test".
For a custom build, open build/build.html in the browser and follow the instructions.
*/
var build = require('./build/build.js');
var build = require('./build/build.js'),
version = require('./src/Leaflet.js').version;
function hint(msg, paths) {
return function () {
@ -33,7 +34,14 @@ task('lintspec', {async: true}, hint('Checking for specs JS errors...', 'spec/sp
desc('Combine and compress Leaflet source files');
task('build', {async: true}, function (compsBase32, buildName) {
build.build(complete, compsBase32, buildName);
var v;
jake.exec('git log -1 --pretty=format:"%h"', {}, function () {
build.build(complete, v, compsBase32, buildName);
}).on('stdout', function (data) {
v = version + ' (' + data.toString() + ')';
})
});
desc('Run PhantomJS tests');

View File

@ -82,13 +82,13 @@ function bytesToKB(bytes) {
return (bytes / 1024).toFixed(2) + ' KB';
};
exports.build = function (callback, compsBase32, buildName) {
exports.build = function (callback, version, compsBase32, buildName) {
var files = getFiles(compsBase32);
console.log('Concatenating and compressing ' + files.length + ' files...');
var copy = fs.readFileSync('src/copyright.js', 'utf8'),
var copy = fs.readFileSync('src/copyright.js', 'utf8').replace('{VERSION}', version),
intro = '(function (window, document, undefined) {',
outro = '}(window, document));',
newSrc = copy + intro + combineFiles(files) + outro,

View File

@ -1,5 +1,4 @@
/*
Leaflet, a JavaScript library for mobile-friendly interactive maps. http://leafletjs.com
(c) 2010-2013, Vladimir Agafonkin
(c) 2010-2011, CloudMade
Leaflet {VERSION}, a JS library for interactive maps. http://leafletjs.com
(c) 2010-2013 Vladimir Agafonkin, (c) 2010-2011 CloudMade
*/