"use strict";

module.exports = function(grunt) {

	grunt.initConfig({
		pkg: grunt.file.readJSON("package.json"),

		mochaTest: {
			test: {
				options: {
					reporter: "min"
				},
				src: ["test/*.test.js"]
			}
		},

		jshint: {
			options: {
				jshintrc: true
			},
			furious: ["lib/**/*.js"],
			test: ["test/*.test.js"],
			build: ["Gruntfile.js"]
		},

		browserify: {
			library: {
				options: {
					exclude: ["node-webcl"],
					transform: ["brfs"],
					bundleOptions : {
						debug: false,
						standalone: "furious"
					}
				},
				files: {
					"furious.js": ["lib/furious.js"]
				}
			},
			worker: {
				options: {
					transform: ["brfs"],
					bundleOptions : {
						debug: false
					}
				},
				files: {
					"furious-worker.js": ["lib/js/JSWorker.js"]
				}
			},
			test: {
				options: {
					exclude: ["node-webcl"],
					transform: ["brfs"],
					bundleOptions : {
						debug: true
					}
				},
				files: {
					"test.js": ["test/*.test.js"]
				}
			}
		},

		uglify: {
			library: {
				files: {
					"furious.min.js": ["furious.js"]
				}
			},
			worker: {
				files: {
					"furious-worker.min.js": ["furious-worker.js"]
				}
			}
		},

		yuidoc: {
			furious: {
				name: "<%= pkg.name %>",
				description: "<%= pkg.description %>",
				version: "<%= pkg.version %>",
				options: {
					paths: "lib",
					outdir: "doc",
					themedir: "./node_modules/yuidoc-bootstrap-theme",
					helpers: ["./node_modules/yuidoc-bootstrap-theme/helpers/helpers.js"]
				}
			}
		},

		shell: {
			protoc: {
				command: "protoc --proto_path=protobuf --cpp_out=lib/nacl protobuf/Requests.proto protobuf/Responses.proto"
			},
			configure: {
				command: "python configure.py"
			},
			buildPNaCl: {
				command: "ninja"
			}
		}
	});

	grunt.loadNpmTasks("grunt-mocha-test");
	grunt.loadNpmTasks("grunt-browserify");
	grunt.loadNpmTasks("grunt-contrib-uglify");
	grunt.loadNpmTasks("grunt-contrib-yuidoc");
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.loadNpmTasks("grunt-shell");

	grunt.registerTask("default", ["mochaTest", "jshint", "browserify", "uglify", "yuidoc", "shell:protoc", "shell:configure", "shell:buildPNaCl"]);
	grunt.registerTask("test", ["mochaTest"]);
};

@@ -458,37 +458,41 @@
 %5B%22brfs%22%5D,%0A%09%09%09%09%09b
-undle
+rowserify
 Options : %7B%0A%09%09%09%09
@@ -664,37 +664,41 @@
 %5B%22brfs%22%5D,%0A%09%09%09%09%09b
-undle
+rowserify
 Options : %7B%0A%09%09%09%09
@@ -892,13 +892,17 @@
 %09%09%09b
-undle
+rowserify
 Opti

use browserifyOptions instead of deprecated bundleOptions