diff --git a/Jakefile.js b/Jakefile.js index a6a26220..bb965e41 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -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'); diff --git a/build/build.js b/build/build.js index 777fd27e..46e7a6b9 100644 --- a/build/build.js +++ b/build/build.js @@ -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, diff --git a/src/copyright.js b/src/copyright.js index 375cccab..632aa10b 100644 --- a/src/copyright.js +++ b/src/copyright.js @@ -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 */