Skip to content

Commit

Permalink
Grunt files started
Browse files Browse the repository at this point in the history
  • Loading branch information
rctoris committed Apr 9, 2013
1 parent 3974757 commit 37ae0f3
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 57 deletions.
27 changes: 27 additions & 0 deletions utils/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"globals": {
"module": true,
"EventEmitter2" : true,
"ROSLIBJS" : true,
"THREE" : true
},
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"boss": false,
"eqnull": false,
"browser": true,
"devel": true,
"es5": true,
"strict": false,
"trailing": true,
"quotmark": "single",
"proto": true,
"laxbreak": true
}

92 changes: 92 additions & 0 deletions utils/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
module.exports = function(grunt) {

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
build: {
src : ['../src/Rod3D.js', '../src/**/*.js'],
dest : '../build/ros3d.js'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
files: [
'Gruntfile.js',
'../build/ros3d.js'
]
},
karma: {
build: {
configFile: '../test/karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
}
},
uglify: {
options: {
report: 'min'
},
build: {
src: '../build/ros3d.js',
dest: '../build/ros3d.min.js'
}
},
watch: {
dev: {
options: {
interrupt: true
},
files: [
'../src/Ros3D.js',
'../src/**/*.js'
],
tasks: ['concat']
},
build_and_watch: {
options: {
interrupt: true
},
files: [
'Gruntfile.js',
'.jshintrc',
'../src/Ros3D.js',
'../src/**/*.js'
],
tasks: ['build']
}
},
clean: {
options: {
force: true
},
doc: ['../doc']
},
jsdoc: {
doc: {
src: [
'../src/Ros3D.js',
'../src/**/*.js'
],
options: {
destination: '../doc'
}
}
}
});

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-karma');

grunt.registerTask('dev', ['concat', 'watch']);
grunt.registerTask('build', ['concat', 'jshint', 'karma', 'uglify']);
grunt.registerTask('build_and_watch', ['watch']);
grunt.registerTask('doc', ['clean', 'jsdoc']);
};

54 changes: 54 additions & 0 deletions utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
ros3djs Build Setup
====================

[Grunt](http://gruntjs.com/) is used for building, including concatenating,
minimizing, documenting, linting, and testing.

### Install Grunt and its Dependencies

#### Ubuntu

1. Install Node.js and its package manager, NPM
* `sudo apt-get install python-software-properties`
* `sudo add-apt-repository ppa:chris-lea/node.js`
* `sudo apt-get update && sudo apt-get install nodejs phantomjs`
2. Install Grunt and the test runner [Karma](http://karma-runner.github.io/)
* `sudo npm install -g grunt-cli karma`
* `sudo rm -rf ~/.npm ~/tmp`
3. Install the Grunt tasks specific to this project
* `cd /path/to/ros3djs/utils/`
* `npm install .`
4. (Optional) To generate the documentation, you'll need to setup Java. Documentation generation is not required for patches.
* `echo "export JAVA_HOME=/usr/lib/jvm/default-java/jre" >> ~/.bashrc`
* `source ~/.bashrc`

#### OS X

1. Install Node.js and its package manager, NPM
* Go to [Node.js Downloads](http://nodejs.org/download/)
* Download and install the Universal pkg file.
2. Install Grunt and the test runner [Karma](http://karma-runner.github.io/)
* `sudo npm install -g grunt-cli karma`
3. Install the Grunt tasks specific to this project
* `cd /path/to/ros3djs/utils/`
* `npm install .`

### Build with Grunt

Before proceeding, please confirm you have installed the dependencies above.

To run the build tasks:

1. `cd /path/to/ros3djs/utils/`
2. `grunt build`

`grunt build` will concatenate and minimize the files under src and replace
ros3d.js and ros3d.min.js in the build directory. It will also run the linter
and test cases. This is what [Travis
CI](https://travis-ci.org/RobotWebTools/ros3djs) runs when a Pull Request is
submitted.

`grunt dev` will watch for any changes to any of the src/ files and
automatically concatenate and minimize the files. This is ideal for those
developing as you should only have to run `grunt dev` once.

57 changes: 0 additions & 57 deletions utils/build.xml

This file was deleted.

13 changes: 13 additions & 0 deletions utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "ros3djs",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-jshint": "~0.1.1",
"grunt-karma": "~0.3.0",
"grunt-contrib-watch": "~0.3.1",
"grunt-contrib-uglify": "~0.2.0",
"grunt-jsdoc": "~0.3.0",
"grunt-contrib-clean": "~0.4.0"
}
}

0 comments on commit 37ae0f3

Please sign in to comment.