diff --git a/makefile.js b/makefile.js index 7b776b6..9f5a496 100644 --- a/makefile.js +++ b/makefile.js @@ -6,7 +6,7 @@ var path = require('path'), child_process = require('child_process'); -var version = '0.3-dev', +var pkg = require('./package.json'), root = path.resolve(__dirname), src = path.resolve(root, 'src'), @@ -56,18 +56,18 @@ module.exports = function (make) { stamp = moment(); replacements = { - version: version, + pkg: pkg, stamp: stamp.format('YYYY-MM-DD HH:mm:ss') }; - Event.info({ method: 'before', message: version + ' ' + replacements.stamp }); + Event.info({ method: 'before', message: pkg.version + ' ' + replacements.stamp }); }); make.target('git-hash', [], 'get git hash tag') .async(function (done, fail) { - if (!/-dev$/.test(version)) { + if (!/-dev$/.test(pkg.version)) { done(); return; } @@ -86,9 +86,8 @@ module.exports = function (make) { Event.error({ method: 'git-hash', message: cmd + ' exit code ' + code }); fail(); } else { - version += '-' + hash; - replacements.version = version; - Event.ok({ method: 'git-hash', message: 'version is now ' + version }); + pkg.version += '-' + hash; + Event.ok({ method: 'git-hash', message: 'version is now ' + pkg.version }); done(); } }); @@ -113,12 +112,14 @@ module.exports = function (make) { make.target('build', ['git-hash'], 'build all updated files') .sync(function () { - $(src + ': jquery.qrcode.js') + var scriptName = pkg.name; + + $(src + ': ' + scriptName + '.js') .includify() .handlebars(replacements) - .write($.OVERWRITE, path.join(build, 'jquery.qrcode-' + version + '.js')) + .write($.OVERWRITE, path.join(build, scriptName + '-' + pkg.version + '.js')) .uglifyjs() - .write($.OVERWRITE, path.join(build, 'jquery.qrcode-' + version + '.min.js')); + .write($.OVERWRITE, path.join(build, scriptName + '-' + pkg.version + '.min.js')); $(root + ': README*, LICENSE*') .write($.OVERWRITE, mapperRoot); @@ -128,7 +129,7 @@ module.exports = function (make) { make.target('release', ['clean', 'build'], 'create a zipball') .async(function (done, fail) { - var target = path.join(build, 'jquery.qrcode-' + version + '.zip'), + var target = path.join(build, pkg.name + '-' + pkg.version + '.zip'), cmd = 'zip', args = ['-ro', target, '.'], options = { cwd: build }, diff --git a/package.json b/package.json new file mode 100644 index 0000000..56c6ae0 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "name": "jquery.qrcode", + "displayName": "jQuery.qrcode", + "version": "0.3-dev" +} \ No newline at end of file diff --git a/src/jquery.qrcode.js b/src/jquery.qrcode.js index b14eb7a..3d09771 100644 --- a/src/jquery.qrcode.js +++ b/src/jquery.qrcode.js @@ -1,4 +1,4 @@ -/*! jQuery.qrcode %BUILD_VERSION% - //larsjung.de/qrcode - MIT License */ +/*! {{pkg.displayName}} {{pkg.version}} - //larsjung.de/qrcode - MIT License */ // Uses [QR Code Generator](http://www.d-project.com/qrcode/index.html) (MIT), appended to the end of this file. // Kudos to [jquery.qrcode.js](http://github.com/jeromeetienne/jquery-qrcode) (MIT).