2013-10-30 23:35:47 +00:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
var port = grunt.option('port') || 8000;
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
uglify: {
|
|
|
|
options: {
|
|
|
|
banner: '/*! ViziCities <%= grunt.template.today("yyyy-mm-dd") %> */\n'
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
src: 'build/vizi.js',
|
|
|
|
dest: 'build/vizi.min.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
concat: {
|
|
|
|
options: {},
|
|
|
|
dist: {
|
|
|
|
// src: ['src/shared/vendor/underscore.js', 'src/shared/vendor/three.js', 'src/client/*'],
|
|
|
|
src: [
|
|
|
|
'src/shared/vendor/underscore.js',
|
2013-10-31 14:45:46 +00:00
|
|
|
'src/shared/vendor/q.js',
|
2013-10-31 01:08:31 +00:00
|
|
|
'src/shared/vendor/three/three.js',
|
|
|
|
'src/shared/vendor/three/ColorConverter.js',
|
2013-11-01 01:08:53 +00:00
|
|
|
'src/shared/vendor/d3.js',
|
2013-11-02 03:34:50 +00:00
|
|
|
'src/shared/vendor/catiline.js',
|
2013-11-01 11:31:20 +00:00
|
|
|
'src/shared/vendor/dat.gui.js',
|
|
|
|
'src/shared/vendor/fpsmeter.js',
|
2013-11-03 22:43:29 +00:00
|
|
|
'src/shared/vendor/moment.js',
|
2013-10-30 23:35:47 +00:00
|
|
|
'src/client/Vizi.js',
|
|
|
|
'src/client/Log.js',
|
|
|
|
'src/client/Mediator.js',
|
2013-11-01 11:31:20 +00:00
|
|
|
'src/client/debug/Dat.js',
|
|
|
|
'src/client/debug/FPS.js',
|
2013-11-01 14:35:33 +00:00
|
|
|
'src/client/debug/RendererInfo.js',
|
2013-11-03 20:21:57 +00:00
|
|
|
'src/client/ui/Loading.js',
|
2013-11-01 01:08:53 +00:00
|
|
|
'src/client/Geo.js',
|
2013-10-30 23:35:47 +00:00
|
|
|
'src/client/City.js',
|
|
|
|
'src/client/Loop.js',
|
2013-11-01 17:55:26 +00:00
|
|
|
'src/client/DOMEvents.js',
|
2013-10-30 23:35:47 +00:00
|
|
|
'src/client/webgl/WebGL.js',
|
|
|
|
'src/client/webgl/Scene.js',
|
2013-10-31 01:08:31 +00:00
|
|
|
'src/client/webgl/Camera.js',
|
2013-10-31 14:45:46 +00:00
|
|
|
'src/client/webgl/Renderer.js',
|
|
|
|
'src/client/objects/ObjectManager.js',
|
|
|
|
'src/client/objects/BuildingManager.js',
|
|
|
|
'src/client/objects/Object.js',
|
2013-11-01 01:08:53 +00:00
|
|
|
'src/client/objects/Floor.js',
|
|
|
|
'src/client/objects/Building.js'
|
2013-10-30 23:35:47 +00:00
|
|
|
],
|
|
|
|
dest: 'build/vizi.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
jshint: {
|
|
|
|
options: {
|
2013-11-02 03:34:50 +00:00
|
|
|
force: true,
|
2013-10-30 23:35:47 +00:00
|
|
|
curly: false,
|
|
|
|
eqeqeq: true,
|
|
|
|
immed: true,
|
|
|
|
latedef: true,
|
|
|
|
newcap: true,
|
|
|
|
noarg: true,
|
|
|
|
sub: true,
|
|
|
|
undef: true,
|
|
|
|
eqnull: true,
|
|
|
|
browser: true,
|
|
|
|
expr: true,
|
|
|
|
globals: {
|
|
|
|
head: false,
|
|
|
|
module: false,
|
2013-11-02 03:34:50 +00:00
|
|
|
console: false,
|
|
|
|
importScripts: true
|
2013-10-30 23:35:47 +00:00
|
|
|
},
|
|
|
|
ignores: ['src/shared/vendor/**']
|
|
|
|
},
|
|
|
|
files: [ 'Gruntfile.js', 'src/**' ]
|
|
|
|
},
|
2014-02-04 00:09:28 +00:00
|
|
|
mocha_phantomjs: {
|
|
|
|
files: ['test/*.html']
|
|
|
|
},
|
2013-10-30 23:35:47 +00:00
|
|
|
watch: {
|
|
|
|
main: {
|
|
|
|
files: [ 'Gruntfile.js', 'src/**', 'examples/**' ],
|
|
|
|
tasks: 'default',
|
|
|
|
options: {
|
|
|
|
livereload: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
connect: {
|
|
|
|
server: {
|
|
|
|
options: {
|
|
|
|
port: port,
|
2014-02-02 20:28:47 +00:00
|
|
|
base: '.',
|
|
|
|
keepalive: true,
|
|
|
|
debug: true
|
2013-10-30 23:35:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
notify: {
|
2014-02-02 20:28:47 +00:00
|
|
|
watch: {
|
2013-10-30 23:35:47 +00:00
|
|
|
options: {
|
|
|
|
// title: 'Watching files', // optional
|
|
|
|
message: 'Watching for changes' //required
|
|
|
|
}
|
|
|
|
},
|
|
|
|
finish: {
|
|
|
|
options: {
|
|
|
|
// title: 'Watching files', // optional
|
|
|
|
message: 'Build complete' //required
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
notify_hooks: {
|
|
|
|
options: {
|
|
|
|
enabled: true,
|
|
|
|
max_jshint_notifications: 5,
|
|
|
|
title: "ViziCities"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Load the plugins
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-connect');
|
|
|
|
grunt.loadNpmTasks('grunt-notify');
|
2014-02-04 00:09:28 +00:00
|
|
|
grunt.loadNpmTasks('grunt-mocha-phantomjs');
|
2013-10-30 23:35:47 +00:00
|
|
|
|
|
|
|
// Default task(s).
|
2013-11-03 22:43:29 +00:00
|
|
|
// grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'notify:finish']);
|
|
|
|
grunt.registerTask('default', ['jshint', 'concat', 'notify:finish']);
|
2013-10-30 23:35:47 +00:00
|
|
|
|
|
|
|
// Serve examples locally
|
2014-02-02 20:28:47 +00:00
|
|
|
grunt.registerTask('serve', ['connect']);
|
2013-10-30 23:35:47 +00:00
|
|
|
|
2014-02-02 20:28:47 +00:00
|
|
|
// Build files and refresh content on file changes
|
|
|
|
grunt.registerTask('dev', ['default', 'notify:watch', 'watch']);
|
2013-10-30 23:35:47 +00:00
|
|
|
|
2014-02-03 22:14:27 +00:00
|
|
|
// Run tests
|
2014-02-04 00:09:28 +00:00
|
|
|
grunt.registerTask('test', ['jshint', 'mocha_phantomjs']);
|
2014-02-03 22:14:27 +00:00
|
|
|
|
2014-02-02 20:28:47 +00:00
|
|
|
grunt.task.run('notify_hooks');
|
2013-10-30 23:35:47 +00:00
|
|
|
};
|