Switch to using common string format for paper.version (major.minor.build)

This commit is contained in:
Jürg Lehni 2013-05-27 14:27:05 -07:00
parent fef22f25e8
commit 6ac5463630
3 changed files with 11 additions and 10 deletions

View file

@ -24,10 +24,12 @@
# commented Preprocessed, still formated and commented
# stripped Preprocessed, formated but without comments
VERSION=0.8
# Extract paper.js version from package.json
VERSION=`node -e "process.stdout.write(require('../package.json').version)"`
DATE=$(git log -1 --pretty=format:%ad)
COMMAND="./prepro.js -d '{ \"version\": $VERSION, \"date\": \"$DATE\", \"parser\": \"acorn\", \"svg\": true, \"fatline\": false }' $3 $2"
COMMAND="./prepro.js -d '{ \"version\": \"$VERSION\", \"date\": \"$DATE\", \"parser\": \"acorn\", \"svg\": true, \"fatline\": false }' $3 $2"
case $1 in
commented)

View file

@ -71,11 +71,11 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
},
/**
* The version of Paper.js, as a float number.
* The version of Paper.js, as a string.
*
* @type Number
* @type String
*/
version: /*#=*/ options.version,
version: '/*#=*/ options.version',
/**
* The currently active project.

View file

@ -16,8 +16,7 @@ var fs = require('fs'),
// Node Canvas library: https://github.com/learnboost/node-canvas
Canvas = require('canvas'),
jsdom = require('jsdom'),
domToHtml = require('jsdom/lib/jsdom/browser/domtohtml').domToHtml,
json = require('../../package.json');
domToHtml = require('jsdom/lib/jsdom/browser/domtohtml').domToHtml;
var options = {
parser: 'acorn',
@ -41,7 +40,7 @@ XMLSerializer.prototype.serializeToString = function(node) {
var text = domToHtml(node);
// Fix a jsdom issue where linearGradient gets converted to lineargradient:
// https://github.com/tmpvar/jsdom/issues/620
return text.replace(/(linear|radial)(gradient)/g, function(all, type) {
return text.replace(/(linear|radial)gradient/g, function(all, type) {
return type + 'Gradient';
});
};
@ -94,8 +93,8 @@ context.PaperScope.inject({
Canvas: Canvas,
XMLSerializer: XMLSerializer,
DOMParser: DOMParser,
// Also fix version. Remove 2nd dot, so we can make a float out of it:
version: parseFloat(json.version.replace(/(.)(\d)$/, '$2'))
// Also set the correct version from package.json
version: require('../../package.json').version
});
require.extensions['.pjs'] = function(module, uri) {