first pass at migrating the old Ruby build to Grunt

This commit is contained in:
Eric Rowell 2013-06-01 00:53:32 -07:00
parent 7b9322c15c
commit 489b7825c3
4 changed files with 127 additions and 4 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ jsdoc-master
dist
tests/js/unitTests.js
analysis
node_modules
# Numerous always-ignore extensions
*.diff

94
Gruntfile.js Normal file
View File

@ -0,0 +1,94 @@
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
src: [
// core / anim + tween + dd
'src/Global.js',
'src/Util.js',
'src/Canvas.js',
'src/Node.js',
'src/Animation.js',
'src/Tween.js',
'src/DragAndDrop.js',
'src/Container.js',
'src/Shape.js',
'src/Stage.js',
'src/Layer.js',
'src/Group.js',
// shapes
'src/shapes/Rect.js',
'src/shapes/Circle.js',
'src/shapes/Wedge.js',
'src/shapes/Image.js',
'src/shapes/Polygon.js',
'src/shapes/Text.js',
'src/shapes/Line.js',
'src/shapes/Spline.js',
'src/shapes/Blob.js',
'src/shapes/Sprite.js',
// plugins
'src/plugins/Path.js',
'src/plugins/TextPath.js',
'src/plugins/RegularPolygon.js',
'src/plugins/Star.js',
'src/plugins/Label.js',
// filters
'src/filters/Grayscale.js',
'src/filters/Brighten.js',
'src/filters/Invert.js',
'src/filters/Blur.js',
'src/filters/Mask.js'
],
dest: 'dist/kinetic-v<%= pkg.version %>.js'
}
},
replace: {
dist: {
options: {
variables: {
'version': '<%= pkg.version %>',
'date': '<%= grunt.template.today("yyyy-mm-dd") %>'
},
prefix: '@@'
},
files: [
{
expand: true,
flatten: true,
src: ['dist/kinetic-v<%= pkg.version %>.js'],
dest: 'dist/'
}
]
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> v<%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> http://www.kineticjs.com - MIT License https://github.com/ericdrowell/KineticJS/wiki/License*/\n'
},
build: {
src: 'dist/kinetic-v<%= pkg.version %>.js',
dest: 'dist/kinetic-v<%= pkg.version %>.min.js'
}
}
});
// Load plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-contrib-uglify');
// Tasks
grunt.registerTask('dev', ['concat', 'replace']);
grunt.registerTask('prod', ['concat', 'replace', 'uglify']);
};

28
package.json Normal file
View File

@ -0,0 +1,28 @@
{
"name": "KineticJS",
"version": "4.5.4",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-nodeunit": "~0.1.2",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-concat": "~0.3.0",
"grunt-replace": "~0.4.4"
},
"readmeFilename": "README.md",
"gitHead": "7b9322c15c08b3ff78f64f5cfd3e9f88850dcadc",
"description": "To build the framework, you need to have Ruby and Rubygems installed. After that, run `gem install thor`, `gem install json_pure`, and `gem install uglifier` to install the dependencies.",
"main": "Gruntfile.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "test"
},
"repository": {
"type": "git",
"url": "git://github.com/ericdrowell/KineticJS.git"
},
"author": "Eric Rowell",
"license": "MIT"
}

View File

@ -1,9 +1,9 @@
/**
* KineticJS JavaScript Framework v{{version}}
/*
* KineticJS JavaScript Framework v@@version
* http://www.kineticjs.com/
* Copyright 2013, Eric Rowell
* Licensed under the MIT or GPL Version 2 licenses.
* Date: {{date}}
* Date: @@date
*
* Copyright (C) 2011 - 2013 by Eric Rowell
*
@ -30,7 +30,7 @@
*/
var Kinetic = {};
(function() {
Kinetic.version = '{{version}}';
Kinetic.version = '@@version';
/**
* @namespace Filters