2012-11-25 22:59:31 +04:00
|
|
|
/*global module:false*/
|
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
2013-03-22 22:57:38 +04:00
|
|
|
var meta = {
|
|
|
|
banner: '/*\n <%= pkg.title || pkg.name %> <%= pkg.version %>' +
|
|
|
|
'<%= pkg.homepage ? " <" + pkg.homepage + ">" : "" %>' + '\n' +
|
2012-11-25 22:59:31 +04:00
|
|
|
' Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>' +
|
|
|
|
'\n\n Released under <%= _.pluck(pkg.licenses, "type").join(", ") %> License\n*/',
|
2013-03-22 22:57:38 +04:00
|
|
|
pre: '\n(function(window, document, undefined){\n\n',
|
|
|
|
post: '\n})(window,document);'
|
|
|
|
};
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
|
2012-11-25 22:59:31 +04:00
|
|
|
qunit: {
|
|
|
|
files: ['tests/qunit/index.html']
|
|
|
|
},
|
|
|
|
concat: {
|
|
|
|
dist: {
|
2013-03-22 22:57:38 +04:00
|
|
|
src: [
|
|
|
|
'src/Core.js',
|
|
|
|
'src/Font.js',
|
|
|
|
'src/Generate.js',
|
|
|
|
'src/Queue.js',
|
|
|
|
'src/Parse.js',
|
|
|
|
'src/Preload.js',
|
|
|
|
'src/Renderer.js',
|
|
|
|
'src/Support.js',
|
|
|
|
'src/Util.js',
|
|
|
|
'src/renderers/Canvas.js'
|
|
|
|
],
|
2012-11-25 22:59:31 +04:00
|
|
|
dest: 'build/<%= pkg.name %>.js'
|
2013-03-22 22:57:38 +04:00
|
|
|
},
|
|
|
|
options:{
|
|
|
|
banner: meta.banner + meta.pre,
|
|
|
|
footer: meta.post
|
2012-11-25 22:59:31 +04:00
|
|
|
}
|
|
|
|
},
|
2013-03-22 06:40:09 +04:00
|
|
|
uglify: {
|
2012-11-25 22:59:31 +04:00
|
|
|
dist: {
|
2013-03-22 22:57:38 +04:00
|
|
|
src: ['<%= concat.dist.dest %>'],
|
2012-11-25 22:59:31 +04:00
|
|
|
dest: 'build/<%= pkg.name %>.min.js'
|
2013-03-22 22:57:38 +04:00
|
|
|
},
|
|
|
|
options: {
|
|
|
|
banner: meta.banner
|
2012-11-25 22:59:31 +04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2013-03-22 22:57:38 +04:00
|
|
|
files: '<%= lint.files %>',
|
|
|
|
tasks: 'jshint qunit'
|
2012-11-25 22:59:31 +04:00
|
|
|
},
|
|
|
|
jshint: {
|
2013-03-22 22:57:38 +04:00
|
|
|
all: ['<%= concat.dist.dest %>'],
|
2012-11-25 22:59:31 +04:00
|
|
|
options: {
|
|
|
|
curly: true,
|
|
|
|
eqeqeq: true,
|
|
|
|
immed: true,
|
|
|
|
latedef: true,
|
|
|
|
newcap: true,
|
|
|
|
noarg: true,
|
|
|
|
sub: true,
|
|
|
|
undef: true,
|
|
|
|
boss: true,
|
|
|
|
eqnull: true,
|
2013-03-22 22:57:38 +04:00
|
|
|
browser: true,
|
|
|
|
globals: {
|
|
|
|
jQuery: true
|
|
|
|
}
|
2012-11-25 22:59:31 +04:00
|
|
|
}
|
2013-03-22 06:40:09 +04:00
|
|
|
}
|
2012-11-25 22:59:31 +04:00
|
|
|
});
|
|
|
|
|
2012-12-29 17:02:05 +04:00
|
|
|
var selenium = require("./tests/selenium.js");
|
|
|
|
grunt.registerTask('webdriver', 'Browser render tests', function(arg1) {
|
|
|
|
|
|
|
|
var done = this.async();
|
|
|
|
|
|
|
|
if (arguments.length === 0) {
|
|
|
|
selenium.tests();
|
2012-12-30 18:29:01 +04:00
|
|
|
} else {
|
|
|
|
selenium[arg1].apply(null, arguments);
|
2012-12-29 17:02:05 +04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-03-22 06:40:09 +04:00
|
|
|
// Load tasks
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-qunit');
|
|
|
|
|
2012-11-25 22:59:31 +04:00
|
|
|
// Default task.
|
2013-03-24 04:00:01 +04:00
|
|
|
grunt.registerTask('build', ['concat', 'uglify']);
|
2013-05-29 19:41:15 +04:00
|
|
|
grunt.registerTask('default', ['jshint', 'concat', 'qunit', 'uglify']);
|
|
|
|
grunt.registerTask('travis', ['jshint', 'concat', 'qunit', 'uglify', 'webdriver']);
|
2012-11-25 22:59:31 +04:00
|
|
|
|
|
|
|
};
|