<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    srcFolder: 'src/main/resources',
    testFolder: 'src/test/resources',
    distFolder: 'target/classes',
    validation: {
      options: {
        reset: grunt.option('reset') || true,
        stoponerror: false,
        failHard: true,
        generateReport: true,
        useTimeStamp: true,
        errorHTMLRootDir: 'w3c',
        path: 'w3c/validation-status.json',
        reportpath: 'w3c/validation-report.json',
        relaxerror: ['The Content-Type was “text/html”. Using the HTML parser.', 'Using the schema for HTML with SVG 1.1, MathML 3.0, RDFa 1.1, and ITS 2.0 support.', 'Bad value X-UA-Compatible for attribute http-equiv on element meta.'] //ignores these errors
      },
      files: {
        src: '<%= srcFolder %>/public/**/*.html'
      }
    },
    jshint: {
      files: ['Gruntfile.js', '<%= srcFolder %>/public/js/**/*.js', '<%= testFolder %>/public/js/**/*.js'],
      options: {
        globals: {
          jQuery: true,
          console: true,
          module: true
        }
      }
    },
    watch: {
      files: ['<%= jshint.files %>'],
      tasks: ['jshint', 'qunit']
    },
    concat: {
      options: {
        separator: ';'
      },
      dist: {
        src: ['<%= srcFolder %>/public/js/**/*.js'],
        dest: '<%= distFolder %>/public/js/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
      },
      dist: {
        files: {
          '<%= distFolder %>/public/js/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
        }
      }
    },
    qunit: {
      files: ['<%= testFolder %>/public/**/*.html']
    },
    cssmin: {
      target: {
        files: [{
          expand: true,
          cwd: '<%= srcFolder %>/',
          src: ['public/stylesheets/**/*.css', '!public/stylesheets/**/*.min.css'],
          dest: '<%= distFolder %>',
          ext: '.min.css'
        }]
      }
    }
  });

  // grunt.loadNpmTasks('grunt-html-validation');
  grunt.loadNpmTasks('grunt-w3c-html-validation');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // this would be run by typing "grunt test" on the command line
  grunt.registerTask('test', ['validation', 'jshint']);

  // the default task can be run just by typing "grunt" on the command line
  grunt.registerTask('default', ['validation', 'jshint'/*, 'concat', 'uglify', 'cssmin'*/]);
};
<commit_msg>web services try 1<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    srcFolder: 'src/main/resources',
    testFolder: 'src/test/resources',
    distFolder: 'target/classes',
    validation: {
      options: {
        reset: grunt.option('reset') || false,
        stoponerror: false,
        failHard: true,
        generateReport: true,
        useTimeStamp: true,
        errorHTMLRootDir: 'w3c',
        path: 'w3c/validation-status.json',
        reportpath: 'w3c/validation-report.json',
        relaxerror: ['The Content-Type was “text/html”. Using the HTML parser.', 'Using the schema for HTML with SVG 1.1, MathML 3.0, RDFa 1.1, and ITS 2.0 support.', 'Bad value X-UA-Compatible for attribute http-equiv on element meta.'] //ignores these errors
      },
      files: {
        src: '<%= srcFolder %>/public/**/*.html'
      }
    },
    jshint: {
      files: ['Gruntfile.js', '<%= srcFolder %>/public/js/**/*.js', '<%= testFolder %>/public/js/**/*.js'],
      options: {
        globals: {
          jQuery: true,
          console: true,
          module: true
        }
      }
    },
    watch: {
      files: ['<%= jshint.files %>'],
      tasks: ['jshint', 'qunit']
    },
    concat: {
      options: {
        separator: ';'
      },
      dist: {
        src: ['<%= srcFolder %>/public/js/**/*.js'],
        dest: '<%= distFolder %>/public/js/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
      },
      dist: {
        files: {
          '<%= distFolder %>/public/js/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
        }
      }
    },
    // core: {
    //   files: [{
    //     expand: true,
    //     cwd: 'src/main/resources',
    //     src: 'public/js/**/*.js',
    //     dest: "target/classes",
    //     ext: '.min.js'
    //   }]
    // }
    qunit: {
      files: ['<%= testFolder %>/public/**/*.html']
    },
    cssmin: {
      target: {
        files: [{
          expand: true,
          cwd: '<%= srcFolder %>/',
          src: ['public/stylesheets/**/*.css', '!public/stylesheets/**/*.min.css'],
          dest: '<%= distFolder %>',
          ext: '.min.css'
        }]
      }
    }
  });

  // grunt.loadNpmTasks('grunt-html-validation');
  grunt.loadNpmTasks('grunt-w3c-html-validation');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // this would be run by typing "grunt test" on the command line
  grunt.registerTask('test', ['validation', 'jshint', 'qunit']);

  // the default task can be run just by typing "grunt" on the command line
  grunt.registerTask('default', ['jshint'/*, 'validation', /*'qunit', 'concat', 'uglify', 'cssmin'*/]);
};
<|endoftext|>


<commit_before>var gruntRequireConfig = require('./src/dev/requireConfig').gruntConfig;
var gruntWrapperRequireConfig = require('./src/dev/requireConfig').gruntWrapperConfig;

module.exports = function (grunt) {
    grunt.initConfig({
        requirejs: {
            core: {
                options: gruntRequireConfig
            },
            wrapper: {
                options: gruntWrapperRequireConfig
            }
        },
        concat: {

        },
        jst: {
            compile: {
                options: {
                    prettify: true,
                    processName: function (filePath) {
                        var parts = filePath.split('/');
                        var fileName = parts[parts.length - 1];
                        return fileName.split('.')[0];
                    },
                    amd: true
                },
                files: {
                    "src/js/generated/templates.js": ["src/templates/*.html"]
                }
            }
        },
        less: {
            development: {
                options: {
                    paths: ['src/less']
                },
                files: {
                    "build/tmp/razorflow.css": "src/less/razorflow.less"
                }
            },
            newdesign: {
                options: {
                    paths: ['src/dev/newdesign/less']
                },
                files: {
                    "src/dev/newdesign/css/razorflow.css":  "src/dev/newdesign/less/razorflow.less"
                }
            }
        },
        jshint: {
            options: {
                jshintrc: 'src/js/.jshintrc'
            },
            files: [
                "src/js/**/*.js"
            ]
        },
        karma: {
            dev: {
                configFile: './karma.conf.js',
                singleRun: true
            }
        },
        lodash: {
            build: {
                dest: 'src/vendor/js/lodash.rf.js',
                options: {
                    include: ['extend', 'pluck', 'map', 'each', 'isNumber', 'isString', 'isNaN', 'isArray', 'isObject', 'find', 'defer', 'delay', 'max', 'min', 'sortBy', 'flatten', 'clone', 'cloneDeep', 'values', 'pick', 'reduce', 'filter', 'indexOf', 'keys', 'debounce'],
                }
            }
        },
        cssmin: {
            minify: {
                expand: true,
                cwd: 'build/tmp/',
                src: ['razorflow.css'],
                dest: 'build/assets/css',
                ext: '.min.css'
            }
        },
        // Need to copy products.json
        copy: {
            localToWebRF: {
                files: [
                    {src: ["build/js/razorflow.min.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/css/razorflow.min.css"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/js/templates.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/js/rfDemos.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/img/exampleImgs/*.png"], dest: '../webrf/backend/static/transfer/',flatten: true },
                ]
            }
        },
        copyto: {
            srcToBuild: {
                files: [
                    {cwd: 'src/vendor/js/', src: ['jquery.min.js'], dest: 'build/assets/js/'},
                ]
            },
            packageToBuild: {
                files: [
                    {cwd: 'src/package/', src: ['**/*'], dest: 'build/package/'},
                ],
            },
            assetsToPackage: {
                files: [
                    {cwd: 'build/assets/', src: ["js/**", "css/**"], dest: 'build/package/files/'},
                    {cwd: 'build/assets/', src: ["js/**", "css/**"], dest: 'build/package/dashboard_quickstart/'},
                ],
            },
            packageToRelease: {
                files: [
                    {cwd: 'src/package/', src: ['**'], dest: '../package/rf/javascript/'}
                ]
            },
            razorcharts: {
                files: [
                    {cwd: '../razorcharts/src/js', src:['**'], dest: 'src/js/'}
                ]
            },
            spriteDev: {
                files: [
                    {cwd: 'src/img/', src:['**'], dest: 'build/tmp/'}
                ]
            },
            spriteProd: {
                files: [
                    {cwd: 'src/img/', src:['**'], dest: 'build/assets/img/'}
                ]
            },
            themebuilder: {
                files: [
                    {cwd: 'build/assets/js/', src: ["**"], dest: 'src/dev/themebuilder/vendor/js/'},
                    {cwd: 'build/tmp/', src: ["**"], dest: 'src/dev/themebuilder/vendor/css/'},
                    {cwd: 'src/less/', src: ["**"], dest: 'src/dev/themebuilder/vendor/less/'},

                ]
            }
        },
        replace: {
            removeAMD: {
                src: "build/assets/js/razorflow.min.js",
                overwrite: true,
                replacements: [
                    {from: /\bdefine\b/g, to: "_dfn"},
                    {from: /\brequire\b/g, to: "_rqr"}
                ]
            }
        },
        clean: {
            build: ["build"]
        }
    });

    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.loadNpmTasks('grunt-contrib-jst');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-lodash');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-text-replace');
    grunt.loadNpmTasks('grunt-copy-to');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadTasks("./tools/src/grunt-tasks");

    grunt.registerTask('compile', ['less', 'jst:compile', 'copyto:spriteDev', 'copyto:themebuilder']);
    grunt.registerTask('test', ['compile', 'karma:dev', 'shell:coverageReport']);

    grunt.registerTask('build', ["clean:build", "less", "jst:compile", 'requirejs:core', 'requirejs:wrapper', "replace:removeAMD", 'cssmin:minify', "copyto:srcToBuild", "copyto:spriteProd"])
    grunt.registerTask('package', ['build', 'copyto:packageToBuild', 'copyto:assetsToPackage'])
    // grunt.registerTask('websiteRelease', ['build', 'cssmin:minify', 'squashdemos', "screenshotGen:examples", 'copy:localToWebRF'])
}<commit_msg>moved themebuilder ui to window<commit_after>var gruntRequireConfig = require('./src/dev/requireConfig').gruntConfig;
var gruntWrapperRequireConfig = require('./src/dev/requireConfig').gruntWrapperConfig;

module.exports = function (grunt) {
    grunt.initConfig({
        requirejs: {
            core: {
                options: gruntRequireConfig
            },
            wrapper: {
                options: gruntWrapperRequireConfig
            }
        },
        concat: {

        },
        jst: {
            compile: {
                options: {
                    prettify: true,
                    processName: function (filePath) {
                        var parts = filePath.split('/');
                        var fileName = parts[parts.length - 1];
                        return fileName.split('.')[0];
                    },
                    amd: true
                },
                files: {
                    "src/js/generated/templates.js": ["src/templates/*.html"]
                }
            }
        },
        less: {
            development: {
                options: {
                    paths: ['src/less']
                },
                files: {
                    "build/tmp/razorflow.css": "src/less/razorflow.less"
                }
            },
            newdesign: {
                options: {
                    paths: ['src/dev/newdesign/less']
                },
                files: {
                    "src/dev/newdesign/css/razorflow.css":  "src/dev/newdesign/less/razorflow.less"
                }
            },
            themebuilder: {
                options: {
                    paths: ['src/dev/themebuilder/less']
                },
                files: {
                    "src/dev/themebuilder/css/themebuilder.css" : "src/dev/themebuilder/less/themebuilder.less"
                }
            }
        },
        jshint: {
            options: {
                jshintrc: 'src/js/.jshintrc'
            },
            files: [
                "src/js/**/*.js"
            ]
        },
        karma: {
            dev: {
                configFile: './karma.conf.js',
                singleRun: true
            }
        },
        lodash: {
            build: {
                dest: 'src/vendor/js/lodash.rf.js',
                options: {
                    include: ['extend', 'pluck', 'map', 'each', 'isNumber', 'isString', 'isNaN', 'isArray', 'isObject', 'find', 'defer', 'delay', 'max', 'min', 'sortBy', 'flatten', 'clone', 'cloneDeep', 'values', 'pick', 'reduce', 'filter', 'indexOf', 'keys', 'debounce'],
                }
            }
        },
        cssmin: {
            minify: {
                expand: true,
                cwd: 'build/tmp/',
                src: ['razorflow.css'],
                dest: 'build/assets/css',
                ext: '.min.css'
            }
        },
        // Need to copy products.json
        copy: {
            localToWebRF: {
                files: [
                    {src: ["build/js/razorflow.min.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/css/razorflow.min.css"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/js/templates.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/js/rfDemos.js"], dest: '../webrf/backend/static/transfer/', flatten:true},
                    {src: ["build/img/exampleImgs/*.png"], dest: '../webrf/backend/static/transfer/',flatten: true },
                ]
            }
        },
        copyto: {
            srcToBuild: {
                files: [
                    {cwd: 'src/vendor/js/', src: ['jquery.min.js'], dest: 'build/assets/js/'},
                ]
            },
            packageToBuild: {
                files: [
                    {cwd: 'src/package/', src: ['**/*'], dest: 'build/package/'},
                ],
            },
            assetsToPackage: {
                files: [
                    {cwd: 'build/assets/', src: ["js/**", "css/**"], dest: 'build/package/files/'},
                    {cwd: 'build/assets/', src: ["js/**", "css/**"], dest: 'build/package/dashboard_quickstart/'},
                ],
            },
            packageToRelease: {
                files: [
                    {cwd: 'src/package/', src: ['**'], dest: '../package/rf/javascript/'}
                ]
            },
            razorcharts: {
                files: [
                    {cwd: '../razorcharts/src/js', src:['**'], dest: 'src/js/'}
                ]
            },
            spriteDev: {
                files: [
                    {cwd: 'src/img/', src:['**'], dest: 'build/tmp/'}
                ]
            },
            spriteProd: {
                files: [
                    {cwd: 'src/img/', src:['**'], dest: 'build/assets/img/'}
                ]
            },
            themebuilder: {
                files: [
                    {cwd: 'build/assets/js/', src: ["**"], dest: 'src/dev/themebuilder/vendor/js/'},
                    {cwd: 'build/tmp/', src: ["**"], dest: 'src/dev/themebuilder/vendor/css/'},
                    {cwd: 'src/less/', src: ["**"], dest: 'src/dev/themebuilder/vendor/less/'},

                ]
            }
        },
        replace: {
            removeAMD: {
                src: "build/assets/js/razorflow.min.js",
                overwrite: true,
                replacements: [
                    {from: /\bdefine\b/g, to: "_dfn"},
                    {from: /\brequire\b/g, to: "_rqr"}
                ]
            }
        },
        clean: {
            build: ["build"]
        }
    });

    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.loadNpmTasks('grunt-contrib-jst');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-lodash');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-text-replace');
    grunt.loadNpmTasks('grunt-copy-to');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadTasks("./tools/src/grunt-tasks");

    grunt.registerTask('compile', ['less', 'jst:compile', 'copyto:spriteDev', 'copyto:themebuilder']);
    grunt.registerTask('test', ['compile', 'karma:dev', 'shell:coverageReport']);

    grunt.registerTask('build', ["clean:build", "less", "jst:compile", 'requirejs:core', 'requirejs:wrapper', "replace:removeAMD", 'cssmin:minify', "copyto:srcToBuild", "copyto:spriteProd"])
    grunt.registerTask('package', ['build', 'copyto:packageToBuild', 'copyto:assetsToPackage'])
    // grunt.registerTask('websiteRelease', ['build', 'cssmin:minify', 'squashdemos', "screenshotGen:examples", 'copy:localToWebRF'])
}<|endoftext|>


<commit_before>module.exports = function(grunt) {

var mozjpeg = require('imagemin-mozjpeg');

	// Project configuration.
	grunt.initConfig({

	    pkg: grunt.file.readJSON('package.json'),

	     // ***** CONFIG
	    sass: {
			dev: {
				options: {
					style: 'expanded',
					cacheLocation: 'dist/.sass-cache'
				},
				files: {
					'dist/css/style.css': 'src/scss/style.scss'
				}
			},
			dist: {
				options: {
					style: 'compressed',
					cacheLocation: 'dist/.sass-cache',
					noCache: true,
					sourcemap: 'none'
				},
				files: {
					'dist/css/style.css': 'src/scss/style.scss'
				}
			}
		},

		autoprefixer: {
			single_file: {
		    	options: {
		        	browsers: ['last 5 versions', 'ie 8', 'ie 9']
		      	},
		      	src: 'dist/css/style.css',
		      	dest: 'dist/css/style.css'
		    }
		},

		combine_mq: {
		    new_filename: {
		        options: {
		            beautify: false
		        },
		    	src: 'dist/css/style.css',
		    	dest: 'dist/css/style.css'
		    }
		},

		criticalcss: {
	        custom: {
	            options: {
	                url: "http://localhost:3000",
	                width: 1200,
	                height: 900,
	                outputfile: "dist/css/critical.css",
	                filename: "dist/css/style.css", // Using path.resolve( path.join( ... ) ) is a good idea here
	                buffer: 800*1024,
	                ignoreConsole: false
	            }
	        }
		},

		cssmin: {
			files: {
				expand: true,
				cwd: 'dist/css',
				src: ['*.css', '!*.min.css'],
				dest: 'dist/css',
				ext: '.css'
			}
		},

		svgmin: {
	        options: {
	            plugins: [{
	                    removeViewBox: true
	                },{
	                    removeUselessStrokeAndFill: false
	            }]
	        },
	        dist: {
	            files: {
	                'dist/img/**.svg': 'src/img/**.svg'
	            }
	        }
	    },

		imagemin: {
		    dynamic: {                          // Another target
		    	options: {                      // Target options
			        optimizationLevel: 3,
			        svgoPlugins: [{ removeViewBox: false }],
			        use: [mozjpeg()]
			    },

		      	files: [{
		        	expand: true,                   // Enable dynamic expansion
		        	cwd: 'src/img/',                // Src matches are relative to this path
		        	src: ['**.{png,jpg,gif}'],   	// Actual patterns to match
		        	dest: 'dist/img/'               // Destination path prefix
		    	}]
		    }
		},

		modernizr: {
		    dist: {
		        "devFile" : "src/js/modernizr.dev.js",
		        "outputFile" : "src/js/generic/modernizr.custom.js",

		        "extra" : {
		            "shiv" : true,
		            "printshiv" : false,
		            "load" : true,
		            "mq" : true,
		            "cssclasses" : true
		        },
		        "extensibility" : {
		            "addtest" : false,
		            "prefixed" : false,
		            "teststyles" : false,
		            "testprops" : false,
		            "testallprops" : false,
		            "hasevents" : false,
		            "prefixes" : false,
		            "domprefixes" : false,
		            "cssclassprefix": ""
		        },
		        "uglify" : false,
		        "tests" : [],
		        "parseFiles" : true,
		        "matchCommunityTests" : false,
		        "customTests" : []
		    }
		},

		concat: {
			dist: {
				src: [
					'src/js/generic/*.js',
					//'src/js/no-jquery/*.js',
					'src/js/core.js'
				],
				dest: 'dist/js/core.js',
			},
			modernizr: {
				src: ['src/js/modernizr.dev.js'],
				dest: 'src/js/generic/modernizr.custom.js',
			}
		},

		uglify: {
			dist: {
				src: 'dist/js/core.js',
				dest: 'dist/js/core.js'
			}
		},

		copy: {
			dist: {
				expand: true,
				cwd: 'src/',
				src: ['*.{html,php}', 'js/yepnope/**'],
				dest: 'dist/'
			},
			shims: {
				expand: true,
				cwd: 'src/',
				src: ['js/shims/**'],
				dest: 'dist/'
			},
		},

		browserSync: {
		  default_options: {
		    bsFiles: {
		      src: [
		        "dist/css/**.css",
		        "src/scss/**.scss",
		        "dist/*.{html,php}"
		      ]
		    },
		    options: {
		      watchTask: true,
		      server: {
		        baseDir: "dist"
		      }
		    }
		  }
		},

		delete_sync: {
			dev: {
				cwd: 'dist',
				src: ['**', '!**/*.css', '!*/*/*.js', '!**/*.map'],
				syncWith: 'src'
			},
			dist: {
				cwd: 'dist',
				src: ['**', '!**/*.css', '!**/*.js'],
				syncWith: 'src'
			}
		},

		clean: {
			reset: [
				'dist'
			]
		},

	    watch: {

     		sass: {
	            files: ['src/scss/**.scss'],
	            files: ['src/scss/**/*.scss'],
	            tasks: ['sass:dev', 'autoprefixer'],
	            options: {
	                spawn: false,
	                livereload: true,
	            }
	        },

     		scripts: {
				files: ['src/js/**.js'],
				tasks: ['concat:modernizr', 'concat:dist'],
				options: {
					spawn: true,
					livereload: true,
				}
			},

			delete_sync: {
				files: ['src/**', 'src/**.{html,php,txt}'],
				tasks: ['delete_sync:dev'],
				options: {
					spawn: false,
					livereload: true,
				}
			},

     		content: {
				files: ['src/*.{html,php}'],
				tasks: ['newer:copy:dist'],
				options: {
					spawn: false,
					livereload: true,
				}
			},

			assets: {
				files: ['src/img/**.{png,jpg,gif}'],
				tasks: ['newer:imagemin:dynamic'],
				options: {
					livereload: true,
				},
			},

			svg: {
				files: ['src/img/**.{svg}'],
				tasks: ['svgmin:dist'],
				options: {
					livereload: true,
				},
			}

	     },

	});

	//*****  PLUGINS
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-sass');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-autoprefixer');
	grunt.loadNpmTasks('grunt-contrib-imagemin');
	grunt.loadNpmTasks('grunt-svgmin');
	grunt.loadNpmTasks('grunt-browser-sync');
	grunt.loadNpmTasks('grunt-modernizr');
	grunt.loadNpmTasks('grunt-criticalcss');
	grunt.loadNpmTasks('grunt-combine-mq');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-delete-sync');
	grunt.loadNpmTasks('grunt-newer');
	grunt.loadNpmTasks('grunt-contrib-clean');

	//***** TASKS
	grunt.registerTask('default', [
		'commit',
		'copy:shims',
		'copy:dist',
		'sass:dev',
		'autoprefixer',
		'modernizr:dist',
		'concat:dist',
		'sass:dev',
		'autoprefixer',
		'delete_sync:dev',
		'newer:imagemin:dynamic',
		'svgmin:dist',
		'browserSync',
		'watch'
	]);

	grunt.registerTask('deploy', [
		'commit',
		'copy:shims',
		'copy:dist',
		'sass:dist',
		'autoprefixer',
		'modernizr:dist',
		'concat:dist',
		'combine_mq',
		'cssmin',
		'uglify',
		'delete_sync:dist',
		'imagemin',
		'svgmin:dist'
	]);

	grunt.registerTask('commit', ['clean:reset']);

};<commit_msg>Faster watch tasks<commit_after>module.exports = function(grunt) {

var mozjpeg = require('imagemin-mozjpeg');

	// Project configuration.
	grunt.initConfig({

	    pkg: grunt.file.readJSON('package.json'),

	    // ***** CONFIG
	    sass: {
			dev: {
				options: {
					style: 'expanded',
					cacheLocation: 'dist/.sass-cache'
				},
				files: {
					'dist/css/style.css': 'src/scss/style.scss',
					//'dist/css/editor_style.css': 'src/scss/editor_style.scss'
				}
			},
			dist: {
				options: {
					style: 'compressed',
					cacheLocation: 'dist/.sass-cache',
					noCache: true,
					sourcemap: 'none'
				},
				files: {
					'dist/css/style.css': 'src/scss/style.scss',
					//'dist/css/editor_style.css': 'src/scss/editor_style.scss'
				}
			}
		},

		autoprefixer: {
			single_file: {
		    	options: {
		        	browsers: ['last 5 versions', 'ie 8', 'ie 9']
		      	},
		      	src: 'dist/css/style.css',
		      	dest: 'dist/css/style.css'
		    }
		},

		combine_mq: {
		    new_filename: {
		        options: {
		            beautify: false
		        },
		    	src: 'dist/css/style.css',
		    	dest: 'dist/css/style.css'
		    }
		},

		criticalcss: {
	        custom: {
	            options: {
	                url: "http://localhost:3000",
	                width: 1200,
	                height: 900,
	                outputfile: "dist/css/critical.css",
	                filename: "dist/css/style.css", // Using path.resolve( path.join( ... ) ) is a good idea here
	                buffer: 800*1024,
	                ignoreConsole: false
	            }
	        }
		},

		cssmin: {
			files: {
				expand: true,
				cwd: 'dist/css',
				src: ['*.css', '!*.min.css'],
				dest: 'dist/css',
				ext: '.css'
			}
		},

		svgmin: {
	        options: {
	            plugins: [{
	                    removeViewBox: true
	                },{
	                    removeUselessStrokeAndFill: false
	            }]
	        },
	        dist: {
	            files: {
	                'dist/img/**.svg': 'src/img/**.svg'
	            }
	        }
	    },

		imagemin: {
		    dynamic: {                          // Another target
		    	options: {                      // Target options
			        optimizationLevel: 3,
			        svgoPlugins: [{ removeViewBox: false }],
			        use: [mozjpeg()]
			    },

		      	files: [{
		        	expand: true,                   // Enable dynamic expansion
		        	cwd: 'src/img/',                // Src matches are relative to this path
		        	src: ['**.{png,jpg,gif}'],   	// Actual patterns to match
		        	dest: 'dist/img/'               // Destination path prefix
		    	}]
		    }
		},

		modernizr: {
		    dist: {
		        "devFile" : "src/js/modernizr.dev.js",
		        "outputFile" : "src/js/generic/modernizr.custom.js",

		        "extra" : {
		            "shiv" : true,
		            "printshiv" : false,
		            "load" : true,
		            "mq" : true,
		            "cssclasses" : true
		        },
		        "extensibility" : {
		            "addtest" : false,
		            "prefixed" : false,
		            "teststyles" : false,
		            "testprops" : false,
		            "testallprops" : false,
		            "hasevents" : false,
		            "prefixes" : false,
		            "domprefixes" : false,
		            "cssclassprefix": ""
		        },
		        "uglify" : false,
		        "tests" : [],
		        "parseFiles" : true,
		        "matchCommunityTests" : false,
		        "customTests" : []
		    }
		},

		concat: {
			dist: {
				src: [
					'src/js/generic/*.js',
					//'src/js/no-jquery/*.js',
					'src/js/core.js'
				],
				dest: 'dist/js/core.js',
			},
			modernizr: {
				src: ['src/js/modernizr.dev.js'],
				dest: 'src/js/generic/modernizr.custom.js',
			}
		},

		uglify: {
			dist: {
				src: 'dist/js/core.js',
				dest: 'dist/js/core.js'
			}
		},

		copy: {
			dist: {
				expand: true,
				cwd: 'src/',
				src: ['*.{html,php}', 'js/yepnope/**'],
				dest: 'dist/'
			},
			shims: {
				expand: true,
				cwd: 'src/',
				src: ['js/shims/**'],
				dest: 'dist/'
			},
		},

		browserSync: {
		  default_options: {
		    bsFiles: {
		      src: [
		        "dist/css/**.css",
		        "src/scss/**.scss",
		        "dist/*.{html,php}"
		      ]
		    },
		    options: {
		      watchTask: true,
		      server: {
		        baseDir: "dist"
		      }
		    }
		  }
		},

		delete_sync: {
			dev: {
				cwd: 'dist',
				src: ['**', '!**/*.css', '!*/*/*.js', '!**/*.map'],
				syncWith: 'src'
			},
			dist: {
				cwd: 'dist',
				src: ['**', '!**/*.css', '!**/*.js'],
				syncWith: 'src'
			}
		},

		clean: {
			reset: [
				'dist'
			]
		},

	    watch: {

     		sass: {
	            files: ['src/scss/**.scss'],
	            files: ['src/scss/**/*.scss'],
	            tasks: ['sass:dev', 'autoprefixer'],
	            options: {
	                spawn: false,
	                livereload: true,
	            }
	        },

     		scripts: {
				files: ['src/js/**.js'],
				tasks: ['concat:dist'],
				options: {
					spawn: true,
					livereload: true,
				}
			},

			delete_sync: {
				files: ['src/**', 'src/**.{html,php,txt}'],
				tasks: ['delete_sync:dev'],
				options: {
					spawn: false,
					livereload: true,
				}
			},

     		content: {
				files: ['src/*.{html,php}'],
				tasks: ['newer:copy:dist'],
				options: {
					spawn: false,
					livereload: true,
				}
			},

			assets: {
				files: ['src/img/**.{png,jpg,gif}'],
				tasks: ['newer:imagemin:dynamic'],
				options: {
					livereload: true,
				},
			},

			svg: {
				files: ['src/img/**.{svg}'],
				tasks: ['svgmin:dist'],
				options: {
					livereload: true,
				},
			}

	     },

	});

	//*****  PLUGINS
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-sass');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-autoprefixer');
	grunt.loadNpmTasks('grunt-contrib-imagemin');
	grunt.loadNpmTasks('grunt-svgmin');
	grunt.loadNpmTasks('grunt-browser-sync');
	grunt.loadNpmTasks('grunt-modernizr');
	grunt.loadNpmTasks('grunt-criticalcss');
	grunt.loadNpmTasks('grunt-combine-mq');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-delete-sync');
	grunt.loadNpmTasks('grunt-newer');
	grunt.loadNpmTasks('grunt-contrib-clean');

	//***** TASKS
	grunt.registerTask('default', [
		'commit',
		'copy:shims',
		'copy:dist',
		'sass:dev',
		'autoprefixer',
		'concat:modernizr',
		'concat:dist',
		'sass:dev',
		'autoprefixer',
		'delete_sync:dev',
		'newer:imagemin:dynamic',
		'svgmin:dist',
		'browserSync',
		'watch'
	]);

	grunt.registerTask('deploy', [
		'commit',
		'copy:shims',
		'copy:dist',
		'sass:dist',
		'autoprefixer',
		'modernizr:dist',
		'concat:dist',
		'combine_mq',
		'cssmin',
		'uglify',
		'delete_sync:dist',
		'newer:imagemin:dynamic',
		'svgmin:dist'
	]);

	grunt.registerTask('commit', ['clean:reset']);

};<|endoftext|>


<commit_before>var path = require('path');
var snippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;

module.exports = function ( grunt ) {
	var projectName = 'mytravis';

  grunt.initConfig({
    jshint: {
			options: {
				jshintrc: '.jshintrc'
			},
      files: ['js/**/*.src.js', 'specs/**/*.spec.js']
    },

    uglify: {
      build: {
        src: ['js/**/*.src.js'],
        dest: 'build/'+projectName+'.min.js'
      }
    },

    cssmin: {
      build: {
        src: ['css/**/*.src.css'],
        dest: 'build/'+projectName+'.min.css'
      }
    },

		copy: {
			imgs: {
				files: [
					{src: ['imgs/**'], dest: 'build/'} // includes files in path and its subdirs
				]
			}
		},

    zip: {
      dist: {
        exclude: ['./.*', './node_modules*', './screenshots*'],
        src: '.',
        dest: ''+projectName+'.zip'
      }
    },

		connect: {
			pivotal: {
				options: {
					port: '9001',
					base: '.'
				}
			},

			livereload: {
        options: {
          port: '9001',
          middleware: function(connect, options) {
            return [snippet, connect.static(path.resolve(options.base))];
          }
        }
      }
		},

		url: {
			pivotal: {
				host: 'localhost',
				port: '<%=connect.pivotal.options.port%>',
				runner: '<%=jasmine.pivotal.options.outfile%>'
			}
		},

		livereload: {
      port: 35729
    },

	  jasmine: {
			pivotal: {
				src: [
				  'js/app.src.js',
					'js/controller/*.src.js',
					'js/model/*.src.js',
					'js/service/*.src.js'
				],
				options: {
					host: 'http://localhost:<%=connect.port%>/',
					vendor: [
						'js/vendor/o.min.js',
						'js/vendor/litemq.min.js',
						'js/vendor/jquery-1.9.1.min.js',
						'js/vendor/utils.src.js',
						'spec/spec.src.js'
					],
					specs: ['spec/**/*.spec.js'],
					outfile: 'runner.html'
				}
			}
		},

		regarde: {
			pivotal: {
				files: ['js/**/*.src.js', 'spec/**/*.spec.js'],
				tasks: ['jasmine:pivotal'],
				spawn: true
			},

      livereload: {
        files: ['js/**/*.src.js', 'spec/**/*.spec.js'],
        tasks: ['livereload']
      }
		}
  });

	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-jasmine');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-livereload');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-regarde');

  // Aliased tasks (for readability purposes on "build" task)
  grunt.registerTask('o:cssmin', 'cssmin:build');
  grunt.registerTask('o:jsmin', 'uglify:build');
  grunt.registerTask('o:jslint', 'jshint');
  grunt.registerTask('o:zip', 'zip:dist');
  grunt.registerTask('o:imgs', 'copy:imgs');

	// Batch taks
	grunt.registerTask('o:ci', ['connect:pivotal', 'jasmine']);
	grunt.registerTask('o:pivotal', ['connect:pivotal', 'regarde:pivotal']);
	grunt.registerTask('o:livereload', ['livereload-start', 'connect:livereload', 'jasmine:pivotal:build', 'url:pivotal', 'regarde:livereload']);
	grunt.registerTask('o:build', ['o:ci', 'o:jslint', 'o:jsmin', 'o:cssmin', 'o:imgs']);

	grunt.registerMultiTask('url', 'Mounts url on screen', function () {
		var host = this.data.host;
		var port = this.data.port;
		var runner = this.data.runner;

		grunt.log.writeln( 'Specs can now be accessed on http://'+host+':'+port+'/'+runner );
	});

  grunt.registerMultiTask('zip', 'Creates package for deploy.', function () {
    var options, done = this.async();

    options = ['--exclude'].concat(this.data.exclude);
    options = options.concat(['-r', this.data.dest, this.data.src]);

    grunt.util.spawn({cmd: 'zip', args: options}, function (err, result, code) {
      var output = result.err || result.stdout;

			grunt.log.writeln( '\n'+output+'\n' );

			done(code>0? false: true);
    });
  });
};
<commit_msg>small adjustments on Gruntfile<commit_after>var path = require('path');
var snippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;

module.exports = function ( grunt ) {
	var projectName = 'mytravis';

  grunt.initConfig({
    jshint: {
			options: {
				jshintrc: '.jshintrc'
			},
      files: ['js/**/*.src.js', 'specs/**/*.spec.js']
    },

    uglify: {
      build: {
        src: ['js/**/*.src.js'],
        dest: 'build/'+projectName+'.min.js'
      }
    },

    cssmin: {
      build: {
        src: ['css/**/*.src.css'],
        dest: 'build/'+projectName+'.min.css'
      }
    },

		copy: {
			imgs: {
				files: [
					{src: ['imgs/**'], dest: 'build/'} // includes files in path and its subdirs
				]
			}
		},

    zip: {
      dist: {
        exclude: ['./.*', './node_modules*', './screenshots*'],
        src: '.',
        dest: ''+projectName+'.zip'
      }
    },

		connect: {
			pivotal: {
				options: {
					port: 9001,
					base: '.'
				}
			},

			livereload: {
        options: {
          port: 9001,
          middleware: function(connect, options) {
            return [snippet, connect.static(path.resolve(options.base))];
          }
        }
      }
		},

		url: {
			pivotal: {
				host: 'localhost',
				port: '<%=connect.pivotal.options.port%>',
				runner: '<%=jasmine.pivotal.options.outfile%>'
			}
		},

		livereload: {
      port: 35729
    },

	  jasmine: {
			pivotal: {
				src: [
				  'js/app.src.js',
					'js/controller/*.src.js',
					'js/model/*.src.js',
					'js/service/*.src.js'
				],
				options: {
					host: 'http://localhost:<%=connect.port%>/',
					vendor: [
						'js/vendor/o.min.js',
						'js/vendor/litemq.min.js',
						'js/vendor/jquery-1.9.1.min.js',
						'js/vendor/utils.src.js',
						'spec/spec.src.js'
					],
					specs: ['spec/**/*.spec.js'],
					outfile: 'runner.html'
				}
			}
		},

		regarde: {
			pivotal: {
				files: ['js/**/*.src.js', 'spec/**/*.spec.js'],
				tasks: ['jasmine:pivotal'],
				spawn: true
			},

      livereload: {
        files: ['js/**/*.src.js', 'spec/**/*.spec.js'],
        tasks: ['livereload']
      }
		}
  });

	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-jasmine');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-livereload');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-regarde');

  // Aliased tasks (for readability purposes on "build" task)
  grunt.registerTask('o:cssmin', 'cssmin:build');
  grunt.registerTask('o:jsmin', 'uglify:build');
  grunt.registerTask('o:jslint', 'jshint');
  grunt.registerTask('o:zip', 'zip:dist');
  grunt.registerTask('o:imgs', 'copy:imgs');

	// Batch taks
	grunt.registerTask('o:ci', ['connect:pivotal', 'jasmine:pivotal']);
	grunt.registerTask('o:pivotal', ['connect:pivotal', 'regarde:pivotal']);
	grunt.registerTask('o:livereload', ['livereload-start', 'connect:livereload', 'jasmine:pivotal:build', 'url:pivotal', 'regarde:livereload']);
	grunt.registerTask('o:build', ['o:ci', 'o:jslint', 'o:jsmin', 'o:cssmin', 'o:imgs']);

	grunt.registerMultiTask('url', 'Mounts url on screen', function () {
		var host = this.data.host;
		var port = this.data.port;
		var runner = this.data.runner;

		grunt.log.writeln('Specs can now be accessed on http://'+host+':'+port+'/'+runner);
	});

  grunt.registerMultiTask('zip', 'Creates package for deploy.', function () {
    var options, done = this.async();

    options = ['--exclude'].concat(this.data.exclude);
    options = options.concat(['-r', this.data.dest, this.data.src]);

    grunt.util.spawn({cmd: 'zip', args: options}, function (err, result, code) {
      var output = result.err || result.stdout;

			grunt.log.writeln( '\n'+output+'\n' );

			done(code>0? false: true);
    });
  });
};
<|endoftext|>


<commit_before>// Generated on 2014-03-28 using generator-phaser-official 0.0.8-rc-2
'use strict';
var config = require('./config.json'),
    _ = require('underscore'),
    shell = require('shelljs'),
    LIVERELOAD_PORT = 35729,
    lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});

_.str = require('underscore.string');
_.mixin(_.str.exports());

function mountFolder(connect, dir) {
  return connect.static(require('path').resolve(dir));
}

module.exports = function (grunt) {
  // load all grunt tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  grunt.initConfig({
    manifest: grunt.file.readJSON('manifest.json'),
    watch: {
      scripts: {
        files: [
          '!game/main.js',
          'game/**/*',
          'templates/*.tpl',
          'config.json',
          'css/**/*.css'
        ],
        options: {
          spawn: false,
          livereload: LIVERELOAD_PORT
        },
        tasks: ['build:serve']
      }
    },
    connect: {
      options: {
        port: 9000,
        // change this to '0.0.0.0' to access the server from outside
        hostname: 'localhost'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, 'serve')
            ];
          }
        }
      }
    },
    open: {
      server: {
        path: 'http://<%= connect.options.hostname %>:<%= connect.options.port %>'
      }
    },
    copy: {
      serve: {
        files: [
          // includes files within path and its sub-directories
          { expand: true, src: ['assets/**', 'fonts/**', 'css/**'], dest: 'serve/' },
          { expand: true, flatten: true, src: [
            'game/plugins/*{.js,.map}',
            'bower_components/*/build/*{.js,.map}',
            'bower_components/*/dist/*{.js,.map}',
            'game/index.html'
          ], dest: 'serve/' }
        ]
      },
      dist: {
        files: [
          // includes files within path and its sub-directories
          { expand: true, src: [
            'assets/**',
            'fonts/**',
            'css/**',
            'icon.png',
            'manifest.json'
          ], dest: 'dist/' },
          { expand: true, flatten: true, src: [
            'game/plugins/*{.js,.map}',
            'bower_components/*/build/*{.js,.map}',
            'bower_components/*/dist/*{.js,.map}',
            'game/index.html'
          ], dest: 'dist/' }
        ]
      },
      dev: {
        options: {
          process: function(content) {
            return grunt.template.process(content, {
              data: {
                dependencies: [
                  'cordova.js',
                  'phaser.js',
                  'phaser-state-transition-plugin.js',
                  'game.js'
                ]
              }
            });
          }
        },
        files: [
          { src: 'game/config/config.dev.json', dest: 'game/config.json' },
          { src: 'templates/_index.html.tpl', dest: 'game/index.html' }
        ]
      },
      prod: {
        options: {
          process: function(content) {
            return grunt.template.process(content, {
              data: {
                dependencies: [
                  'cordova.js',
                  'phaser.js',
                  'phaser-state-transition-plugin.min.js',
                  'game.js'
                ]
              }
            });
          }
        },
        files: [
          { src: 'game/config/config.prod.json', dest: 'game/config.json' },
          { src: 'templates/_index.html.tpl', dest: 'game/index.html' }
        ]
      }
    },
    browserify: {
      serve: {
        src: ['game/main.js'],
        dest: 'serve/game.js'
      },
      dist: {
        src: ['game/main.js'],
        dest: 'dist/game.js'
        // dest: '.cache/game.js'
      }
    },
    // DISABLED
    uglify: {
      dist: {
        // files: {
        //   'dist/game.min.js': ['.cache/game.js']
        // }
      },
      serve: {}
    },
    clean: {
      serve: ['serve'],
      dist: ['dist', 'build'],
    },
    shell: {
      options: {
        stderr: false
      },
      xwalkBuild: {
        command: [
          'python $CROSSWALK_HOME/make_apk.py',
          '--manifest=dist/manifest.json',
          '--package=<%= manifest.package %>',
          '--name=<%= manifest.name %>',
          '--target-dir=build',
          '--mode=' + grunt.option('mode', 'embedded'),
          grunt.option('enable-remote-debugging') ? '--enable-remote-debugging' : '',
          grunt.option('verbose') ? '--verbose' : '',
          // Options for signing the apk for google play
          grunt.option('keystore-path') ? '--keystore-path=' + grunt.option('keystore-path') : '',
          grunt.option('keystore-alias') ? '--keystore-alias=' + grunt.option('keystore-alias') : '',
          grunt.option('keystore-passcode') ? '--keystore-passcode=' + grunt.option('keystore-passcode') : '',
          grunt.option('keystore-alias-passcode') ? '--keystore-alias-passcode=' + grunt.option('keystore-alias-passcode') : '',
          grunt.option('compressor') ? '--compressor' : ''
        ].join(' ')
      },
      xwalkInstallx86: {
        command: 'adb install -r build/*_x86.apk'
      },
      xwalkInstallarm: {
        command: 'adb install -r build/*_arm.apk'
      },
      restartAdb: {
        command: [
          'sudo $(which adb) kill-server',
          'sudo $(which adb) start-server',
          'adb devices'
        ].join('&&')
      },
      cordovaPrepare: {
        command: [
          'rm -rf www',
          'cp -a dist www'
        ].join('&&')
      },
      cordovaSplashIcons: {
        command: [
          'cordova-icon',
          'cordova-splash'
        ].join('&&')
      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json', 'manifest.json', 'config.xml'],
        updateConfigs: [],
        commit: true,
        commitMessage: 'Release %VERSION%',
        commitFiles: ['package.json', 'bower.json', 'manifest.json', 'config.xml'],
        createTag: false,
        tagName: '%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: false,
        pushTo: 'upstream',
        gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
      }
    },
    jshint: {
      all: ['game/**/*.js', 'Gruntfile.js'],
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      }
    },
    jscs: {
      src: [
        'game/**/*.js',
        '!game/main.js',
        '!game/plugins/*'
      ],
      options: {
        config: '.jscsrc',
        reporter: require('jscs-stylish').path
      }
    },
    githooks: {
      all: {
        'pre-commit': 'jshint jscs',
      }
    },
    'notify_hooks': {
      options: {
        enabled: true,
        'max_jshint_notifications': 5, // maximum number of notifications from jshint output
        success: true, // whether successful grunt executions should be notified automatically
        duration: 3 // the duration of notification in seconds, for `notify-send only
      }
    },
  });

  // Register Grunt Tasks
  grunt.registerTask('default', 'serve');
  grunt.registerTask('buildBootstrapper', function() {
    var stateFiles = grunt.file.expand('game/states/*.js'),
        gameStates = [],
        statePattern = new RegExp(/(\w+).js$/),
        bootstrapper = grunt.file.read('templates/_main.js.tpl');

    stateFiles.forEach(function(file) {
      var state = file.match(statePattern)[1];
      if (!!state) {
        gameStates.push({shortName: state, stateName: _.capitalize(state) + 'State'});
      }
    });
    config.gameStates = gameStates;
    bootstrapper = grunt.template.process(bootstrapper, {data: config});
    grunt.file.write('game/main.js', bootstrapper);
  });
  grunt.registerTask('build', function(dest) {
    grunt.task.run([
      'buildBootstrapper',
      'browserify:' + (dest || 'dist'),
      'uglify:' + (dest || 'dist'),
      'copy:' + (dest || 'dist'),
      'notify_hooks'
    ]);
  });
  grunt.registerTask('serve', function(environment) {
    grunt.task.run([
      'githooks',
      'clean:serve',
      'copy:' + (environment || 'dev'),
      'build:serve',
      'connect:livereload',
      'open',
      'watch'
    ]);
  });
  grunt.registerTask('xwalkBuild', function(environment) {
    grunt.task.run([
      'clean:dist',
      'copy:' + (environment || 'prod'),
      'build:dist',
      'shell:xwalkBuild',
      'notify_hooks'
    ]);
  });
  grunt.registerTask('restartAdb', ['shell:restartAdb']);
  grunt.registerTask('xwalkInstall', function(arch) {
    // arch is x86 (Intel based tablets) or arm (non-Intel)
    grunt.task.run(['shell:xwalkInstall' + (arch || 'arm'), 'notify_hooks']);
  });
  grunt.registerTask('cordovaPlatformsPlugins', function() {
    var pkg = grunt.file.readJSON('package.json');
    if (!pkg.platforms) {
      return grunt.log.error('Platforms not found.');
    }
    if (grunt.option('preserve-platforms')) {
      return grunt.log.writeln('Preserves platforms and plugins');
    }
    _.forEach(pkg.platforms, function (platform) {
      grunt.log.writeln('Installing platform ' + platform);
      shell.exec('cordova platform add ' + platform);
    });
    _.forEach(pkg.plugins, function (plugin) {
      grunt.log.writeln('Installing plugin ' + plugin);
      shell.exec('cordova plugin add ' + plugin);
    });
  });
  grunt.registerTask('cordovaPrepare', function(environment) {
    var tasks = [
      'clean:dist',
      'copy:' + (environment || 'prod'),
      'build:dist',
      'shell:cordovaPrepare',
      'cordovaPlatformsPlugins'
    ];
    if (grunt.option('splashicons')) {
      tasks.push('shell:cordovaSplashIcons');
    }
    grunt.task.run(tasks);
  });
};
<commit_msg>feat(uglify): minifies game.js<commit_after>// Generated on 2014-03-28 using generator-phaser-official 0.0.8-rc-2
'use strict';
var config = require('./config.json'),
    _ = require('underscore'),
    shell = require('shelljs'),
    LIVERELOAD_PORT = 35729,
    lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});

_.str = require('underscore.string');
_.mixin(_.str.exports());

function mountFolder(connect, dir) {
  return connect.static(require('path').resolve(dir));
}

module.exports = function (grunt) {
  // load all grunt tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  grunt.initConfig({
    manifest: grunt.file.readJSON('manifest.json'),
    watch: {
      scripts: {
        files: [
          '!game/main.js',
          'game/**/*',
          'templates/*.tpl',
          'config.json',
          'css/**/*.css'
        ],
        options: {
          spawn: false,
          livereload: LIVERELOAD_PORT
        },
        tasks: ['build:serve']
      }
    },
    connect: {
      options: {
        port: 9000,
        // change this to '0.0.0.0' to access the server from outside
        hostname: 'localhost'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, 'serve')
            ];
          }
        }
      }
    },
    open: {
      server: {
        path: 'http://<%= connect.options.hostname %>:<%= connect.options.port %>'
      }
    },
    copy: {
      serve: {
        files: [
          // includes files within path and its sub-directories
          { expand: true, src: ['assets/**', 'fonts/**', 'css/**'], dest: 'serve/' },
          { expand: true, flatten: true, src: [
            'game/plugins/*{.js,.map}',
            'bower_components/*/build/*{.js,.map}',
            'bower_components/*/dist/*{.js,.map}',
            'game/index.html'
          ], dest: 'serve/' }
        ]
      },
      dist: {
        files: [
          // includes files within path and its sub-directories
          { expand: true, src: [
            'assets/**',
            'fonts/**',
            'css/**',
            'icon.png',
            'manifest.json'
          ], dest: 'dist/' },
          { expand: true, flatten: true, src: [
            'game/plugins/*{.js,.map}',
            'bower_components/*/build/*{.js,.map}',
            'bower_components/*/dist/*{.js,.map}',
            'game/index.html'
          ], dest: 'dist/' }
        ]
      },
      dev: {
        options: {
          process: function(content) {
            return grunt.template.process(content, {
              data: {
                dependencies: [
                  'cordova.js',
                  'phaser.js',
                  'phaser-state-transition-plugin.js',
                  'game.js'
                ]
              }
            });
          }
        },
        files: [
          { src: 'game/config/config.dev.json', dest: 'game/config.json' },
          { src: 'templates/_index.html.tpl', dest: 'game/index.html' }
        ]
      },
      prod: {
        options: {
          process: function(content) {
            return grunt.template.process(content, {
              data: {
                dependencies: [
                  'cordova.js',
                  'phaser.js',
                  'phaser-state-transition-plugin.min.js',
                  'game.min.js'
                ]
              }
            });
          }
        },
        files: [
          { src: 'game/config/config.prod.json', dest: 'game/config.json' },
          { src: 'templates/_index.html.tpl', dest: 'game/index.html' }
        ]
      }
    },
    browserify: {
      serve: {
        src: ['game/main.js'],
        dest: 'serve/game.js'
      },
      dist: {
        src: ['game/main.js'],
        // dest: 'dist/game.js'
        dest: '.cache/game.js'
      }
    },
    uglify: {
      dist: {
        // comment below to disable
        files: {
          'dist/game.min.js': ['.cache/game.js']
        }
      },
      serve: {}
    },
    clean: {
      serve: ['serve'],
      dist: ['dist', 'build'],
    },
    shell: {
      options: {
        stderr: false
      },
      xwalkBuild: {
        command: [
          'python $CROSSWALK_HOME/make_apk.py',
          '--manifest=dist/manifest.json',
          '--package=<%= manifest.package %>',
          '--name=<%= manifest.name %>',
          '--target-dir=build',
          '--mode=' + grunt.option('mode', 'embedded'),
          grunt.option('enable-remote-debugging') ? '--enable-remote-debugging' : '',
          grunt.option('verbose') ? '--verbose' : '',
          // Options for signing the apk for google play
          grunt.option('keystore-path') ? '--keystore-path=' + grunt.option('keystore-path') : '',
          grunt.option('keystore-alias') ? '--keystore-alias=' + grunt.option('keystore-alias') : '',
          grunt.option('keystore-passcode') ? '--keystore-passcode=' + grunt.option('keystore-passcode') : '',
          grunt.option('keystore-alias-passcode') ? '--keystore-alias-passcode=' + grunt.option('keystore-alias-passcode') : '',
          grunt.option('compressor') ? '--compressor' : ''
        ].join(' ')
      },
      xwalkInstallx86: {
        command: 'adb install -r build/*_x86.apk'
      },
      xwalkInstallarm: {
        command: 'adb install -r build/*_arm.apk'
      },
      restartAdb: {
        command: [
          'sudo $(which adb) kill-server',
          'sudo $(which adb) start-server',
          'adb devices'
        ].join('&&')
      },
      cordovaPrepare: {
        command: [
          'rm -rf www',
          'cp -a dist www'
        ].join('&&')
      },
      cordovaSplashIcons: {
        command: [
          'cordova-icon',
          'cordova-splash'
        ].join('&&')
      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json', 'manifest.json', 'config.xml'],
        updateConfigs: [],
        commit: true,
        commitMessage: 'Release %VERSION%',
        commitFiles: ['package.json', 'bower.json', 'manifest.json', 'config.xml'],
        createTag: false,
        tagName: '%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: false,
        pushTo: 'upstream',
        gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
      }
    },
    jshint: {
      all: ['game/**/*.js', 'Gruntfile.js'],
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      }
    },
    jscs: {
      src: [
        'game/**/*.js',
        '!game/main.js',
        '!game/plugins/*'
      ],
      options: {
        config: '.jscsrc',
        reporter: require('jscs-stylish').path
      }
    },
    githooks: {
      all: {
        'pre-commit': 'jshint jscs',
      }
    },
    'notify_hooks': {
      options: {
        enabled: true,
        'max_jshint_notifications': 5, // maximum number of notifications from jshint output
        success: true, // whether successful grunt executions should be notified automatically
        duration: 3 // the duration of notification in seconds, for `notify-send only
      }
    },
  });

  // Register Grunt Tasks
  grunt.registerTask('default', 'serve');
  grunt.registerTask('buildBootstrapper', function() {
    var stateFiles = grunt.file.expand('game/states/*.js'),
        gameStates = [],
        statePattern = new RegExp(/(\w+).js$/),
        bootstrapper = grunt.file.read('templates/_main.js.tpl');

    stateFiles.forEach(function(file) {
      var state = file.match(statePattern)[1];
      if (!!state) {
        gameStates.push({shortName: state, stateName: _.capitalize(state) + 'State'});
      }
    });
    config.gameStates = gameStates;
    bootstrapper = grunt.template.process(bootstrapper, {data: config});
    grunt.file.write('game/main.js', bootstrapper);
  });
  grunt.registerTask('build', function(dest) {
    grunt.task.run([
      'buildBootstrapper',
      'browserify:' + (dest || 'dist'),
      'uglify:' + (dest || 'dist'),
      'copy:prod',
      'copy:' + (dest || 'dist'),
      'notify_hooks'
    ]);
  });
  grunt.registerTask('serve', function(environment) {
    grunt.task.run([
      'githooks',
      'clean:serve',
      'copy:' + (environment || 'dev'),
      'build:serve',
      'connect:livereload',
      'open',
      'watch'
    ]);
  });
  grunt.registerTask('xwalkBuild', function(environment) {
    grunt.task.run([
      'clean:dist',
      'copy:' + (environment || 'prod'),
      'build:dist',
      'shell:xwalkBuild',
      'notify_hooks'
    ]);
  });
  grunt.registerTask('restartAdb', ['shell:restartAdb']);
  grunt.registerTask('xwalkInstall', function(arch) {
    // arch is x86 (Intel based tablets) or arm (non-Intel)
    grunt.task.run(['shell:xwalkInstall' + (arch || 'arm'), 'notify_hooks']);
  });
  grunt.registerTask('cordovaPlatformsPlugins', function() {
    var pkg = grunt.file.readJSON('package.json');
    if (!pkg.platforms) {
      return grunt.log.error('Platforms not found.');
    }
    if (grunt.option('preserve-platforms')) {
      return grunt.log.writeln('Preserves platforms and plugins');
    }
    _.forEach(pkg.platforms, function (platform) {
      grunt.log.writeln('Installing platform ' + platform);
      shell.exec('cordova platform add ' + platform);
    });
    _.forEach(pkg.plugins, function (plugin) {
      grunt.log.writeln('Installing plugin ' + plugin);
      shell.exec('cordova plugin add ' + plugin);
    });
  });
  grunt.registerTask('cordovaPrepare', function(environment) {
    var tasks = [
      'clean:dist',
      'copy:' + (environment || 'prod'),
      'build:dist',
      'shell:cordovaPrepare',
      'cordovaPlatformsPlugins'
    ];
    if (grunt.option('splashicons')) {
      tasks.push('shell:cordovaSplashIcons');
    }
    grunt.task.run(tasks);
  });
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {

	var pkg = grunt.file.readJSON('package.json');

	grunt.initConfig({
		pkg: pkg,
		stylus: {
			compile: {
				files: {
					'assets/compiled/styles.css': ['assets/styles/relay.styl']
				}
			}
		},
		cssjoin: {
			compile: {
				options: {
					paths: ['assets/styles']
				},
				files: {
					'assets/compiled/styles.css': ['assets/compiled/styles.css']
				}
			}
		},
		handlebars: {
			compile: {
				options: {
					namespace: 'irc.templates',
					processName: function( filename ){
						filename = filename.replace( /^assets\/templates\//i, '' );
						filename = filename.replace( /\.hbs$/i, '' );
						return filename;
					}
				},
				files: {
					'assets/compiled/templates.js': ['assets/templates/**/*.hbs']
				}
			}
		},
		browserify: {
			options: {
				shim: {
					jquery: {
						path: 'assets/scripts/vendor/jquery.js',
						exports: '$'
					},
					'jquery-ui': {
						path: 'assets/scripts/vendor/jquery-ui.custom.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					'jquery.emojify': {
						path: 'assets/scripts/vendor/jquery.emojify.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					'jquery.links': {
						path: 'assets/scripts/vendor/jquery.links.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					'jquery.resize': {
						path: 'assets/scripts/vendor/jquery.resize.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					'jquery.serializeObject': {
						path: 'assets/scripts/vendor/jquery.serializeObject.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					'jquery.sparkartTags': {
						path: 'assets/scripts/vendor/jquery.sparkartTags.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					bootstrap: {
						path: 'assets/scripts/vendor/bootstrap.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					visibility: {
						path: 'assets/scripts/vendor/visibility.js',
						exports: 'Visibility'
					}
				}
			},
			relay: {
				files: {
					'assets/compiled/scripts.js': ['assets/scripts/relay.js']
				}
			}
		},
		clean: {
			js: {
				src: [ 'assets/compiled/templates.js' ]
			},
			css: {
				src: [ 'assets/compiled/stylus_styles.css' ]
			}
		},
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
			},
			build: {
				files: {
					'assets/compiled/scripts.js': ['assets/compiled/scripts.js'],
					'assets/compiled/templates.js': ['assets/compiled/templates.js']
				}
			}
		},
		cssmin: {
			options: {
				banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
			},
			build: {
				files: {
					'assets/compiled/styles.css': ['assets/compiled/styles.css']
				}
			}
		},
		watch: {
			css: {
				files: [ 'assets/styles/**/*.styl', 'assets/styles/**/*.css' ],
				tasks: [ 'buildcss' ]
			},
			js: {
				files: [ 'assets/scripts/**/*.js', 'assets/templates/**/*.hbs' ],
				tasks: [ 'buildjs' ]
			},
			livereload: {
				options: {
					livereload: true
				},
				files: [ 'assets/compiled/styles.css' ]
			}
		},
		jshint: {
			options: {
				multistr: true
			},
			all: [ 'relay.js', 'lib/**/*.js', 'assets/scripts/**/*.js', '!assets/scripts/vendor/**/*.js' ]
		}
	});

	// the cool/easy way to do it
	Object.keys( pkg.devDependencies ).forEach( function( dep ){
		if( dep.substring( 0, 6 ) === 'grunt-' ) grunt.loadNpmTasks( dep );
	});

	grunt.registerTask( 'server', 'Start the relay.js server', function(){
		var port = grunt.option('port') || grunt.option('p');
		var args = ['relay.js','--livereload'];
		if( port ) args = args.concat([ '-p', port ]);
		grunt.util.spawn({
			cmd: 'node',
			args: args,
			opts: {
				stdio: 'inherit'
			}
		});
	});

	grunt.registerTask( 'default', ['build'] );
	grunt.registerTask( 'build', [ 'buildcss', 'buildjs' ] );
	grunt.registerTask( 'buildcss', [ 'stylus', 'cssjoin', 'clean:css' ] );
	grunt.registerTask( 'buildjs', [ 'jshint', 'browserify' ] );
	grunt.registerTask( 'minify', [ 'uglify', 'cssmin' ] );
	grunt.registerTask( 'predeploy', [ 'build' ] );
	grunt.registerTask( 'dev', [ 'build', 'server', 'watch' ] );

};<commit_msg>update jshint configuration to properly lint node.js files<commit_after>module.exports = function(grunt) {

	var pkg = grunt.file.readJSON('package.json');

	grunt.initConfig({
		pkg: pkg,
		stylus: {
			compile: {
				files: {
					'assets/compiled/styles.css': ['assets/styles/relay.styl']
				}
			}
		},
		cssjoin: {
			compile: {
				options: {
					paths: ['assets/styles']
				},
				files: {
					'assets/compiled/styles.css': ['assets/compiled/styles.css']
				}
			}
		},
		handlebars: {
			compile: {
				options: {
					namespace: 'irc.templates',
					processName: function( filename ){
						filename = filename.replace( /^assets\/templates\//i, '' );
						filename = filename.replace( /\.hbs$/i, '' );
						return filename;
					}
				},
				files: {
					'assets/compiled/templates.js': ['assets/templates/**/*.hbs']
				}
			}
		},
		browserify: {
			options: {
				shim: {
					jquery: {
						path: 'assets/scripts/vendor/jquery.js',
						exports: '$'
					},
					'jquery-ui': {
						path: 'assets/scripts/vendor/jquery-ui.custom.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					'jquery.emojify': {
						path: 'assets/scripts/vendor/jquery.emojify.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					'jquery.links': {
						path: 'assets/scripts/vendor/jquery.links.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					'jquery.resize': {
						path: 'assets/scripts/vendor/jquery.resize.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					'jquery.serializeObject': {
						path: 'assets/scripts/vendor/jquery.serializeObject.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					'jquery.sparkartTags': {
						path: 'assets/scripts/vendor/jquery.sparkartTags.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					bootstrap: {
						path: 'assets/scripts/vendor/bootstrap.js',
						exports: null,
						depends: {
							jquery: '$'
						}
					},
					visibility: {
						path: 'assets/scripts/vendor/visibility.js',
						exports: 'Visibility'
					}
				}
			},
			relay: {
				files: {
					'assets/compiled/scripts.js': ['assets/scripts/relay.js']
				}
			}
		},
		clean: {
			js: {
				src: [ 'assets/compiled/templates.js' ]
			},
			css: {
				src: [ 'assets/compiled/stylus_styles.css' ]
			}
		},
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
			},
			build: {
				files: {
					'assets/compiled/scripts.js': ['assets/compiled/scripts.js'],
					'assets/compiled/templates.js': ['assets/compiled/templates.js']
				}
			}
		},
		cssmin: {
			options: {
				banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
			},
			build: {
				files: {
					'assets/compiled/styles.css': ['assets/compiled/styles.css']
				}
			}
		},
		watch: {
			css: {
				files: [ 'assets/styles/**/*.styl', 'assets/styles/**/*.css' ],
				tasks: [ 'buildcss' ]
			},
			js: {
				files: [ 'assets/scripts/**/*.js', 'assets/templates/**/*.hbs' ],
				tasks: [ 'buildjs' ]
			},
			livereload: {
				options: {
					livereload: true
				},
				files: [ 'assets/compiled/styles.css' ]
			}
		},
		jshint: {
			client: {
				options: {
					multistr: true
				},
				files: {
					src: [ 'assets/scripts/**/*.js', '!assets/scripts/vendor/**/*.js' ]
				}
			},
			server: {
				options: {
					node: true,
					esnext: true
				},
				files: {
					src: [ 'relay.js', 'lib/**/*.js' ]
				}
			}
		}
	});

	// the cool/easy way to do it
	Object.keys( pkg.devDependencies ).forEach( function( dep ){
		if( dep.substring( 0, 6 ) === 'grunt-' ) grunt.loadNpmTasks( dep );
	});

	grunt.registerTask( 'server', 'Start the relay.js server', function(){
		var port = grunt.option('port') || grunt.option('p');
		var args = ['relay.js','--livereload'];
		if( port ) args = args.concat([ '-p', port ]);
		grunt.util.spawn({
			cmd: 'node',
			args: args,
			opts: {
				stdio: 'inherit'
			}
		});
	});

	grunt.registerTask( 'default', ['build'] );
	grunt.registerTask( 'build', [ 'buildcss', 'buildjs' ] );
	grunt.registerTask( 'buildcss', [ 'stylus', 'cssjoin', 'clean:css' ] );
	grunt.registerTask( 'buildjs', [ 'jshint', 'browserify' ] );
	grunt.registerTask( 'minify', [ 'uglify', 'cssmin' ] );
	grunt.registerTask( 'predeploy', [ 'build' ] );
	grunt.registerTask( 'dev', [ 'build', 'server', 'watch' ] );

};<|endoftext|>


<commit_before>module.exports = function(grunt) {

  'use strict';

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

    coffee: {
      compile: {
        files: {
          'dist/angles.js': ['src/*.coffee']
        }
      }
    },

    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      my_target: {
        files: {
          'dist/angles.min.js': 'dist/angles.js'
        }
      }
    },

    qunit: {
      all: ['test/*.html']
    },
  });

  grunt.registerTask('default', ['coffee', 'uglify']);
  grunt.registerTask('test', ['qunit']);

  grunt.registerTask('install', 'Install all JavaScript dependencies using bower, including optional libraries.', function() {
    var shell = require('shelljs');
    console.log("Running `bower install`");
    if(!shell.which("bower")) {
      console.log("Sorry, this script requires bower.");
      exit(1);
    }
    shell.exec('bower install');
    shell.exec('bower install Backbone.localStorage');
    shell.exec('bower install FileSaver');
  });

  grunt.registerTask('demo', 'Install all dependencies and provide a list of demo files', function() {
    console.log("demo/index.html");
    console.log("demo/srvValidation.html");
  });

  grunt.event.on('qunit.spawn', function(url) {
    grunt.log.ok("Running test: " + url);
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-coffee');

};<commit_msg>add 'demo:files' breakout to list demo files<commit_after>module.exports = function(grunt) {

  'use strict';

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

    coffee: {
      compile: {
        files: {
          'dist/angles.js': ['src/*.coffee']
        }
      }
    },

    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      my_target: {
        files: {
          'dist/angles.min.js': 'dist/angles.js'
        }
      }
    },

    qunit: {
      all: ['test/*.html']
    },
  });

  grunt.registerTask('default', ['coffee', 'uglify']);
  grunt.registerTask('test', ['qunit']);

  grunt.registerTask('install', 'Install all JavaScript dependencies using bower, including optional libraries.', function() {
    var shell = require('shelljs');
    if(!shell.which("bower")) {
      console.log("Sorry, this script requires bower.");
      exit(1);
    }
    shell.exec('bower install');
    shell.exec('bower install Backbone.localStorage');
    shell.exec('bower install FileSaver');
  });

  grunt.registerTask('demo', 'Install all dependencies and provide a list of demo files', ['default', 'install', 'demo:files' ]);
  grunt.registerTask('demo:files', function() {
    console.log("demo/index.html");
    console.log("demo/srvValidation.html");
  });

  grunt.event.on('qunit.spawn', function(url) {
    grunt.log.ok("Running test: " + url);
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-coffee');

};<|endoftext|>


<commit_before>"use strict";

var modRewrite = require("connect-modrewrite");

module.exports = function (grunt) {

    var base = grunt.option("baseDir") || "",
        env = grunt.option("env") || "development",
        protractorConf = grunt.option("ci") ?
                        "tests/e2e/protractor.saucelabs.conf.js" :
                        "tests/e2e/protractor.conf.js" ;

    grunt.initConfig({

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

        config: {
            outputDir: "dist/",
            env: grunt.file.readJSON("env.json")[env],
            applicationFiles: grunt.file.readJSON("scripts.json").application,
            vendorFiles: grunt.file.readJSON("scripts.json").vendor
        },

        connect: {
            options: {
                hostname: "0.0.0.0",
                port: 8000,
                base: base
            },
            server: {
                options: {
                    livereload: true,
                    middleware: function ( connect, options, middlewares ) {
                        var rules = (base === "dist") ?
                            [ "^/[^\.]*$ /index.html" ] :
                            [ "^/app/[^\.]*$ /app/index.html" ];
                        middlewares.unshift( modRewrite( rules ) );
                        return middlewares;
                    }
                }
            },
            servertest: {
                options: {
                    keepalive: false,
                    livereload: false,
                    base: "dist",
                    middleware: function ( connect, options, middlewares ) {
                        var rules = [ "^/[^\.]*$ /index.html" ];
                        middlewares.unshift( modRewrite( rules ) );
                        return middlewares;
                    }
                }
            }
        },

        watch: {
            options: {
                nospawn: false,
                livereload: true
            },
            css: {
                files: [
                    "app/index.html",

                    "app/less/*.less",
                    "app/less/**/*.less",
                    "app/less/**/**/*.less",

                    "app/partials/*.html",
                    "app/partials/**/*.html",
                    "app/partials/**/**/*.html",

                    "modules/*.html",
                    "modules/**/*.html",
                    "modules/**/**/*.html"
                ],
                tasks: ["less:development"]
            },
            javascript: {
                files: [
                    "app/js/*.js",
                    "app/js/**/*.js",
                    "app/js/**/**/*.js",

                    "tests/unit/*.js",
                    "tests/unit/**/*.js",
                    "tests/unit/**/**/*.js"
                ],
                tasks: ["test:development"]
            }
        },

        less: {
            options: {
                paths: ["app/less/"],
                cleancss: false,
                banner: "/*! <%= pkg.name %> - v<%= pkg.version %> - " +
                    "<%= grunt.template.today(\"yyyy-mm-dd\") %> */\n"
            },
            development: {
                files: { "app/css/all.css": "app/less/main.less" },
                options: {
                    sourceMap: true,
                    sourceMapFilename: "app/css/all.css.map",
                    sourceMapURL: "all.css.map",
                    outputSourceFiles: true
                }
            },
            production: {
                files: { "<%= config.outputDir %>css/all.min.css": "app/less/main.less" },
                options: {
                    cleancss: true
                }
            }
        },

        jshint: {
            options: {
                jshintrc: ".jshintrc"
            },
            dist: {
                src: ["<%= config.applicationFiles %>"]
            }
        },

        jasmine: {
            options: {
                specs: ["tests/unit/**/*.js"],
                keepRunner: true,
            },
            development: {
                src: ["<%= ngconstant.options.dest %>", "<%= config.applicationFiles %>"],
                options: {
                    vendor: ["<%= config.vendorFiles %>"],
                    helpers:["app/components/angular-mocks/angular-mocks.js"],
                    template: require("grunt-template-jasmine-istanbul"),
                    templateOptions: {
                        coverage: "coverage/coverage.json",
                        report: [
                            {
                                type: "lcov",
                                options: {
                                    dir: "coverage"
                                }
                            },
                            {
                                type: "text-summary"
                            }
                        ]
                    }
                }
            },
            production: {
                src: ["<%= config.outputDir %>js/app.min.js", "app/components/angular-mocks/angular-mocks.js"]
            }
        },

        protractor: {
            options: {
                keepAlive: false,
                noColor: false
            },
            dist: {
                options: {
                    configFile: protractorConf
                }
            }
        },

        protractor_webdriver: {
            dist: {
                options: {
                    command: "webdriver-manager update && webdriver-manager start",
                }
            }
        },

        concat: {
            options: {
                sourceMap: true,
                separator: ";",
                banner: "/*! <%= pkg.name %> - v<%= pkg.version %> - " +
                    "<%= grunt.template.today(\"yyyy-mm-dd\") %> */\n"
            },
            production: {
                src: [
                    "<%= config.vendorFiles %>",
                    "<%= ngconstant.options.dest %>",
                    "<%= config.applicationFiles %>"
                ],
                dest: "<%= config.outputDir %>js/app.js"
            }
        },

        uglify: {
            options: {
                sourceMap: true,
                sourceMapIncludeSources: true,
                enclose: { window: "window" },
                banner: "/*! <%= pkg.name %> - v<%= pkg.version %> - " +
                    "<%= grunt.template.today(\"yyyy-mm-dd\") %> */\n"
            },
            production: {
                files: {
                    "<%= config.outputDir %>js/app.min.js":
                    [
                        "<%= config.vendorFiles %>",
                        "<%= ngconstant.options.dest %>",
                        "<%= config.applicationFiles %>"
                    ]
                }
            }
        },

        copy: {
            images: {
                files: [{
                    expand: true,
                    cwd: "app/img",
                    src: ["**/*", "!test/**"],
                    dest: "<%= config.outputDir %>img/"
                }]
            },
            partials: {
                files: [{
                    expand: true,
                    cwd: "app/partials",
                    src: ["*.html"],
                    dest: "<%= config.outputDir %>partials/"
                }]
            },
            e2e: {
                files: [{
                    expand: true,
                    flatten: true,
                    src: [
                        "app/components/angular-mocks/angular-mocks.js",
                        "tests/e2e/app.js"
                    ],
                    dest: "<%= config.outputDir %>e2e/"
                }]
            }
        },

        clean: {
            beforeBuild: {
                src: ["<%= config.outputDir %>", "docs"]
            },
            e2e: {
                src: ["<%= config.outputDir %>"]
            }
        },

        processhtml: {
            options: {
                strip: true,
                data: {
                    url: "<%= config.env.BASE_URL %>"
                }
            },
            production: {
                files: {
                    "<%= config.outputDir %>index.html": ["app/index.html"]
                }
            },
            e2e: {
                files: {
                    "<%= config.outputDir %>index.html": ["app/index.html"]
                }
            }
        },

        yuidoc: {
            compile: {
                name: "<%= pkg.name %>",
                description: "<%= pkg.description %>",
                version: "<%= pkg.version %>",
                url: "<%= pkg.homepage %>",
                options: {
                    paths: "app/js/",
                    themedir: "node_modules/yuidoc-bootstrap-theme",
                    helpers: ["node_modules/yuidoc-bootstrap-theme/helpers/helpers.js"],
                    outdir: "docs/"
                }
            }
        },

        bump: {
            options: {
                files: ["package.json", "bower.json"],
                updateConfigs: ["pkg"],
                commit: true,
                commitFiles: ["-a"],
                createTag: true,
                push: true,
                pushTo: "origin master"
            }
        },

        ngconstant: {
            options: {
                name: "ENV",
                dest: "app/js/env/env.js",
                constants: "<%= config.env %>"
            },
            dist: {}
        },

    });

    grunt.loadNpmTasks("grunt-contrib-copy");
    grunt.loadNpmTasks("grunt-contrib-clean");
    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-contrib-less");
    grunt.loadNpmTasks("grunt-contrib-watch");
    grunt.loadNpmTasks("grunt-contrib-connect");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-yuidoc");
    grunt.loadNpmTasks("grunt-contrib-jasmine");
    grunt.loadNpmTasks("grunt-protractor-runner");
    grunt.loadNpmTasks("grunt-protractor-webdriver");
    grunt.loadNpmTasks("grunt-processhtml");
    grunt.loadNpmTasks('grunt-ng-constant');
    grunt.loadNpmTasks('grunt-bump');

    grunt.registerTask("build", [
        "clean:beforeBuild",
        "less:production",
        "ngconstant",
        "uglify",
        "copyBuild",
        "processhtml:production"
    ]);

    grunt.registerTask("release", [
        "bump-only",
        "build",
        "bump-commit"
    ]);

    grunt.registerTask("copyBuild", [
        "copy:images",
        "copy:partials"
    ]);

    grunt.registerTask("server", [
        "ngconstant",
        "less:development",
        "connect:server",
        "watch:css"
    ]);

    grunt.registerTask("serverjs", [
        "ngconstant",
        "less:development",
        "connect:server",
        "watch:javascript"
    ]);

    grunt.registerTask("serverall", [
        "ngconstant",
        "less:development",
        "connect:server",
        "watch"
    ]);

    grunt.registerTask("test", [
        "clean:beforeBuild",
        "ngconstant",
        "jshint",
        "uglify",
        "jasmine:production"
    ]);

    grunt.registerTask("test:development", [
        "ngconstant",
        "jshint",
        "jasmine:development"
    ]);

    grunt.registerTask("e2e", [
        "ngconstant",
        "less:production",
        "uglify",
        "copy",
        "processhtml:e2e",
        "connect:servertest",
        "protractor_webdriver",
        "protractor:dist",
        "clean:e2e"
    ]);

    grunt.registerTask("default", ["build"]);

};
<commit_msg>add concat to grunt build task; to fix satellizer build issue<commit_after>"use strict";

var modRewrite = require("connect-modrewrite");

module.exports = function (grunt) {

    var base = grunt.option("baseDir") || "",
        env = grunt.option("env") || "development",
        protractorConf = grunt.option("ci") ?
                        "tests/e2e/protractor.saucelabs.conf.js" :
                        "tests/e2e/protractor.conf.js" ;

    grunt.initConfig({

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

        config: {
            outputDir: "dist/",
            env: grunt.file.readJSON("env.json")[env],
            applicationFiles: grunt.file.readJSON("scripts.json").application,
            vendorFiles: grunt.file.readJSON("scripts.json").vendor
        },

        connect: {
            options: {
                hostname: "0.0.0.0",
                port: 8000,
                base: base
            },
            server: {
                options: {
                    livereload: true,
                    middleware: function ( connect, options, middlewares ) {
                        var rules = (base === "dist") ?
                            [ "^/[^\.]*$ /index.html" ] :
                            [ "^/app/[^\.]*$ /app/index.html" ];
                        middlewares.unshift( modRewrite( rules ) );
                        return middlewares;
                    }
                }
            },
            servertest: {
                options: {
                    keepalive: false,
                    livereload: false,
                    base: "dist",
                    middleware: function ( connect, options, middlewares ) {
                        var rules = [ "^/[^\.]*$ /index.html" ];
                        middlewares.unshift( modRewrite( rules ) );
                        return middlewares;
                    }
                }
            }
        },

        watch: {
            options: {
                nospawn: false,
                livereload: true
            },
            css: {
                files: [
                    "app/index.html",

                    "app/less/*.less",
                    "app/less/**/*.less",
                    "app/less/**/**/*.less",

                    "app/partials/*.html",
                    "app/partials/**/*.html",
                    "app/partials/**/**/*.html",

                    "modules/*.html",
                    "modules/**/*.html",
                    "modules/**/**/*.html"
                ],
                tasks: ["less:development"]
            },
            javascript: {
                files: [
                    "app/js/*.js",
                    "app/js/**/*.js",
                    "app/js/**/**/*.js",

                    "tests/unit/*.js",
                    "tests/unit/**/*.js",
                    "tests/unit/**/**/*.js"
                ],
                tasks: ["test:development"]
            }
        },

        less: {
            options: {
                paths: ["app/less/"],
                cleancss: false,
                banner: "/*! <%= pkg.name %> - v<%= pkg.version %> - " +
                    "<%= grunt.template.today(\"yyyy-mm-dd\") %> */\n"
            },
            development: {
                files: { "app/css/all.css": "app/less/main.less" },
                options: {
                    sourceMap: true,
                    sourceMapFilename: "app/css/all.css.map",
                    sourceMapURL: "all.css.map",
                    outputSourceFiles: true
                }
            },
            production: {
                files: { "<%= config.outputDir %>css/all.min.css": "app/less/main.less" },
                options: {
                    cleancss: true
                }
            }
        },

        jshint: {
            options: {
                jshintrc: ".jshintrc"
            },
            dist: {
                src: ["<%= config.applicationFiles %>"]
            }
        },

        jasmine: {
            options: {
                specs: ["tests/unit/**/*.js"],
                keepRunner: true,
            },
            development: {
                src: ["<%= ngconstant.options.dest %>", "<%= config.applicationFiles %>"],
                options: {
                    vendor: ["<%= config.vendorFiles %>"],
                    helpers:["app/components/angular-mocks/angular-mocks.js"],
                    template: require("grunt-template-jasmine-istanbul"),
                    templateOptions: {
                        coverage: "coverage/coverage.json",
                        report: [
                            {
                                type: "lcov",
                                options: {
                                    dir: "coverage"
                                }
                            },
                            {
                                type: "text-summary"
                            }
                        ]
                    }
                }
            },
            production: {
                src: ["<%= config.outputDir %>js/app.min.js", "app/components/angular-mocks/angular-mocks.js"]
            }
        },

        protractor: {
            options: {
                keepAlive: false,
                noColor: false
            },
            dist: {
                options: {
                    configFile: protractorConf
                }
            }
        },

        protractor_webdriver: {
            dist: {
                options: {
                    command: "webdriver-manager update && webdriver-manager start",
                }
            }
        },

        concat: {
            options: {
                sourceMap: true,
                separator: ";",
                banner: "/*! <%= pkg.name %> - v<%= pkg.version %> - " +
                    "<%= grunt.template.today(\"yyyy-mm-dd\") %> */\n"
            },
            production: {
                src: [
                    "<%= config.vendorFiles %>",
                    "<%= ngconstant.options.dest %>",
                    "<%= config.applicationFiles %>"
                ],
                dest: "<%= config.outputDir %>js/app.js"
            }
        },

        uglify: {
            options: {
                sourceMap: true,
                sourceMapIncludeSources: true,
                enclose: { window: "window" },
                banner: "/*! <%= pkg.name %> - v<%= pkg.version %> - " +
                    "<%= grunt.template.today(\"yyyy-mm-dd\") %> */\n"
            },
            production: {
                files: {
                    "<%= config.outputDir %>js/app.min.js": "<%= config.outputDir %>js/app.js"
                }
            }
        },

        copy: {
            images: {
                files: [{
                    expand: true,
                    cwd: "app/img",
                    src: ["**/*", "!test/**"],
                    dest: "<%= config.outputDir %>img/"
                }]
            },
            partials: {
                files: [{
                    expand: true,
                    cwd: "app/partials",
                    src: ["*.html"],
                    dest: "<%= config.outputDir %>partials/"
                }]
            },
            e2e: {
                files: [{
                    expand: true,
                    flatten: true,
                    src: [
                        "app/components/angular-mocks/angular-mocks.js",
                        "tests/e2e/app.js"
                    ],
                    dest: "<%= config.outputDir %>e2e/"
                }]
            }
        },

        clean: {
            beforeBuild: {
                src: ["<%= config.outputDir %>", "docs"]
            },
            e2e: {
                src: ["<%= config.outputDir %>"]
            }
        },

        processhtml: {
            options: {
                strip: true,
                data: {
                    url: "<%= config.env.BASE_URL %>"
                }
            },
            production: {
                files: {
                    "<%= config.outputDir %>index.html": ["app/index.html"]
                }
            },
            e2e: {
                files: {
                    "<%= config.outputDir %>index.html": ["app/index.html"]
                }
            }
        },

        yuidoc: {
            compile: {
                name: "<%= pkg.name %>",
                description: "<%= pkg.description %>",
                version: "<%= pkg.version %>",
                url: "<%= pkg.homepage %>",
                options: {
                    paths: "app/js/",
                    themedir: "node_modules/yuidoc-bootstrap-theme",
                    helpers: ["node_modules/yuidoc-bootstrap-theme/helpers/helpers.js"],
                    outdir: "docs/"
                }
            }
        },

        bump: {
            options: {
                files: ["package.json", "bower.json"],
                updateConfigs: ["pkg"],
                commit: true,
                commitFiles: ["-a"],
                createTag: true,
                push: true,
                pushTo: "origin master"
            }
        },

        ngconstant: {
            options: {
                name: "ENV",
                dest: "app/js/env/env.js",
                constants: "<%= config.env %>"
            },
            dist: {}
        },

    });

    grunt.loadNpmTasks("grunt-contrib-copy");
    grunt.loadNpmTasks("grunt-contrib-clean");
    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-contrib-less");
    grunt.loadNpmTasks("grunt-contrib-watch");
    grunt.loadNpmTasks("grunt-contrib-connect");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-yuidoc");
    grunt.loadNpmTasks("grunt-contrib-jasmine");
    grunt.loadNpmTasks("grunt-protractor-runner");
    grunt.loadNpmTasks("grunt-protractor-webdriver");
    grunt.loadNpmTasks("grunt-processhtml");
    grunt.loadNpmTasks('grunt-ng-constant');
    grunt.loadNpmTasks('grunt-bump');

    grunt.registerTask("build", [
        "clean:beforeBuild",
        "less:production",
        "ngconstant",
        "concat",
        "uglify",
        "copyBuild",
        "processhtml:production"
    ]);

    grunt.registerTask("release", [
        "bump-only",
        "build",
        "bump-commit"
    ]);

    grunt.registerTask("copyBuild", [
        "copy:images",
        "copy:partials"
    ]);

    grunt.registerTask("server", [
        "ngconstant",
        "less:development",
        "connect:server",
        "watch:css"
    ]);

    grunt.registerTask("serverjs", [
        "ngconstant",
        "less:development",
        "connect:server",
        "watch:javascript"
    ]);

    grunt.registerTask("serverall", [
        "ngconstant",
        "less:development",
        "connect:server",
        "watch"
    ]);

    grunt.registerTask("test", [
        "clean:beforeBuild",
        "ngconstant",
        "jshint",
        "concat",
        "uglify",
        "jasmine:production"
    ]);

    grunt.registerTask("test:development", [
        "ngconstant",
        "jshint",
        "jasmine:development"
    ]);

    grunt.registerTask("e2e", [
        "ngconstant",
        "less:production",
        "concat",
        "uglify",
        "copy",
        "processhtml:e2e",
        "connect:servertest",
        "protractor_webdriver",
        "protractor:dist",
        "clean:e2e"
    ]);

    grunt.registerTask("default", ["build"]);

};
<|endoftext|>


<commit_before>(function() {
    "use strict";
    module.exports = function(grunt) {
        grunt.initConfig({
            pkg: grunt.file.readJSON("package.json"),
            browserify: {
                options: {
                    browserifyOptions: {
                        standalone: "DN2A"
                    }
                },
                dist: {
                    files: {
                        "bundle/dn2a.browser.js": ["built/dn2a.js"]
                    }
                }
            }
        });
        grunt.loadNpmTasks("grunt-browserify");
        grunt.registerTask(
            "bundle",
            [
                "browserify"
            ]
        );
    };
}());
<commit_msg>Extended Grunt configuration to include build, bundle and test cases.<commit_after>(function() {
    "use strict";
    module.exports = function(grunt) {
        grunt.initConfig({
            pkg: grunt.file.readJSON("package.json"),
            babel: {
                options: {
                    sourceMap: false,
                    presets: ["es2015"]
                },
                dist: {
                    files: {
                        "built/networks/alpha.js": "library/networks/alpha.js",
                        "built/bios.js": "library/bios.js",
                        "built/brain.js": "library/brain.js",
                        "built/cerebrum.js": "library/cerebrum.js",
                        "built/dn2a.js": "library/dn2a.js",
                        "built/host.js": "library/host.js",
                        "built/link.js": "library/link.js",
                        "built/neuron.js": "library/neuron.js",
                        "built/node.js": "library/node.js",
                        "built/synapse.js": "library/synapse.js"
                    }
                }
            },
            browserify: {
                options: {
                    browserifyOptions: {
                        standalone: "DN2A"
                    }
                },
                dist: {
                    files: {
                        "bundled/dn2a.browser.js": ["built/dn2a.js"]
                    }
                }
            },
            clean: {
                builtFolder: {
                    src: ["built/**/*"]
                },
                bundledFolder: {
                    src: ["bundled/**/*"]
                }
            },
            karma: {
                options: {
                    configFile: "karma.conf.js"
                },
                unitMode: {
                    singleRun: true
                },
                continuousMode: {
                    singleRun: false,
                    autoWatch: false
                }
            }
        });
        grunt.loadNpmTasks("grunt-babel");
        grunt.loadNpmTasks("grunt-browserify");
        grunt.loadNpmTasks("grunt-contrib-clean");
        grunt.loadNpmTasks("grunt-karma");
        grunt.registerTask(
            "build",
            [
                "clean:builtFolder",
                "babel"
            ]
        );
        grunt.registerTask(
            "bundle",
            [
                "clean:builtFolder",
                "clean:bundledFolder",
                "babel",
                "browserify"
            ]
        );
        grunt.registerTask(
            "test",
            [
                "clean:builtFolder",
                "babel",
                "karma:unitMode"
            ]
        );
    };
}());
<|endoftext|>