<commit_before>'use strict';
module.exports = function(grunt) {

	// Load the plugin that provides the 'uglify' task.
	grunt.loadNpmTasks('grunt-usemin');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-nodemon');
	grunt.loadNpmTasks('grunt-concurrent');
	grunt.loadNpmTasks('grunt-filerev');
	grunt.loadNpmTasks('grunt-angular-templates');
	grunt.loadNpmTasks('grunt-ngmin');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-svgmin');
	grunt.loadNpmTasks('grunt-contrib-imagemin');
	grunt.loadNpmTasks('grunt-build-control');
	grunt.loadNpmTasks('grunt-bump');

	// Project configuration.
	var pkg = grunt.file.readJSON('package.json');
	grunt.initConfig({
		pkg: pkg,
		nodemon: {
			dist: {
				options: {
					file: 'dist/api/server.js',
					nodeArgs: ['--debug'],
					watchedExtensions: ['js'],
					watchedFolders: ['dist/api'],
					env: {
						PORT: 3000
					}
				}
			},
			dev: {
				options: {
					file: 'api/server.js',
					nodeArgs: ['--debug'],
					watchedExtensions: ['js'],
					watchedFolders: ['api'],
					env: {
						PORT: 4000
					}
				}
			}
		},
		watch: {
			distApi: {
				files: ['api/**/*.js'],
				tasks: ['distBuildApi']
			},
			distFrontend: {
				files: [
					'frontend/**/*.js',
					'frontend/**/*.less',
					'frontend/**/*.html',
					'!frontend/bower_components/**'
				],
				tasks: ['distBuildFrontend']
			},
			bootstrap: {
				files: ['frontend/less/bootstrap-variables.less'],
				tasks: ['buildBootstrap']
			},
			main: {
				files: [
					'frontend/less/main.less'
				],
				tasks: ['less:main']
			},
			components: {
				files: [
					'frontend/components/*.less'
				],
				tasks: ['less:components']
			},
			views: {
				files: [
					'frontend/views/*.less'
				],
				tasks: ['less:views']
			}
		},
		concurrent: {
			dist: {
				tasks: ['nodemon:dist', 'watch:distApi', 'watch:distFrontend'],
				options: {
					logConcurrentOutput: true
				}
			},
			dev: {
				tasks: ['nodemon:dev', 'watch:bootstrap', 'watch:main', 'watch:components', 'watch:views'],
				options: {
					logConcurrentOutput: true
				}
			}
		},
		clean: {
			distApi: 'dist/api',
			distFrontend: 'dist/frontend',
			stage: '.tmp',
			bootstrap: 'frontend/bower_components/bootstrap/less/variables.less'
		},
		useminPrepare: {
			html: '.tmp/stage/frontend/index.html',
			options: {
				dest: '.tmp/stage/frontend'
			}
		},
		copy: {
			// Bootstrap Less
			bootstrap: {
				files: [
					{
						expand: true,
						cwd: 'frontend/less/',
						src: 'bootstrap-variables.less',
						dest: 'frontend/bower_components/bootstrap/less/',
						rename: function(dest) {return dest + 'variables.less';}
					}
				]
			},
			// Stage
			stageApi: {
				files: [
					{
						expand: true,
						cwd: 'api/',
						// Match all files except alt-config files
						src: ['**'],
						dest: '.tmp/stage/api/'
					}
				]
			},
			stageFrontend: {
				files: [
					{
						expand: true,
						cwd: 'frontend/',
						// Match all files except alt-config files and img
						src: ['**', '!robots_**', '!js/config**', '!img'],
						dest: '.tmp/stage/frontend/'
					}
				]
			},
			// Robots copy
			prodRobotsFrontend: {
				files: [
					{
						// frontend
						expand: true,
						cwd: 'frontend/',
						src: ['robots_Prod.txt'],
						dest: '.tmp/stage/frontend/',
						rename: robotsRename
					}
				]
			},
			// Config copies
			prodConfigFrontend: {
				files: [
					{
						// frontend
						expand: true,
						cwd: 'frontend/js/',
						src: ['config_Prod.js'],
						dest: '.tmp/stage/frontend/js/',
						rename: configRename
					}
				]
			},
			distConfigFrontend: {
				files: [
					{
						// frontend
						expand: true,
						cwd: 'frontend/js/',
						src: ['config_Local_Dist.js'],
						dest: '.tmp/stage/frontend/js/',
						rename: configRename
					}
				]
			},
			// dist copy
			distApi: {
				files: [
					{
						expand: true,
						cwd: '.tmp/stage/api/',
						src: ['**'],
						dest: 'dist/api/'
					}
				]
			},
			distFrontend: {
				files: [
					{
						expand: true,
						cwd: '.tmp/stage/frontend/',
						src: [
							'js/app.*.js',
							'css/style.*.css',
							'img/**',
							'fonts/**',
							'print/**',
							'index.html',
							'*.*'
						],
						dest: 'dist/frontend/'
					}
				]
			},
			// app files, node app files
			app: {
				files: [
					{
						// frontend
						expand: true,
						cwd: './',
						src: ['package.json', 'Procfile'],
						dest: 'dist/'
					}
				]
			}
		},
		usemin: {
			html: [
				'.tmp/stage/frontend/index.html'
			]
		},
		uglify: {
			options: {
				mangle: true
			}
		},
		cssmin: {
			options: {
				keepSpecialComments: 0
			}
		},
		filerev: {
			options: {
				encoding: 'utf8',
				algorithm: 'md5',
				length: 8
			},
			css: {
				src: '.tmp/stage/frontend/css/style.css'
			},
			js: {
				src: [
					'.tmp/stage/frontend/js/app.js'
				]
			}
		},
		ngtemplates: {
			app: {
				cwd: '.tmp/stage/frontend',
				src: [
					'components/**.html',
					'views/**.html',
				],
				dest: '.tmp/stage/frontend/js/templates.js',
				options: {
					htmlmin: {
						collapseBooleanAttributes: true,
						collapseWhitespace: true,
						removeAttributeQuotes: true,
						removeComments: true, // Only if you don't use comment directives!
						removeEmptyAttributes: true,
						removeRedundantAttributes: true,
						removeScriptTypeAttributes: true,
						removeStyleLinkTypeAttributes: true
					}
				}
			}
		},
		ngmin: {
			app: {
				src: '.tmp/concat/js/app.js',
				dest: '.tmp/concat/js/app.js'
			}
		},
		less: {
			bootstrap: {
				options: {
					sourceMap: true,
					sourceMapFilename: 'frontend/css/bootstrap.css.map', // where file is generated and located
					sourceMapURL: '/css/bootstrap.css.map',
					sourceMapBasepath: 'frontend',
					sourceMapRootpath: '/'
				},
				files: {
					'frontend/css/bootstrap.css': 'frontend/bower_components/bootstrap/less/bootstrap.less'
				}
			},
			main: {
				options: {
					sourceMap: true,
					sourceMapFilename: 'frontend/css/main.css.map',
					sourceMapURL: '/css/main.css.map',
					sourceMapBasepath: 'frontend',
					sourceMapRootpath: '/'
				},
				files: {
					'frontend/css/main.css': 'frontend/less/main.less'
				}
			},
			components: {
				files: {
					'frontend/css/components.css': 'frontend/components/*.less'
				}
			},
			views: {
				files: {
					'frontend/css/views.css': 'frontend/views/*.less'
				}
			}
		},
		svgmin: {
			stage: {
				files: [
					{
						expand: true,
						cwd: 'frontend/img',
						src: ['*.svg'],
						dest: '.tmp/stage/frontend/img/',
						ext: '.svg'
					}
				]
			}
		},
		imagemin: {
			stage: {
				files: [
					{
						expand: true,
						cwd: 'frontend/img',
						src: ['**/*.{png,jpg,gif}'],
						dest: '.tmp/stage/frontend/img/'
					}
				]
			}
		},
		buildcontrol: {
			options: {
				dir: 'dist',
				commit: true,
				push: true,
				message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
			},
			prod: {
				options: {
					remote: 'git@heroku.com:ghcprod.git',
					branch: 'master',
					tag: pkg.version
				}
			},
			stage: {
				options: {
					remote: 'git@heroku.com:ghcstage.git',
					branch: 'master',
					tag: pkg.version
				}
			}
		}
	});

	grunt.registerTask('deploy:prod', [
		'clean:stage',
		'buildApi',
		'prodBuildFrontend',
		'copy:app',
		'buildcontrol:prod'
	]);

	grunt.registerTask('deploy:stage', [
		'clean:stage',
		'buildApi',
		'distBuildFrontend',
		'copy:app',
		'bump:build',
		'buildcontrol:stage'
	]);

	grunt.registerTask('dev', [
		'buildCss',
		'concurrent:dev'
	]);

	grunt.registerTask('dist', [
		'clean:stage',
		'buildApi',
		'distBuildFrontend',
		'concurrent:dist'
	]);

	// grunt.registerTask('build', [
	// 	'distBuildApi',
	// 	'distBuildFrontend'
	// ]);

	grunt.registerTask('buildCss', [
		'buildBootstrap',
		'less:main',
		'less:components',
		'less:views'
	]);

	grunt.registerTask('buildBootstrap', [
		'clean:bootstrap',
		'copy:bootstrap',
		'less:bootstrap'
	]);

	grunt.registerTask('prepareFrontend', [
		'buildCss',
		'copy:stageFrontend',
		'imagemin:stage',
		'svgmin:stage'
	]);

	grunt.registerTask('buildApi', [
		'copy:stageApi',
		'clean:distApi',
		'copy:distApi'
	]);

	grunt.registerTask('distBuildFrontend', [
		'prepareFrontend',
		'copy:distConfigFrontend',
		'ngtemplates',
		'useminPrepare',
		'concat',
		'ngmin',
		'uglify',
		'cssmin',
		'filerev',
		'usemin',
		'clean:distFrontend',
		'copy:distFrontend'
	]);

	grunt.registerTask('prodBuildFrontend', [
		'prepareFrontend',
		'copy:prodConfigFrontend',
		'copy:prodRobotsFrontend',
		'ngtemplates',
		'useminPrepare',
		'concat',
		'ngmin',
		'uglify',
		'cssmin',
		'filerev',
		'usemin',
		'clean:distFrontend',
		'copy:distFrontend'
	]);

	function configRename(dest) {
		return dest + 'config.js';
	}

	function robotsRename(dest) {
		return dest + 'robots.txt';
	}

};<commit_msg>moved up bump<commit_after>'use strict';
module.exports = function(grunt) {

	// Load the plugin that provides the 'uglify' task.
	grunt.loadNpmTasks('grunt-usemin');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-nodemon');
	grunt.loadNpmTasks('grunt-concurrent');
	grunt.loadNpmTasks('grunt-filerev');
	grunt.loadNpmTasks('grunt-angular-templates');
	grunt.loadNpmTasks('grunt-ngmin');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-svgmin');
	grunt.loadNpmTasks('grunt-contrib-imagemin');
	grunt.loadNpmTasks('grunt-build-control');
	grunt.loadNpmTasks('grunt-bump');

	// Project configuration.
	var pkg = grunt.file.readJSON('package.json');
	grunt.initConfig({
		pkg: pkg,
		nodemon: {
			dist: {
				options: {
					file: 'dist/api/server.js',
					nodeArgs: ['--debug'],
					watchedExtensions: ['js'],
					watchedFolders: ['dist/api'],
					env: {
						PORT: 3000
					}
				}
			},
			dev: {
				options: {
					file: 'api/server.js',
					nodeArgs: ['--debug'],
					watchedExtensions: ['js'],
					watchedFolders: ['api'],
					env: {
						PORT: 4000
					}
				}
			}
		},
		watch: {
			distApi: {
				files: ['api/**/*.js'],
				tasks: ['distBuildApi']
			},
			distFrontend: {
				files: [
					'frontend/**/*.js',
					'frontend/**/*.less',
					'frontend/**/*.html',
					'!frontend/bower_components/**'
				],
				tasks: ['distBuildFrontend']
			},
			bootstrap: {
				files: ['frontend/less/bootstrap-variables.less'],
				tasks: ['buildBootstrap']
			},
			main: {
				files: [
					'frontend/less/main.less'
				],
				tasks: ['less:main']
			},
			components: {
				files: [
					'frontend/components/*.less'
				],
				tasks: ['less:components']
			},
			views: {
				files: [
					'frontend/views/*.less'
				],
				tasks: ['less:views']
			}
		},
		concurrent: {
			dist: {
				tasks: ['nodemon:dist', 'watch:distApi', 'watch:distFrontend'],
				options: {
					logConcurrentOutput: true
				}
			},
			dev: {
				tasks: ['nodemon:dev', 'watch:bootstrap', 'watch:main', 'watch:components', 'watch:views'],
				options: {
					logConcurrentOutput: true
				}
			}
		},
		clean: {
			distApi: 'dist/api',
			distFrontend: 'dist/frontend',
			stage: '.tmp',
			bootstrap: 'frontend/bower_components/bootstrap/less/variables.less'
		},
		useminPrepare: {
			html: '.tmp/stage/frontend/index.html',
			options: {
				dest: '.tmp/stage/frontend'
			}
		},
		copy: {
			// Bootstrap Less
			bootstrap: {
				files: [
					{
						expand: true,
						cwd: 'frontend/less/',
						src: 'bootstrap-variables.less',
						dest: 'frontend/bower_components/bootstrap/less/',
						rename: function(dest) {return dest + 'variables.less';}
					}
				]
			},
			// Stage
			stageApi: {
				files: [
					{
						expand: true,
						cwd: 'api/',
						// Match all files except alt-config files
						src: ['**'],
						dest: '.tmp/stage/api/'
					}
				]
			},
			stageFrontend: {
				files: [
					{
						expand: true,
						cwd: 'frontend/',
						// Match all files except alt-config files and img
						src: ['**', '!robots_**', '!js/config**', '!img'],
						dest: '.tmp/stage/frontend/'
					}
				]
			},
			// Robots copy
			prodRobotsFrontend: {
				files: [
					{
						// frontend
						expand: true,
						cwd: 'frontend/',
						src: ['robots_Prod.txt'],
						dest: '.tmp/stage/frontend/',
						rename: robotsRename
					}
				]
			},
			// Config copies
			prodConfigFrontend: {
				files: [
					{
						// frontend
						expand: true,
						cwd: 'frontend/js/',
						src: ['config_Prod.js'],
						dest: '.tmp/stage/frontend/js/',
						rename: configRename
					}
				]
			},
			distConfigFrontend: {
				files: [
					{
						// frontend
						expand: true,
						cwd: 'frontend/js/',
						src: ['config_Local_Dist.js'],
						dest: '.tmp/stage/frontend/js/',
						rename: configRename
					}
				]
			},
			// dist copy
			distApi: {
				files: [
					{
						expand: true,
						cwd: '.tmp/stage/api/',
						src: ['**'],
						dest: 'dist/api/'
					}
				]
			},
			distFrontend: {
				files: [
					{
						expand: true,
						cwd: '.tmp/stage/frontend/',
						src: [
							'js/app.*.js',
							'css/style.*.css',
							'img/**',
							'fonts/**',
							'print/**',
							'index.html',
							'*.*'
						],
						dest: 'dist/frontend/'
					}
				]
			},
			// app files, node app files
			app: {
				files: [
					{
						// frontend
						expand: true,
						cwd: './',
						src: ['package.json', 'Procfile'],
						dest: 'dist/'
					}
				]
			}
		},
		usemin: {
			html: [
				'.tmp/stage/frontend/index.html'
			]
		},
		uglify: {
			options: {
				mangle: true
			}
		},
		cssmin: {
			options: {
				keepSpecialComments: 0
			}
		},
		filerev: {
			options: {
				encoding: 'utf8',
				algorithm: 'md5',
				length: 8
			},
			css: {
				src: '.tmp/stage/frontend/css/style.css'
			},
			js: {
				src: [
					'.tmp/stage/frontend/js/app.js'
				]
			}
		},
		ngtemplates: {
			app: {
				cwd: '.tmp/stage/frontend',
				src: [
					'components/**.html',
					'views/**.html',
				],
				dest: '.tmp/stage/frontend/js/templates.js',
				options: {
					htmlmin: {
						collapseBooleanAttributes: true,
						collapseWhitespace: true,
						removeAttributeQuotes: true,
						removeComments: true, // Only if you don't use comment directives!
						removeEmptyAttributes: true,
						removeRedundantAttributes: true,
						removeScriptTypeAttributes: true,
						removeStyleLinkTypeAttributes: true
					}
				}
			}
		},
		ngmin: {
			app: {
				src: '.tmp/concat/js/app.js',
				dest: '.tmp/concat/js/app.js'
			}
		},
		less: {
			bootstrap: {
				options: {
					sourceMap: true,
					sourceMapFilename: 'frontend/css/bootstrap.css.map', // where file is generated and located
					sourceMapURL: '/css/bootstrap.css.map',
					sourceMapBasepath: 'frontend',
					sourceMapRootpath: '/'
				},
				files: {
					'frontend/css/bootstrap.css': 'frontend/bower_components/bootstrap/less/bootstrap.less'
				}
			},
			main: {
				options: {
					sourceMap: true,
					sourceMapFilename: 'frontend/css/main.css.map',
					sourceMapURL: '/css/main.css.map',
					sourceMapBasepath: 'frontend',
					sourceMapRootpath: '/'
				},
				files: {
					'frontend/css/main.css': 'frontend/less/main.less'
				}
			},
			components: {
				files: {
					'frontend/css/components.css': 'frontend/components/*.less'
				}
			},
			views: {
				files: {
					'frontend/css/views.css': 'frontend/views/*.less'
				}
			}
		},
		svgmin: {
			stage: {
				files: [
					{
						expand: true,
						cwd: 'frontend/img',
						src: ['*.svg'],
						dest: '.tmp/stage/frontend/img/',
						ext: '.svg'
					}
				]
			}
		},
		imagemin: {
			stage: {
				files: [
					{
						expand: true,
						cwd: 'frontend/img',
						src: ['**/*.{png,jpg,gif}'],
						dest: '.tmp/stage/frontend/img/'
					}
				]
			}
		},
		buildcontrol: {
			options: {
				dir: 'dist',
				commit: true,
				push: true,
				message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
			},
			prod: {
				options: {
					remote: 'git@heroku.com:ghcprod.git',
					branch: 'master',
					tag: pkg.version
				}
			},
			stage: {
				options: {
					remote: 'git@heroku.com:ghcstage.git',
					branch: 'master',
					tag: pkg.version
				}
			}
		}
	});

	grunt.registerTask('deploy:prod', [
		'clean:stage',
		'buildApi',
		'prodBuildFrontend',
		'copy:app',
		'buildcontrol:prod'
	]);

	grunt.registerTask('deploy:stage', [
		'bump:build',
		'clean:stage',
		'buildApi',
		'distBuildFrontend',
		'copy:app',
		'buildcontrol:stage'
	]);

	grunt.registerTask('dev', [
		'buildCss',
		'concurrent:dev'
	]);

	grunt.registerTask('dist', [
		'clean:stage',
		'buildApi',
		'distBuildFrontend',
		'concurrent:dist'
	]);

	// grunt.registerTask('build', [
	// 	'distBuildApi',
	// 	'distBuildFrontend'
	// ]);

	grunt.registerTask('buildCss', [
		'buildBootstrap',
		'less:main',
		'less:components',
		'less:views'
	]);

	grunt.registerTask('buildBootstrap', [
		'clean:bootstrap',
		'copy:bootstrap',
		'less:bootstrap'
	]);

	grunt.registerTask('prepareFrontend', [
		'buildCss',
		'copy:stageFrontend',
		'imagemin:stage',
		'svgmin:stage'
	]);

	grunt.registerTask('buildApi', [
		'copy:stageApi',
		'clean:distApi',
		'copy:distApi'
	]);

	grunt.registerTask('distBuildFrontend', [
		'prepareFrontend',
		'copy:distConfigFrontend',
		'ngtemplates',
		'useminPrepare',
		'concat',
		'ngmin',
		'uglify',
		'cssmin',
		'filerev',
		'usemin',
		'clean:distFrontend',
		'copy:distFrontend'
	]);

	grunt.registerTask('prodBuildFrontend', [
		'prepareFrontend',
		'copy:prodConfigFrontend',
		'copy:prodRobotsFrontend',
		'ngtemplates',
		'useminPrepare',
		'concat',
		'ngmin',
		'uglify',
		'cssmin',
		'filerev',
		'usemin',
		'clean:distFrontend',
		'copy:distFrontend'
	]);

	function configRename(dest) {
		return dest + 'config.js';
	}

	function robotsRename(dest) {
		return dest + 'robots.txt';
	}

};<|endoftext|>


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

    grunt.initConfig( {
        pkg: grunt.file.readJSON( "package.json" ),
        watch: {
            scripts: {
                files: [
                    "app/js/*"
                ],
                tasks: [ "concat:scripts" ]
            }
        },
        uglify: {
            options: {
                mangle: true,
                compress: true,
                banner: "/*! <%= pkg.name %> <%= grunt.template.today( 'yyyy-mm-dd' ) %> */",
                sourceMap: true,
                sourceMapName: "app/build/project.js.map"
            },
            project: {
                files: {
                    "app/build/project.js": [
                        "app/js/*"
                    ]
                }
            }
        },
        concat: {
            scripts: {
                src: [
                    "app/js/*"
                ],
                dest: "app/build/project.js"
            },
            angular: {
                src: [
                    "app/bower_components/angular/angular.min.js",
                    "app/bower_components/angular-route/angular-route.min.js"
                ],
                dest: "app/build/angular.js"
            }
        },
        cssmin: {
            combine: {
                files: {
                    "app/build/style.css": [
                        "app/css/font-awesome.min.css",
                        "app/css/ui-kit.css",
                        "app/css/custom.css"
                    ]
                }
            }
        }
    } );

    grunt.loadNpmTasks( "grunt-contrib-watch" );
    grunt.loadNpmTasks( "grunt-contrib-uglify" );
    grunt.loadNpmTasks( "grunt-contrib-concat" );
    grunt.loadNpmTasks('grunt-contrib-cssmin');

    grunt.registerTask( "default", [
        "concat:scripts",
        "concat:angular",
        "cssmin:combine"
    ] );

    grunt.registerTask( "deploy",  [
        "uglify",
        "concat:angular"
    ] );

};
<commit_msg>Add css to grunt watch<commit_after>module.exports = function( grunt ) {

    grunt.initConfig( {
        pkg: grunt.file.readJSON( "package.json" ),
        watch: {
            scripts: {
                files: [
                    "app/js/*"
                ],
                tasks: [
                    "concat:scripts"
                ]
            },
            css: {
                files: [
                    "app/css/*"
                ],
                tasks: [
                    "cssmin:combine"
                ]
            }
        },
        uglify: {
            options: {
                mangle: true,
                compress: true,
                banner: "/*! <%= pkg.name %> <%= grunt.template.today( 'yyyy-mm-dd' ) %> */",
                sourceMap: true,
                sourceMapName: "app/build/project.js.map"
            },
            project: {
                files: {
                    "app/build/project.js": [
                        "app/js/*"
                    ]
                }
            }
        },
        concat: {
            scripts: {
                src: [
                    "app/js/*"
                ],
                dest: "app/build/project.js"
            },
            angular: {
                src: [
                    "app/bower_components/angular/angular.min.js",
                    "app/bower_components/angular-route/angular-route.min.js"
                ],
                dest: "app/build/angular.js"
            }
        },
        cssmin: {
            combine: {
                files: {
                    "app/build/style.css": [
                        "app/css/font-awesome.min.css",
                        "app/css/ui-kit.css",
                        "app/css/custom.css"
                    ]
                }
            }
        }
    } );

    grunt.loadNpmTasks( "grunt-contrib-watch" );
    grunt.loadNpmTasks( "grunt-contrib-uglify" );
    grunt.loadNpmTasks( "grunt-contrib-concat" );
    grunt.loadNpmTasks('grunt-contrib-cssmin');

    grunt.registerTask( "default", [
        "concat:scripts",
        "concat:angular",
        "cssmin:combine"
    ] );

    grunt.registerTask( "deploy",  [
        "uglify",
        "concat:angular"
    ] );

};
<|endoftext|>


<commit_before><commit_msg>changed css output names<commit_after><|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

  grunt.initConfig({
    mochaTest: {
      test: {
        options: { reporter: 'spec' },
        src: ['test/**/*.js']
      }
    },
    jshint: {
      all: ['*.js', 'lib/*.js', 'eg/*.js'],
      options:{
        jshintrc: true
      }
    }
  });

  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.registerTask('default', ['jshint', 'mochaTest']);

};
<commit_msg>JSHint passing.<commit_after>'use strict';

module.exports = function(grunt) {

  grunt.initConfig({
    mochaTest: {
      test: {
        options: { reporter: 'spec' },
        src: ['test/**/*.js']
      }
    },
    jshint: {
      all: ['*.js', 'lib/*.js'],
      options:{
        jshintrc: true
      }
    }
  });

  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.registerTask('default', ['jshint', 'mochaTest']);

};
<|endoftext|>


<commit_before>module.exports = function (grunt) {
    grunt.initConfig({
        sass: {
            dist: {
                options: {
                    includePaths: ['bower_components/foundation/scss']
                },
                files: {
                    'public/style.css': 'src/sass/style.scss'
                }
            }
        },

        concat: {
            dist: {
                files: {
                    'public/head.js': [
                        'bower_components/modernizr/modernizr.js',
                        'bower_components/yepnope/dist/yepnope-2.0.0.js'
                    ],
                    'public/body.js': [
                        'bower_components/jquery/dist/jquery.js',
                        'bower_components/foundation/js/foundation/foundation.topbar.js',
                        'src/js/body.js'
                    ]
                }
            }
        },

        copy: {
            dist: {
                files: [
                    {expand: true, cwd: 'src/font/', src: ['**'], dest: 'public/font/'},
                    {expand: true, cwd: 'src/img/', src: ['**'], dest: 'public/img/'},
                    {expand: true, cwd: 'src/static/', src: ['**'], dest: 'public/'},
                    {src: 'src/js/call-for-papers.js', dest: 'public/call-for-papers.js'},
                    {src: 'src/js/google-analytics.js', dest: 'public/google-analytics.js'}
                ]
            }
        },

        'imagemagick-resize': {
            people: {
                from: 'src/img/people/',
                to: 'public/img/people/',
                files: '*.jpg',
                props: {
                    width: 300,
                    quality: 0.6
                }
            },
            sponsors: {
                from: 'src/img/logo/',
                to: 'public/img/logo/',
                files: '*.png',
                props: {
                    width: 300
                }
            }
        },

        cssmin: {
            dist: {
                files: {
                    'public/style.css': ['public/style.css']
                }
            }
        },

        uglify: {
            dist: {
                files: {
                    'public/head.js': ['public/head.js'],
                    'public/body.js': ['public/body.js'],
                    'public/google-analytics.js': ['public/google-analytics.js']
                }
            }
        },

        watch: {
            sass: {
                files: '**/*.scss',
                tasks: ['sass']
            },
            concat: {
                files: 'src/js/**.*',
                tasks:['concat']
            }
        }
    });

    grunt.loadNpmTasks('grunt-sass');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-imagemagick');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-uglify');

    grunt.registerTask('default', ['sass', 'concat', 'copy']);
    grunt.registerTask('dist', ['sass:dist', 'concat:dist', 'copy:dist', 'cssmin:dist', 'uglify:dist', 'imagemagick-resize']);
};<commit_msg>Missing foundation.js.<commit_after>module.exports = function (grunt) {
    grunt.initConfig({
        sass: {
            dist: {
                options: {
                    includePaths: ['bower_components/foundation/scss']
                },
                files: {
                    'public/style.css': 'src/sass/style.scss'
                }
            }
        },

        concat: {
            dist: {
                files: {
                    'public/head.js': [
                        'bower_components/modernizr/modernizr.js',
                        'bower_components/yepnope/dist/yepnope-2.0.0.js'
                    ],
                    'public/body.js': [
                        'bower_components/jquery/dist/jquery.js',
                        'bower_components/foundation/js/foundation/foundation.js',
                        'bower_components/foundation/js/foundation/foundation.topbar.js',
                        'src/js/body.js'
                    ]
                }
            }
        },

        copy: {
            dist: {
                files: [
                    {expand: true, cwd: 'src/font/', src: ['**'], dest: 'public/font/'},
                    {expand: true, cwd: 'src/img/', src: ['**'], dest: 'public/img/'},
                    {expand: true, cwd: 'src/static/', src: ['**'], dest: 'public/'},
                    {src: 'src/js/call-for-papers.js', dest: 'public/call-for-papers.js'},
                    {src: 'src/js/google-analytics.js', dest: 'public/google-analytics.js'}
                ]
            }
        },

        'imagemagick-resize': {
            people: {
                from: 'src/img/people/',
                to: 'public/img/people/',
                files: '*.jpg',
                props: {
                    width: 300,
                    quality: 0.6
                }
            },
            sponsors: {
                from: 'src/img/logo/',
                to: 'public/img/logo/',
                files: '*.png',
                props: {
                    width: 300
                }
            }
        },

        cssmin: {
            dist: {
                files: {
                    'public/style.css': ['public/style.css']
                }
            }
        },

        uglify: {
            dist: {
                files: {
                    'public/head.js': ['public/head.js'],
                    'public/body.js': ['public/body.js'],
                    'public/google-analytics.js': ['public/google-analytics.js']
                }
            }
        },

        watch: {
            sass: {
                files: '**/*.scss',
                tasks: ['sass']
            },
            concat: {
                files: 'src/js/**.*',
                tasks:['concat']
            }
        }
    });

    grunt.loadNpmTasks('grunt-sass');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-imagemagick');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-uglify');

    grunt.registerTask('default', ['sass', 'concat', 'copy']);
    grunt.registerTask('dist', ['sass:dist', 'concat:dist', 'copy:dist', 'cssmin:dist', 'uglify:dist', 'imagemagick-resize']);
};<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {
  require('load-grunt-tasks')(grunt);
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-chmod');
  grunt.loadNpmTasks('grunt-run');

  grunt.initConfig({
    clean: {
      cache: ["tmp"],
      dist: ["dist"],
      dist_nodejs_linux: ["dist/nodejs-linux"],
      dist_nodejs_osx: ["dist/nodejs-osx"],
      dist_native_osx: ["dist/AnonymousNetworks-darwin-x64"],
      dist_native_linux: ["dist/AnonymousNetworks-linux-x64"]
    },

    electron: {
      osxBuild: {
        options: {
          name: 'AnonymousNetworks',
          dir: './tmp',
          out: 'dist/',
          version: '0.35.0',
          platform: 'darwin',
          arch: 'x64',
          overwrite: true,
          cache: './.electron-prebuilt'
        }
      },
      linuxBuild: {
        options: {
          name: 'AnonymousNetworks',
          dir: './tmp',
          out: 'dist/',
          version: '0.34.2',
          platform: 'linux',
          arch: 'x64',
          overwrite: true,
          cache: './.electron-prebuilt'
        }
      }
    },

    copy: {
      main: {
        files: [
          {
            expand: true,
            src: [
              "./*.js",
              "core/**",
              "bots/**",
              "keys/**",
              "./client/dist/**",
              "package.json",
              "network.json",
              "!./Gruntfile.js",
            ],
            dest: 'tmp/'
          }
        ],
      },
      nodejs_linux: {
        files: [
          {
            expand: true,
            cwd: 'tmp/',
            src: ["**/*", "**/.*/*"],
            dest: 'dist/nodejs-linux'
          }
        ]
      },
      nodejs_osx: {
        files: [
          {
            expand: true,
            cwd: 'tmp/',
            src: ["**/*", "**/.*/*"],
            dest: 'dist/nodejs-osx'
          }
        ]
      },
    },

    chmod: {
      bins: {
        options: {
          mode: '755'
        },
        src: [
          'tmp/node_modules/**',
          'dist/nodejs-osx/node_modules/ipfsd-ctl/node_modules/subcomandante/subcom',
          'dist/nodejs-linux/node_modules/ipfsd-ctl/node_modules/subcomandante/subcom',
          'dist/nodejs-osx/node_modules/ipfsd-ctl/node_modules/.bin/ipfs',
          'dist/nodejs-linux/node_modules/ipfsd-ctl/node_modules/.bin/ipfs',
          'dist/AnonymousNetworks-darwin-x64/AnonymousNetworks.app/Contents/Resources/app/node_modules/ipfsd-ctl/node_modules/subcomandante/subcom',
          'dist/AnonymousNetworks-darwin-x64/AnonymousNetworks.app/Contents/Resources/app/node_modules/ipfsd-ctl/node_modules/.bin/ipfs',
          'dist/AnonymousNetworks-linux-x64/AnonymousNetworks.app/Contents/Resources/app/node_modules/ipfsd-ctl/node_modules/subcomandante/subcom',
          'dist/AnonymousNetworks-linux-x64/AnonymousNetworks.app/Contents/Resources/app/node_modules/ipfsd-ctl/node_modules/.bin/ipfs'
        ]
      }
    },

    run: {
      npm_install: {
        options: {
          cwd: "./tmp"
        },
        cmd: 'npm',
        args: [
          'install',
          '--cache-min 9999999',
          '--production'
        ]
      },
    }

  });

  grunt.registerTask('default', ["build"]);
  grunt.registerTask('build_osx', ["build_nodejs_linux", "build_nodejs_osx", "build_native_osx"]);
  grunt.registerTask('build_linux', ["build_nodejs_linux", "build_native_linux"]);
  grunt.registerTask('build_nodejs', ["build_nodejs_linux", 'build_nodejs_osx']);

  grunt.registerTask('build', function() {
    grunt.task.run('clean:dist_nodejs_osx');
    grunt.task.run('clean:dist_nodejs_linux');
    grunt.task.run('clean:dist_native_osx');
    grunt.task.run('clean:dist_native_linux');

    grunt.task.run('copy_files');
    grunt.task.run('copy:nodejs_osx');
    grunt.task.run('copy:nodejs_linux');

    grunt.task.run('run:npm_install');
    grunt.task.run('electron:osxBuild');
    grunt.task.run('chmod:bins');
  });

  grunt.registerTask('build_nodejs_osx', function() {
    grunt.task.run('clean:dist_nodejs_osx');
    grunt.task.run('copy_files');
    grunt.task.run('copy:nodejs_osx');
    grunt.task.run('chmod:bins');
  });

  grunt.registerTask('build_nodejs_linux', function() {
    grunt.task.run('clean:dist_nodejs_linux');
    grunt.task.run('copy_files');
    grunt.task.run('copy:nodejs_linux');
    grunt.task.run('chmod:bins');
  });

  grunt.registerTask('build_native_osx', function() {
    grunt.task.run('clean:dist_native_osx');
    grunt.task.run('copy_files');
    grunt.task.run('run:npm_install');
    grunt.task.run('electron:osxBuild');
    grunt.task.run('chmod:bins');
  });

  grunt.registerTask('build_native_linux', function() {
    grunt.task.run('clean:dist_native_linux');
    grunt.task.run('copy_files');
    grunt.task.run('run:npm_install');
    grunt.task.run('electron:linuxBuild');
    grunt.task.run('chmod:bins');
  });

  grunt.registerTask('copy_files', function() {
    grunt.task.run('clean:cache');
    grunt.task.run('copy:main');
  });

};
<commit_msg>Use Electron 0.34.1 instead of 0.35.0<commit_after>'use strict';

module.exports = function (grunt) {
  require('load-grunt-tasks')(grunt);
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-chmod');
  grunt.loadNpmTasks('grunt-run');

  grunt.initConfig({
    clean: {
      cache: ["tmp"],
      dist: ["dist"],
      dist_nodejs_linux: ["dist/nodejs-linux"],
      dist_nodejs_osx: ["dist/nodejs-osx"],
      dist_native_osx: ["dist/AnonymousNetworks-darwin-x64"],
      dist_native_linux: ["dist/AnonymousNetworks-linux-x64"]
    },

    electron: {
      osxBuild: {
        options: {
          name: 'AnonymousNetworks',
          dir: './tmp',
          out: 'dist/',
          version: '0.34.1',
          platform: 'darwin',
          arch: 'x64',
          overwrite: true,
          cache: './.electron-prebuilt'
        }
      },
      linuxBuild: {
        options: {
          name: 'AnonymousNetworks',
          dir: './tmp',
          out: 'dist/',
          version: '0.34.2',
          platform: 'linux',
          arch: 'x64',
          overwrite: true,
          cache: './.electron-prebuilt'
        }
      }
    },

    copy: {
      main: {
        files: [
          {
            expand: true,
            src: [
              "./*.js",
              "core/**",
              "bots/**",
              "keys/**",
              "./client/dist/**",
              "package.json",
              "network.json",
              "!./Gruntfile.js",
            ],
            dest: 'tmp/'
          }
        ],
      },
      nodejs_linux: {
        files: [
          {
            expand: true,
            cwd: 'tmp/',
            src: ["**/*", "**/.*/*"],
            dest: 'dist/nodejs-linux'
          }
        ]
      },
      nodejs_osx: {
        files: [
          {
            expand: true,
            cwd: 'tmp/',
            src: ["**/*", "**/.*/*"],
            dest: 'dist/nodejs-osx'
          }
        ]
      },
    },

    chmod: {
      bins: {
        options: {
          mode: '755'
        },
        src: [
          'tmp/node_modules/**',
          'dist/nodejs-osx/node_modules/ipfsd-ctl/node_modules/subcomandante/subcom',
          'dist/nodejs-linux/node_modules/ipfsd-ctl/node_modules/subcomandante/subcom',
          'dist/nodejs-osx/node_modules/ipfsd-ctl/node_modules/.bin/ipfs',
          'dist/nodejs-linux/node_modules/ipfsd-ctl/node_modules/.bin/ipfs',
          'dist/AnonymousNetworks-darwin-x64/AnonymousNetworks.app/Contents/Resources/app/node_modules/ipfsd-ctl/node_modules/subcomandante/subcom',
          'dist/AnonymousNetworks-darwin-x64/AnonymousNetworks.app/Contents/Resources/app/node_modules/ipfsd-ctl/node_modules/.bin/ipfs',
          'dist/AnonymousNetworks-linux-x64/AnonymousNetworks.app/Contents/Resources/app/node_modules/ipfsd-ctl/node_modules/subcomandante/subcom',
          'dist/AnonymousNetworks-linux-x64/AnonymousNetworks.app/Contents/Resources/app/node_modules/ipfsd-ctl/node_modules/.bin/ipfs'
        ]
      }
    },

    run: {
      npm_install: {
        options: {
          cwd: "./tmp"
        },
        cmd: 'npm',
        args: [
          'install',
          '--cache-min 9999999',
          '--production'
        ]
      },
    }

  });

  grunt.registerTask('default', ["build"]);
  grunt.registerTask('build_osx', ["build_nodejs_linux", "build_nodejs_osx", "build_native_osx"]);
  grunt.registerTask('build_linux', ["build_nodejs_linux", "build_native_linux"]);
  grunt.registerTask('build_nodejs', ["build_nodejs_linux", 'build_nodejs_osx']);

  grunt.registerTask('build', function() {
    grunt.task.run('clean:dist_nodejs_osx');
    grunt.task.run('clean:dist_nodejs_linux');
    grunt.task.run('clean:dist_native_osx');
    grunt.task.run('clean:dist_native_linux');

    grunt.task.run('copy_files');
    grunt.task.run('copy:nodejs_osx');
    grunt.task.run('copy:nodejs_linux');

    grunt.task.run('run:npm_install');
    grunt.task.run('electron:osxBuild');
    grunt.task.run('chmod:bins');
  });

  grunt.registerTask('build_nodejs_osx', function() {
    grunt.task.run('clean:dist_nodejs_osx');
    grunt.task.run('copy_files');
    grunt.task.run('copy:nodejs_osx');
    grunt.task.run('chmod:bins');
  });

  grunt.registerTask('build_nodejs_linux', function() {
    grunt.task.run('clean:dist_nodejs_linux');
    grunt.task.run('copy_files');
    grunt.task.run('copy:nodejs_linux');
    grunt.task.run('chmod:bins');
  });

  grunt.registerTask('build_native_osx', function() {
    grunt.task.run('clean:dist_native_osx');
    grunt.task.run('copy_files');
    grunt.task.run('run:npm_install');
    grunt.task.run('electron:osxBuild');
    grunt.task.run('chmod:bins');
  });

  grunt.registerTask('build_native_linux', function() {
    grunt.task.run('clean:dist_native_linux');
    grunt.task.run('copy_files');
    grunt.task.run('run:npm_install');
    grunt.task.run('electron:linuxBuild');
    grunt.task.run('chmod:bins');
  });

  grunt.registerTask('copy_files', function() {
    grunt.task.run('clean:cache');
    grunt.task.run('copy:main');
  });

};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Check for a new version
  var bump = grunt.option('bump') || '';
  var currentversion = require('./package.json').version;
  if (bump !== '') {
    var semversion = require('semver');
    currentversion = semversion.inc(currentversion, bump);
  }

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'src',
    dist: 'dist',
    version: currentversion,
    module: require('./package.json').name,
    domain: 'tink.formatdate'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      sass: {
        // files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['sass:server', 'autoprefixer']
      },
      html: {
        files: ['<%= yeoman.app %>/templates/{,*/}*.{htm,html}'],
        tasks: ['ngtemplates']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/index.html',
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/**/*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },
    ngtemplates:  {
      app:        {
        options: {
          module: '<%= yeoman.domain %>',
          standalone:false,
          htmlmin: {
            collapseBooleanAttributes: true,
            collapseWhitespace: true,
            removeAttributeQuotes: true,
            removeComments: true, // Only if you don't use comment directives!
            removeEmptyAttributes: true,
            removeRedundantAttributes: true,
            removeScriptTypeAttributes: true,
            removeStyleLinkTypeAttributes: true,
            conservativeCollapse: true,
            preserveLineBreaks: true
          }
        },
        cwd: 'src',
        src: 'templates/**.html',
        dest: '<%= yeoman.dist %>/scripts/templates.js'
      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json'],
        updateConfigs: [],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['-a'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'v%VERSION%',
        push: true,
        pushTo: 'origin',
        gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
        globalReplace: false,
        prereleaseName: false,
        regExp: false
      }
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
     test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: '0.0.0.0',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: {
        files: [{
          src: [
            '.tmp',
            '<%= yeoman.dist %>/scripts'
          ]
        }]
      }
    },
    autoprefixer: {
      options: {
        browsers: ['last 3 versions']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles',
          src: '{,*/}*.css',
          dest: '.tmp/styles'
        }]
      }
    },
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath: /\.\.\//
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },
    sass: {
      options: {
        imagePath:'../images',
        includePaths: [
            'bower_components'
        ]
      },
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/styles',
          src: ['*.scss'],
          dest: '.tmp/styles',
          ext: '.css'
        }]
      },
      server: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/styles',
          src: ['*.scss'],
          dest: '.tmp/styles',
          ext: '.css'
        }]
      }
    },
    copy: {
      dist: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '<%= yeoman.app %>/scripts/',
            dest: '<%= yeoman.dist %>/scripts/',
            src: [
              '{,*/}*'
            ]
          }
        ]
      },
      styles: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '.tmp/styles/',
            dest: '<%= yeoman.dist %>/',
            src: [
              '{,*/}*'
            ]
          }
        ]
      }
    },
    concat: {
      options: {
        separator: ';'
      },
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js'
        ],
        dest: '<%= yeoman.dist %>/<%= yeoman.module %>.js'
      }
    },
    uglify: {
      options: {
        mangle: false,
        banner: '/*! <%= yeoman.module %> v<%= yeoman.version %> */',
        sourceMap: true,
        screwIE8: true
      },
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= yeoman.module %>.min.js': ['<%= yeoman.dist %>/<%= yeoman.module %>.js'],
        }
      }
    },
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['.tmp/styles/{,*/}*.css'],
      options: {
        dirs: ['<%= yeoman.dist %>/images'],
        basedir: ['<%= yeoman.dist %>/images'],
        assetsDirs: ['<%= yeoman.dist %>', '<%= yeoman.dist %>/images']
      }
    },
    concurrent: {
      server: [
        'sass:server',
        'copy:styles'
      ],
      test: [
        'copy:styles'
      ],
      dist: [
        'sass',
        'svgmin'
      ]
    },
    svgmin: {
      options: {
        plugins: {
          removeViewBox: false
        }
      }
    },
    cssmin: {
      options: {
        banner: '/*! <%= yeoman.module %> v<%= yeoman.version %> */',
        sourceMap: true
      },
      target: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.css', '!*.min.css'],
          dest: '<%= yeoman.dist %>',
          ext: '.min.css'
        }]
      }
    },
    replace: {
      dist: {
        options: {
          patterns: [
            {
              match: /v(\d+)\.(\d+)\.(.+)/g,
              replacement: 'v<%= yeoman.version %>'
            }
          ]
        },
        files: [
          {expand: true, flatten: true, src: ['README.md'], dest: ''}
        ]
      }
    },
    cssUrlEmbed: {
      encodeWithBaseDir: {
        expand: true,
        cwd: '.tmp/styles',
        src: [ '{,*/}*.css' ],
        dest: '.tmp/styles',
        options: {
          baseDir: './src/styles'
        }
      }
    },
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: false
      }
    }
  });

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean',
    'ngtemplates',
    'replace',
    'copy:dist',
    'concat',
    'uglify:dist',
    'concurrent:dist',
    'autoprefixer',
    // 'cssUrlEmbed',
    'usemin',
    'copy:styles',
    'cssmin',
    'clean:server'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>test before build<commit_after>'use strict';

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Check for a new version
  var bump = grunt.option('bump') || '';
  var currentversion = require('./package.json').version;
  if (bump !== '') {
    var semversion = require('semver');
    currentversion = semversion.inc(currentversion, bump);
  }

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'src',
    dist: 'dist',
    version: currentversion,
    module: require('./package.json').name,
    domain: 'tink.formatdate'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      sass: {
        // files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['sass:server', 'autoprefixer']
      },
      html: {
        files: ['<%= yeoman.app %>/templates/{,*/}*.{htm,html}'],
        tasks: ['ngtemplates']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/index.html',
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/**/*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },
    ngtemplates:  {
      app:        {
        options: {
          module: '<%= yeoman.domain %>',
          standalone:false,
          htmlmin: {
            collapseBooleanAttributes: true,
            collapseWhitespace: true,
            removeAttributeQuotes: true,
            removeComments: true, // Only if you don't use comment directives!
            removeEmptyAttributes: true,
            removeRedundantAttributes: true,
            removeScriptTypeAttributes: true,
            removeStyleLinkTypeAttributes: true,
            conservativeCollapse: true,
            preserveLineBreaks: true
          }
        },
        cwd: 'src',
        src: 'templates/**.html',
        dest: '<%= yeoman.dist %>/scripts/templates.js'
      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json'],
        updateConfigs: [],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['-a'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'v%VERSION%',
        push: true,
        pushTo: 'origin',
        gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
        globalReplace: false,
        prereleaseName: false,
        regExp: false
      }
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
     test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: '0.0.0.0',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: {
        files: [{
          src: [
            '.tmp',
            '<%= yeoman.dist %>/scripts'
          ]
        }]
      }
    },
    autoprefixer: {
      options: {
        browsers: ['last 3 versions']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles',
          src: '{,*/}*.css',
          dest: '.tmp/styles'
        }]
      }
    },
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath: /\.\.\//
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },
    sass: {
      options: {
        imagePath:'../images',
        includePaths: [
            'bower_components'
        ]
      },
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/styles',
          src: ['*.scss'],
          dest: '.tmp/styles',
          ext: '.css'
        }]
      },
      server: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/styles',
          src: ['*.scss'],
          dest: '.tmp/styles',
          ext: '.css'
        }]
      }
    },
    copy: {
      dist: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '<%= yeoman.app %>/scripts/',
            dest: '<%= yeoman.dist %>/scripts/',
            src: [
              '{,*/}*'
            ]
          }
        ]
      },
      styles: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '.tmp/styles/',
            dest: '<%= yeoman.dist %>/',
            src: [
              '{,*/}*'
            ]
          }
        ]
      }
    },
    concat: {
      options: {
        separator: ';'
      },
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js'
        ],
        dest: '<%= yeoman.dist %>/<%= yeoman.module %>.js'
      }
    },
    uglify: {
      options: {
        mangle: false,
        banner: '/*! <%= yeoman.module %> v<%= yeoman.version %> */',
        sourceMap: true,
        screwIE8: true
      },
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= yeoman.module %>.min.js': ['<%= yeoman.dist %>/<%= yeoman.module %>.js'],
        }
      }
    },
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['.tmp/styles/{,*/}*.css'],
      options: {
        dirs: ['<%= yeoman.dist %>/images'],
        basedir: ['<%= yeoman.dist %>/images'],
        assetsDirs: ['<%= yeoman.dist %>', '<%= yeoman.dist %>/images']
      }
    },
    concurrent: {
      server: [
        'sass:server',
        'copy:styles'
      ],
      test: [
        'copy:styles'
      ],
      dist: [
        'sass',
        'svgmin'
      ]
    },
    svgmin: {
      options: {
        plugins: {
          removeViewBox: false
        }
      }
    },
    cssmin: {
      options: {
        banner: '/*! <%= yeoman.module %> v<%= yeoman.version %> */',
        sourceMap: true
      },
      target: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.css', '!*.min.css'],
          dest: '<%= yeoman.dist %>',
          ext: '.min.css'
        }]
      }
    },
    replace: {
      dist: {
        options: {
          patterns: [
            {
              match: /v(\d+)\.(\d+)\.(.+)/g,
              replacement: 'v<%= yeoman.version %>'
            }
          ]
        },
        files: [
          {expand: true, flatten: true, src: ['README.md'], dest: ''}
        ]
      }
    },
    cssUrlEmbed: {
      encodeWithBaseDir: {
        expand: true,
        cwd: '.tmp/styles',
        src: [ '{,*/}*.css' ],
        dest: '.tmp/styles',
        options: {
          baseDir: './src/styles'
        }
      }
    },
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: false
      },
      build: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    }
  });

  grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma:unit'
  ]);

  grunt.registerTask('build', [
    'karma:build',
    'clean',
    'ngtemplates',
    'replace',
    'copy:dist',
    'concat',
    'uglify:dist',
    'concurrent:dist',
    'autoprefixer',
    // 'cssUrlEmbed',
    'usemin',
    'copy:styles',
    'cssmin',
    'clean:server'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<|endoftext|>


<commit_before>const UglifyJsPlugin = require('uglifyjs-webpack-plugin');

module.exports = function (grunt) {
    'use strict';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        haml: {
            dist: {
                files: {
                    'dist/start.html': 'haml/start.haml'
                }
            },
        },
        sass: {
            options: {
                sourceMap: true,
                style: 'compressed'
            },
            dist: {
                files: {
                    'dist/css/style.css': 'scss/style.scss',
                    'dist/css/reset.css': 'scss/reset.scss'
                }
            }
        },
        webpack: {
            all: {
                entry: './js/app.js',
                devtool: 'source-map',
                output: {
                    filename: 'metro-start.js',
                    path: `${__dirname}/dist`,
                },
                stats: {
                    colors: true,
                    modules: true,
                    reasons: true
                },
                resolve: {
                    alias: {
                        jss: '../../node_modules/jss/jss.js'
                    }
                },
                plugins: [
                    new UglifyJsPlugin({
                        'cache': true,
                        'parallel': true,
                        'sourceMap': true
                    })]
            }
        },
        copy: {
            dist: {
                files: [
                    {
                        expand: true,
                        src: ['fonts/*', 'icons/*', 'manifest.json'],
                        dest: 'dist/'
                    },
                    {
                        expand: true,
                        flatten: true,
                        src: ['node_modules/spectrum-colorpicker/spectrum.css'],
                        dest: 'dist/css'
                    },
                ],
            },
        },
        compress: {
            all: {
                options: {
                    archive: './metro-start.zip',
                    mode: 'zip'
                },
                files: [
                    { cwd: 'dist/', src: '**', expand: true }
                ]
            }
        },
        eslint: {
            target: ['js/**/*.js']
        },
        watch: {
            scripts: {
                files: [
					'js/**/*.js',
					'css/*.css',
					'fonts/*.ttf',
                    'haml/start.haml',
                ],
                tasks: ['test', 'notify:build'],
                options: {
                    spawn: false,
                },
            },
        },
        notify: {
            build: {
              options: {
                message: 'Build complete',
              }
            }
        }
    });

    grunt.loadNpmTasks('grunt-notify');
    grunt.loadNpmTasks('grunt-sass');
    grunt.loadNpmTasks('grunt-webpack');
    grunt.loadNpmTasks('grunt-haml2html');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('gruntify-eslint');

    grunt.registerTask('build', ['webpack', 'haml', 'sass', 'copy']);
    grunt.registerTask('test', ['build', 'eslint']);

    grunt.registerTask('publish', ['test', 'compress']);
    grunt.registerTask('default', ['test']);
};
<commit_msg>Redo compression a bit.<commit_after>const UglifyJsPlugin = require('uglifyjs-webpack-plugin');

module.exports = function (grunt) {
    'use strict';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        haml: {
            dist: {
                files: {
                    'dist/start.html': 'haml/start.haml'
                }
            },
        },
        sass: {
            options: {
                sourceMap: true,
                style: 'compressed'
            },
            dist: {
                files: {
                    'dist/css/style.css': 'scss/style.scss',
                    'dist/css/reset.css': 'scss/reset.scss'
                }
            }
        },
        webpack: {
            all: {
                entry: './js/app.js',
                devtool: 'source-map',
                output: {
                    filename: 'metro-start.js',
                    path: `${__dirname}/dist`,
                },
                stats: {
                    colors: true,
                    modules: true,
                    reasons: true
                },
                resolve: {
                    alias: {
                        jss: '../../node_modules/jss/jss.js'
                    }
                },
                plugins: [
                    new UglifyJsPlugin({
                        'cache': true,
                        'parallel': true,
                        'sourceMap': true
                    })]
            }
        },
        copy: {
            dist: {
                files: [
                    {
                        expand: true,
                        src: ['fonts/*', 'icons/*', 'manifest.json'],
                        dest: 'dist/'
                    },
                    {
                        expand: true,
                        flatten: true,
                        src: ['node_modules/spectrum-colorpicker/spectrum.css'],
                        dest: 'dist/css'
                    },
                ],
            },
        },
        compress: {
            all: {
                options: {
                    archive: './metro-start.zip',
                    mode: 'zip'
                },
                files: [
                    { expand: true, cwd: 'dist/', src: '**/*', dest: '/' }
                ]
            }
        },
        eslint: {
            target: ['js/**/*.js']
        },
        watch: {
            scripts: {
                files: [
					'js/**/*.js',
					'css/*.css',
					'fonts/*.ttf',
                    'haml/start.haml',
                ],
                tasks: ['test', 'notify:build'],
                options: {
                    spawn: false,
                },
            },
        },
        notify: {
            build: {
              options: {
                message: 'Build complete',
              }
            }
        }
    });

    grunt.loadNpmTasks('grunt-notify');
    grunt.loadNpmTasks('grunt-sass');
    grunt.loadNpmTasks('grunt-webpack');
    grunt.loadNpmTasks('grunt-haml2html');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('gruntify-eslint');

    grunt.registerTask('build', ['webpack', 'haml', 'sass', 'copy']);
    grunt.registerTask('test', ['build', 'eslint']);

    grunt.registerTask('publish', ['test', 'compress']);
    grunt.registerTask('default', ['test']);
};
<|endoftext|>


<commit_before>'use strict';

/*globals process:false,module:false*/
module.exports = function(grunt) {
    grunt.initConfig({
        jshint: {
            all: ['lib/**/*.js', 'test/*.js']
        },
        connect: {
            server: {
                options: {
                    port: 9000
                }
            }
        },
        shell: {
            runLocalTests: {
                command: './testem -l Firefox,PhantomJS'
            }
        },
        'saucelabs-mocha': {
            all: {
                options: {
                    urls: ['localhost:9000/test/index.html'],
                    build: process.env.TRAVIS_BUILD_NUMBER,
                    testname: 'Sauce Unit Test for Selleckt',
                    browsers: [
                        {browserName: 'firefox'},
                        {browserName: 'chrome'},
                        ['OS X 10.10', 'safari', 8],
                        // ['Windows 7', 'internet explorer', 8],
                        ['Windows 7', 'internet explorer', 9],
                        ['Windows 7', 'internet explorer', 10],
                        ['Windows 7', 'internet explorer', 11]
                    ],
                    sauceConfig: {
                        'public': 'public' //make the logs publicly visible so README badges work
                    },
                    tags: [
                        process.env.TRAVIS_PULL_REQUEST || 'no pr',
                        process.env.TRAVIS_BRANCH || 'no branch'
                    ]
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-saucelabs');

    var isPr = (parseInt(process.env.TRAVIS_PULL_REQUEST, 10) > 0);

    if(isPr){
        grunt.registerTask('test', ['jshint', 'shell:runLocalTests']);
    } else {
        grunt.registerTask('test', ['jshint', 'shell:runLocalTests', 'connect', 'saucelabs-mocha']);
    }
};
<commit_msg>Added IE8 to the Saucelabs tests<commit_after>'use strict';

/*globals process:false,module:false*/
module.exports = function(grunt) {
    grunt.initConfig({
        jshint: {
            all: ['lib/**/*.js', 'test/*.js']
        },
        connect: {
            server: {
                options: {
                    port: 9000
                }
            }
        },
        shell: {
            runLocalTests: {
                command: './testem -l Firefox,PhantomJS'
            }
        },
        'saucelabs-mocha': {
            all: {
                options: {
                    urls: ['localhost:9000/test/index.html'],
                    build: process.env.TRAVIS_BUILD_NUMBER,
                    testname: 'Sauce Unit Test for Selleckt',
                    browsers: [
                        {browserName: 'firefox'},
                        {browserName: 'chrome'},
                        ['OS X 10.10', 'safari', 8],
                        ['Windows 7', 'internet explorer', 8],
                        ['Windows 7', 'internet explorer', 9],
                        ['Windows 7', 'internet explorer', 10],
                        ['Windows 7', 'internet explorer', 11]
                    ],
                    sauceConfig: {
                        'public': 'public' //make the logs publicly visible so README badges work
                    },
                    tags: [
                        process.env.TRAVIS_PULL_REQUEST || 'no pr',
                        process.env.TRAVIS_BRANCH || 'no branch'
                    ]
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-saucelabs');

    var isPr = (parseInt(process.env.TRAVIS_PULL_REQUEST, 10) > 0);

    if(isPr){
        grunt.registerTask('test', ['jshint', 'shell:runLocalTests']);
    } else {
        grunt.registerTask('test', ['jshint', 'shell:runLocalTests', 'connect', 'saucelabs-mocha']);
    }
};
<|endoftext|>


<commit_before>var extend = require('xtend');

var getRequirejsConfig = function () {
  var requirejsConfig;
  global.define = function (config) {
    requirejsConfig = config({ isBuild: true });
  };
  require('./app/config');

  return extend(requirejsConfig, {
    baseUrl: 'app',
    name: 'client',
    waitSeconds: 60,
    include: ['vendor/almond'],
    deps: [
      'client',
      'client/client_bootstrap'
    ],
    wrap: true,
    optimize: 'uglify'
  });
};

var requirejsConfig = getRequirejsConfig();

module.exports = function (grunt) {
  'use strict';

  grunt.initConfig({
    // Removes the contents of the public directory
    clean: ['public/'],
    // Builds Sass in development and production
    sass: {
      development: {
        files: {
          'public/stylesheets/spotlight.css': 'styles/index.scss'
        },
        options: {
          includePaths: [
            'node_modules/govuk_frontend_toolkit/govuk_frontend_toolkit/stylesheets'
          ],
          style: 'nested'
        }
      },
      production: {
        files: [
          { 'public/stylesheets/spotlight.css': 'styles/index.scss' },
          {
            expand: true,
            cwd: 'node_modules/govuk_template_mustache/assets/stylesheets',
            src: ['*.css'],
            dest: 'public/stylesheets',
            ext: '.css'
          }
        ],
        options: {
          includePaths: [
            'node_modules/govuk_frontend_toolkit/govuk_frontend_toolkit/stylesheets'
          ],
          outputStyle: 'compressed'
        }
      }
    },
    // Sets up Jasmine tests
    jasmine: {
      spotlight: {
        src: ['app/**/*.js'],
        options: {
          helpers: ['spec/helpers/*.js'],
          specs: [
            'spec/shared/**/spec.*.js',
            'spec/client/**/spec.*.js'
          ],
          template: 'spec/index.html',
          keepRunner: true
        }
      }
    },
    // Sets up server-side Jasmine node tests
    jasmine_node: {
      useHelpers: true,
      specFolders: [
        './spec/shared',
        './spec/server'
      ],
      projectRoot: './spec/',
      options: {
        specNameMatcher: 'spec.*', // load only specs containing specNameMatcher
        match: '.*',
        useRequireJs: 'spec/requirejs-setup.js',
        jUnit: {
          report: false,
          savePath : './build/reports/jasmine/',
          useDotNotation: true,
          consolidate: true
        }
      }
    },
    // Sets up Cucumber feature tests
    cucumber: {
      test: {
        features: 'features/'
      },
      options: {
        prefix: 'bundle exec',
        format: 'progress',
        tags: ['~@wip']
      }
    },
    // Lints our JavaScript
    jshint: {
      files: ['app/**/*.js', 'app/**/*.json', 'spec/**/*.js'],
      options: {
        reporter: require('jshint-stylish'),
        jshintrc: true
      }
    },
    // Creates a single big JS file
    requirejs: {
      production: {
        options: extend({}, requirejsConfig, {
          out: 'public/javascripts/spotlight.js',
          d3: true
        })
      },
      'production-no-d3': {
        options: extend({}, requirejsConfig, {
          out: 'public/javascripts/spotlight-no-d3.js',
          d3: false
        })
      }
    },
    // Copies templates and assets from external modules and dirs
    copy: {
      govuk_template: {
        src: 'node_modules/govuk_template_mustache/views/layouts/govuk_template.html',
        dest: 'app/common/templates/',
        expand: true,
        flatten: true,
        filter: 'isFile'
      },
      govuk_assets: {
        files: [
          {
            expand: true,
            src: '**',
            cwd: 'node_modules/govuk_template_mustache/assets',
            dest: 'public/'
          }
        ]
      },
      spotlight_assets: {
        files: [
          {
            expand: true,
            src: '**',
            cwd: 'assets',
            dest: 'public/'
          }
        ]
      },
      vendor: {
        files: [
          {
            src: 'node_modules/backbone/backbone.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/d3/d3.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/moment-timezone/moment-timezone.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          }
        ]
      }
    },
    // Watches styles and specs for changes
    watch: {
      css: {
        files: ['styles/**/*.scss'],
        tasks: ['sass:development'],
        options: { nospawn: true }
      },
      spec: {
        files: ['spec/**/spec.*.js'],
        tasks: ['jasmine:spotlight:build']
      }
    },
    shell: {
      // Generates the page-per-thing module JSON stubs
      generate_module_stubs: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: false
        },
        command: 'node tools/stagecraft-generate-module-stubs.js'
      },
      // Supervises the node process in development
      supervisor: {
        options: {
          stdout: true,
          stderr: true
        },
        command: './node_modules/supervisor/lib/cli-wrapper.js -w app -i app/vendor -e "js|html" -n error app/server'
      }
    },
    // Runs development tasks concurrently
    concurrent: {
      dev: {
        tasks: ['shell:supervisor', 'watch'],
        options: {
          logConcurrentOutput: true
        }
      }
    },
    // Creates an asset digest for cachebusting URLs
    digest: {
      options: {
        out: 'public/asset-digest.json',
        separator: '-',
        algorithm: 'md5'
      },
      files: {
        src: ['public/**/*.*']
      }
    }
  });

  // Load external module tasks
  [
    'grunt-contrib-jasmine',
    'grunt-jasmine-node-coverage',
    'grunt-contrib-jshint',
    'grunt-contrib-clean',
    'grunt-contrib-requirejs',
    'grunt-digest',
    'grunt-rcukes',
    'grunt-sass',
    'grunt-contrib-copy',
    'grunt-contrib-watch',
    'grunt-shell',
    'grunt-concurrent'
  ].forEach(function (task) {
    grunt.loadNpmTasks(task);
  });

  grunt.registerTask('copy:assets', [
    'copy:govuk_assets',
    'copy:spotlight_assets'
  ]);

  grunt.registerTask('build:common', [
    'copy:vendor',
    'copy:govuk_template',
    'clean',
    'copy:assets',
    'shell:generate_module_stubs'
  ]);

  grunt.registerTask('build:development', [
    'build:common',
    'sass:development',
    'digest'
  ]);

  grunt.registerTask('build:production', [
    'build:common',
    'sass:production',
    'requirejs:production',
    'requirejs:production-no-d3',
    'digest'
  ]);

  grunt.registerTask('test:all', [
    'copy:vendor',
    'copy:govuk_template',
    'clean',
    'copy:assets',
    'shell:generate_module_stubs',
    'sass:development',
    'digest',
    'jasmine',
    'jasmine_node',
    'jshint',
    'cucumber'
  ]);

  // Default task
  grunt.registerTask('default', [
    'build:development',
    'jasmine:spotlight:build',
    'concurrent'
  ]);

};
<commit_msg>Enable Sass source maps<commit_after>var extend = require('xtend');

var getRequirejsConfig = function () {
  var requirejsConfig;
  global.define = function (config) {
    requirejsConfig = config({ isBuild: true });
  };
  require('./app/config');

  return extend(requirejsConfig, {
    baseUrl: 'app',
    name: 'client',
    waitSeconds: 60,
    include: ['vendor/almond'],
    deps: [
      'client',
      'client/client_bootstrap'
    ],
    wrap: true,
    optimize: 'uglify'
  });
};

var requirejsConfig = getRequirejsConfig();

module.exports = function (grunt) {
  'use strict';

  grunt.initConfig({
    // Removes the contents of the public directory
    clean: ['public/'],
    // Builds Sass in development and production
    sass: {
      development: {
        files: {
          'public/stylesheets/spotlight.css': 'styles/index.scss'
        },
        options: {
          includePaths: [
            'node_modules/govuk_frontend_toolkit/govuk_frontend_toolkit/stylesheets'
          ],
          style: 'nested',
          sourceComments: 'map'
        }
      },
      production: {
        files: [
          { 'public/stylesheets/spotlight.css': 'styles/index.scss' },
          {
            expand: true,
            cwd: 'node_modules/govuk_template_mustache/assets/stylesheets',
            src: ['*.css'],
            dest: 'public/stylesheets',
            ext: '.css'
          }
        ],
        options: {
          includePaths: [
            'node_modules/govuk_frontend_toolkit/govuk_frontend_toolkit/stylesheets'
          ],
          outputStyle: 'compressed'
        }
      }
    },
    // Sets up Jasmine tests
    jasmine: {
      spotlight: {
        src: ['app/**/*.js'],
        options: {
          helpers: ['spec/helpers/*.js'],
          specs: [
            'spec/shared/**/spec.*.js',
            'spec/client/**/spec.*.js'
          ],
          template: 'spec/index.html',
          keepRunner: true
        }
      }
    },
    // Sets up server-side Jasmine node tests
    jasmine_node: {
      useHelpers: true,
      specFolders: [
        './spec/shared',
        './spec/server'
      ],
      projectRoot: './spec/',
      options: {
        specNameMatcher: 'spec.*', // load only specs containing specNameMatcher
        match: '.*',
        useRequireJs: 'spec/requirejs-setup.js',
        jUnit: {
          report: false,
          savePath : './build/reports/jasmine/',
          useDotNotation: true,
          consolidate: true
        }
      }
    },
    // Sets up Cucumber feature tests
    cucumber: {
      test: {
        features: 'features/'
      },
      options: {
        prefix: 'bundle exec',
        format: 'progress',
        tags: ['~@wip']
      }
    },
    // Lints our JavaScript
    jshint: {
      files: ['app/**/*.js', 'app/**/*.json', 'spec/**/*.js'],
      options: {
        reporter: require('jshint-stylish'),
        jshintrc: true
      }
    },
    // Creates a single big JS file
    requirejs: {
      production: {
        options: extend({}, requirejsConfig, {
          out: 'public/javascripts/spotlight.js',
          d3: true
        })
      },
      'production-no-d3': {
        options: extend({}, requirejsConfig, {
          out: 'public/javascripts/spotlight-no-d3.js',
          d3: false
        })
      }
    },
    // Copies templates and assets from external modules and dirs
    copy: {
      govuk_template: {
        src: 'node_modules/govuk_template_mustache/views/layouts/govuk_template.html',
        dest: 'app/common/templates/',
        expand: true,
        flatten: true,
        filter: 'isFile'
      },
      govuk_assets: {
        files: [
          {
            expand: true,
            src: '**',
            cwd: 'node_modules/govuk_template_mustache/assets',
            dest: 'public/'
          }
        ]
      },
      spotlight_assets: {
        files: [
          {
            expand: true,
            src: '**',
            cwd: 'assets',
            dest: 'public/'
          }
        ]
      },
      vendor: {
        files: [
          {
            src: 'node_modules/backbone/backbone.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/d3/d3.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/moment-timezone/moment-timezone.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          }
        ]
      }
    },
    // Watches styles and specs for changes
    watch: {
      css: {
        files: ['styles/**/*.scss'],
        tasks: ['sass:development'],
        options: { nospawn: true }
      },
      spec: {
        files: ['spec/**/spec.*.js'],
        tasks: ['jasmine:spotlight:build']
      }
    },
    shell: {
      // Generates the page-per-thing module JSON stubs
      generate_module_stubs: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: false
        },
        command: 'node tools/stagecraft-generate-module-stubs.js'
      },
      // Supervises the node process in development
      supervisor: {
        options: {
          stdout: true,
          stderr: true
        },
        command: './node_modules/supervisor/lib/cli-wrapper.js -w app -i app/vendor -e "js|html" -n error app/server'
      }
    },
    // Runs development tasks concurrently
    concurrent: {
      dev: {
        tasks: ['shell:supervisor', 'watch'],
        options: {
          logConcurrentOutput: true
        }
      }
    },
    // Creates an asset digest for cachebusting URLs
    digest: {
      options: {
        out: 'public/asset-digest.json',
        separator: '-',
        algorithm: 'md5'
      },
      files: {
        src: ['public/**/*.*']
      }
    }
  });

  // Load external module tasks
  [
    'grunt-contrib-jasmine',
    'grunt-jasmine-node-coverage',
    'grunt-contrib-jshint',
    'grunt-contrib-clean',
    'grunt-contrib-requirejs',
    'grunt-digest',
    'grunt-rcukes',
    'grunt-sass',
    'grunt-contrib-copy',
    'grunt-contrib-watch',
    'grunt-shell',
    'grunt-concurrent'
  ].forEach(function (task) {
    grunt.loadNpmTasks(task);
  });

  grunt.registerTask('copy:assets', [
    'copy:govuk_assets',
    'copy:spotlight_assets'
  ]);

  grunt.registerTask('build:common', [
    'copy:vendor',
    'copy:govuk_template',
    'clean',
    'copy:assets',
    'shell:generate_module_stubs'
  ]);

  grunt.registerTask('build:development', [
    'build:common',
    'sass:development',
    'digest'
  ]);

  grunt.registerTask('build:production', [
    'build:common',
    'sass:production',
    'requirejs:production',
    'requirejs:production-no-d3',
    'digest'
  ]);

  grunt.registerTask('test:all', [
    'copy:vendor',
    'copy:govuk_template',
    'clean',
    'copy:assets',
    'shell:generate_module_stubs',
    'sass:development',
    'digest',
    'jasmine',
    'jasmine_node',
    'jshint',
    'cucumber'
  ]);

  // Default task
  grunt.registerTask('default', [
    'build:development',
    'jasmine:spotlight:build',
    'concurrent'
  ]);

};
<|endoftext|>


<commit_before>/* global __dirname, module, require */

module.exports = function(grunt) {
  'use strict';

  // Project configuration
  var srcFiles = ['Gruntfile.js', 'www/js/**/*.js'];
  grunt.initConfig({
    jshint: {
      src: srcFiles,
      options: {
        jshintrc: true,
      },
    },

    jscs: {
      src: srcFiles,
    },

    watch: {
      files: srcFiles,
      tasks: ['jshint', 'jscs'],
    },
  });

  // Load grunt plugins
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-jscs');

  // This custom task starts a simple express server that allows the application to be run in a browser for rapid development
  grunt.registerTask('serve', 'Start server for browser-based app', function(port) {
    // This task is asynchronous and never completes (it must be terminated by manually terminating the grunt process)
    var done = this.async(); // jshint ignore:line

    var express = require('express');
    var bodyParser = require('body-parser');
    var app = express();
    app.use(bodyParser.json()); // for parsing application/json

    // Log all GET requests
    app.get('*', function(req, res, next) {
      grunt.log.writeln(req.url);
      next();
    });

    // The core of this express server is a simple static file server. It serves BOTH the www/ and platforms/<platform>/www/
    // directories to the same /<platform>/www/ route. This efficiently emulates the behavior of "cordova serve" without the
    // inconvenience of having to run "cordova prepare <platform>" after every file modification.
    var path = require('path');
    var projectRoot = __dirname;
    var wwwRoute = express.static(path.join(projectRoot, 'www'));
    ['browser', 'ios', 'android'].forEach(function(platform) {
      var platformPath = '/' + platform + '/www/';
      app.use(platformPath, wwwRoute);
      app.use(platformPath, express.static(path.join(projectRoot, 'platforms', platform, 'www')));
    });

    var transactions = [];
    app.post('/sync', function(req, res) {
      var lastSyncTimestamp = req.body.lastSyncTimestamp;
      var now = Date.now();
      res.send({
        status: 'success',
        data: {
          lastSyncTimestamp: now,
          transactionLog: transactions.filter(function(transaction) {
            return transaction.timestamp === null || transaction.timestamp > lastSyncTimestamp;
          }),
        },
      });
      req.body.transactionLog.forEach(function(transaction) {
        transaction.timestamp = now;
        transactions.push(transaction);
      });

      console.log(transactions);
    });

    // Listen on the provided port, defaulting to 8000
    var server = app.listen(port || 8000, function() {
      var serverPort = server.address().port;
      grunt.log.ok('Started app browser server running on port %s', serverPort);
      grunt.log.ok('Run from http://localhost:%s/browser/www/', serverPort);
    });
  });

  // Define default task
  grunt.registerTask('default', ['jshint', 'jscs']);
};
<commit_msg>Add dev server routes for interacting with the transaction list<commit_after>/* global __dirname, module, require */

module.exports = function(grunt) {
  'use strict';

  // Project configuration
  var srcFiles = ['Gruntfile.js', 'www/js/**/*.js'];
  grunt.initConfig({
    jshint: {
      src: srcFiles,
      options: {
        jshintrc: true,
      },
    },

    jscs: {
      src: srcFiles,
    },

    watch: {
      files: srcFiles,
      tasks: ['jshint', 'jscs'],
    },
  });

  // Load grunt plugins
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-jscs');

  // This custom task starts a simple express server that allows the application to be run in a browser for rapid development
  grunt.registerTask('serve', 'Start server for browser-based app', function(port) {
    // This task is asynchronous and never completes (it must be terminated by manually terminating the grunt process)
    var done = this.async(); // jshint ignore:line

    var express = require('express');
    var bodyParser = require('body-parser');
    var app = express();
    app.use(bodyParser.json()); // for parsing application/json

    // Log all GET requests
    app.get('*', function(req, res, next) {
      grunt.log.writeln(req.url);
      next();
    });

    // The core of this express server is a simple static file server. It serves BOTH the www/ and platforms/<platform>/www/
    // directories to the same /<platform>/www/ route. This efficiently emulates the behavior of "cordova serve" without the
    // inconvenience of having to run "cordova prepare <platform>" after every file modification.
    var path = require('path');
    var projectRoot = __dirname;
    var wwwRoute = express.static(path.join(projectRoot, 'www'));
    ['browser', 'ios', 'android'].forEach(function(platform) {
      var platformPath = '/' + platform + '/www/';
      app.use(platformPath, wwwRoute);
      app.use(platformPath, express.static(path.join(projectRoot, 'platforms', platform, 'www')));
    });

    var transactions = [];
    app.post('/sync', function(req, res) {
      var lastSyncTimestamp = req.body.lastSyncTimestamp;
      var now = Date.now();
      res.send({
        status: 'success',
        data: {
          lastSyncTimestamp: now,
          transactionLog: transactions.filter(function(transaction) {
            return transaction.timestamp === null || transaction.timestamp > lastSyncTimestamp;
          }),
        },
      });
      req.body.transactionLog.forEach(function(transaction) {
        transaction.timestamp = now;
        transactions.push(transaction);
      });

      console.log(transactions);
    });

    // Print the list of transactions
    app.get('/sync/dump', function(req, res) {
      res.json({ transactions: transactions });
    });

    // Clear the list of transactions
    app.get('/sync/reset', function(req, res) {
      transactions = [];
      res.send('Cleared transaction list');
    });

    // Listen on the provided port, defaulting to 8000
    var server = app.listen(port || 8000, function() {
      var serverPort = server.address().port;
      grunt.log.ok('Started app browser server running on port %s', serverPort);
      grunt.log.ok('Run from http://localhost:%s/browser/www/', serverPort);
    });
  });

  // Define default task
  grunt.registerTask('default', ['jshint', 'jscs']);
};
<|endoftext|>