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

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

		bower:{
			install: {
				options: {
					cleanup: true,
					targetDir: './development/js/libs'
				}
			}
		},
		setup:{
			development:{
				basePath: './development/',
				assets: [
					{
						folder: 'sass',
						files: [
							'styles.scss',
							'_colors.scss',
							'_typography.scss',
							'_functions.scss',
							'_mixins.scss',
							'_settings.scss',
							'_ie.scss'
						]
					},
					{
						folder: 'js',
						files: [
							'scripts.js'
						]
					},
					{ folder: 'js/plugins' },
					{ folder: 'fonts' },
					{ folder: 'img' }
				]
			},
			public:{
				basePath: './public/',
				assets: [
					{ folder: 'css' },
					{ folder: 'js' },
					{ folder: 'js/libs' },
					{ folder: 'js/plugins' },
					{ folder: 'fonts' },
					{ folder: 'img' },
				]
			}
		},
		copy:{
			copyFiles: {
				files: [
					 {
					 	expand: true,
					 	flatten: true,
					 	src: ['development/js/libs/normalize-scss/*.scss'],
					 	dest: 'development/sass',
					 	filter: 'isFile'
					 }
				]
			}
		},

		clean:{
			bowerFiles: ['development/js/libs/normalize-scss/']
		},

		compass: {
			options: {
				sassDir: 'sass',
				cssDir: '../public/css'
			},
			dist: {
				options: {
					environment: 'production'
				}
			}
		},

		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
			},
			dist: {
				files: {
					'js/plugins.min.js': ['<%= concat.dist.dest %>']
				}
			},
			src:{
				files: {
					'js/scripts.min.js': ['js/_src/scripts.js']
				}
			}
		},

		jshint:{
			files: ['js/**/*.js']
		},

		concat: {
			options: {
				 separator: ';'
			},
			dist: {
				src: 'js/plugins/**/*.js',
				dest: '../public/js/plugins/plugins.js'
			}
		},

		imagemin:{
			dynamic:{
				files: [{
					expand: true,
					cwd: 'img/prod/',
					src: ['**/*.{png,jpg,gif,svg}'],
					dest: 'img/'
				}]
			}
		},

		watch: {
			grunt: {
				files: ['Gruntfile.js'],
				options: {
					reload: true
				}
			},
			imagemin:{
				files: ['img/prod/**/**'],
				tasks: ['imagemin'],
			},
			compass: {
				files: 'sass/**/*.scss',
				tasks: ['compass'],
				options:{
					livereload: true
				}
			},
			uglify:{
				files: ['js/_src/scripts.js'],
				tasks: ['uglify:src'],
				options:{
					livereload: true
				}
			}
		}
	});

	grunt.loadNpmTasks('grunt-sass');
	grunt.loadNpmTasks('grunt-mkdir');
	grunt.loadNpmTasks('grunt-contrib');

	grunt.loadNpmTasks('grunt-bower-task');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-compass');
	grunt.loadNpmTasks('grunt-contrib-imagemin');

	grunt.registerMultiTask('setup', 'Setup project structure', function() {

		var basePath 	= this.data.basePath;
		var assets 		= this.data.assets;

		assets.forEach(function( asset ){
			var folder 	= asset.folder;
			var files 	= asset.files;
			var path 	= basePath + folder + '/';

			grunt.log.writeln('Created folder: ' + path);
			grunt.file.mkdir( path );

			if(files){
				files.forEach(function( file ){
					var contents = '';

					if(file=='styles.scss'){
						contents += '@import "compass/css3";\n';
						contents += '@import "settings";\n';
						contents += '@import "functions";\n';
						contents += '@import "mixins";\n';
						contents += '@import "colors";\n';
						contents += '@import "typography";\n';
					}

					grunt.log.writeln('Added file: ' + file);
					grunt.file.write( path + file, contents );
				})
			}
		});
	});

	grunt.registerTask('install', ['setup', 'bower', 'copy:copyFiles', 'clean:bowerFiles']);
	// grunt.registerTask('compass', ['compass']);
	// grunt.registerTask('default', ['concat', 'uglify', 'jshint', 'watch']);
}<commit_msg>Removed basePath from setup task. Uses this.target instead. Also removed unused NpmTasks<commit_after>module.exports = function(grunt) {

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

		bower:{
			install: {
				options: {
					cleanup: true,
					targetDir: './development/js/libs'
				}
			}
		},
		setup:{
			development:{
				assets: [
					{
						folder: 'sass',
						files: [
							'styles.scss',
							'_colors.scss',
							'_typography.scss',
							'_functions.scss',
							'_mixins.scss',
							'_settings.scss',
							'_ie.scss'
						]
					},
					{
						folder: 'js',
						files: [
							'scripts.js'
						]
					},
					{
						folder: 'js/plugins'
					},
					{
						folder: 'fonts'
					},
					{
						folder: 'img'
					}
				]
			},
			public:{
				assets: [
					{ folder: 'css' },
					{ folder: 'js' },
					{ folder: 'js/libs' },
					{ folder: 'js/plugins' },
					{ folder: 'fonts' },
					{ folder: 'img' },
				]
			}
		},
		copy:{
			copyFiles: {
				files: [
					 {
					 	expand: true,
					 	flatten: true,
					 	src: ['development/js/libs/normalize-scss/*.scss'],
					 	dest: 'development/sass',
					 	filter: 'isFile'
					 }
				]
			}
		},

		clean:{
			bowerFiles: ['development/js/libs/normalize-scss/']
		},

		compass: {
			options: {
				sassDir: 'sass',
				cssDir: '../public/css'
			},
			dist: {
				options: {
					environment: 'production'
				}
			}
		},

		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
			},
			dist: {
				files: {
					'js/plugins.min.js': ['<%= concat.dist.dest %>']
				}
			},
			src:{
				files: {
					'js/scripts.min.js': ['js/_src/scripts.js']
				}
			}
		},

		jshint:{
			files: ['js/**/*.js']
		},

		concat: {
			options: {
				 separator: ';'
			},
			dist: {
				src: 'js/plugins/**/*.js',
				dest: '../public/js/plugins/plugins.js'
			}
		},

		imagemin:{
			dynamic:{
				files: [{
					expand: true,
					cwd: 'img/prod/',
					src: ['**/*.{png,jpg,gif,svg}'],
					dest: 'img/'
				}]
			}
		},

		watch: {
			grunt: {
				files: ['Gruntfile.js'],
				options: {
					reload: true
				}
			},
			imagemin:{
				files: ['img/prod/**/**'],
				tasks: ['imagemin'],
			},
			compass: {
				files: 'sass/**/*.scss',
				tasks: ['compass'],
				options:{
					livereload: true
				}
			},
			uglify:{
				files: ['js/_src/scripts.js'],
				tasks: ['uglify:src'],
				options:{
					livereload: true
				}
			}
		}
	});

	grunt.loadNpmTasks('grunt-sass');
	grunt.loadNpmTasks('grunt-bower-task');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-compass');
	grunt.loadNpmTasks('grunt-contrib-imagemin');

	grunt.registerMultiTask('setup', 'Setup project structure', function() {

		var basePath 	= './'+ this.target +'/';
		var assets 		= this.data.assets;

		assets.forEach(function( asset ){
			var folder 	= asset.folder;
			var files 	= asset.files;
			var path 	= basePath + folder + '/';

			grunt.log.writeln('Created folder: ' + path);
			grunt.file.mkdir( path );

			if(files){
				files.forEach(function( file ){
					var contents = '';

					if(file=='styles.scss'){
						contents += '@import "compass/css3";\n';
						contents += '@import "settings";\n';
						contents += '@import "functions";\n';
						contents += '@import "mixins";\n';
						contents += '@import "colors";\n';
						contents += '@import "typography";\n';
					}

					grunt.log.writeln('Added file: ' + file);
					grunt.file.write( path + file, contents );
				})
			}
		});
	});

	grunt.registerTask('install', ['setup', 'bower', 'copy:copyFiles', 'clean:bowerFiles']);
	// grunt.registerTask('compass', ['compass']);
	// grunt.registerTask('default', ['concat', 'uglify', 'jshint', 'watch']);
}<|endoftext|>


<commit_before>// Generated on 2014-03-11 using generator-angular-fullstack 1.3.2
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

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);

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

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },
    express: {
      options: {
        port: process.env.PORT || 9000
      },
      dev: {
        options: {
          script: 'server.js',
          debug: true
        }
      },
      prod: {
        options: {
          script: 'dist/server.js',
          node_env: 'production'
        }
      }
    },
    open: {
      server: {
        url: 'http://localhost:<%= express.options.port %>'
      }
    },
    watch: {
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: true
        }
      },
      mochaTest: {
        files: ['test/server/{,*/}*.js'],
        tasks: ['mochaTest']
      },
      jsTest: {
        files: ['test/client/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        files: [
          '<%= yeoman.app %>/views/{,*//*}*.{html,jade}',
          '{.tmp,<%= yeoman.app %>}/styles/{,*//*}*.css',
          '{.tmp,<%= yeoman.app %>}/scripts/{,*//*}*.js',
          '<%= yeoman.app %>/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}',
        ],

        options: {
          livereload: true
        }
      },
      express: {
        files: [
          'server.js',
          'lib/**/*.{js,json}'
        ],
        tasks: ['newer:jshint:server', 'express:dev', 'wait'],
        options: {
          livereload: true,
          nospawn: true //Without this option specified express won't be reloaded
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      server: {
        options: {
          jshintrc: 'lib/.jshintrc'
        },
        src: [ 'lib/{,*/}*.js']
      },
      all: [
        '<%= yeoman.app %>/scripts/{,*/}*.js'
      ],
      test: {
        options: {
          jshintrc: 'test/client/.jshintrc'
        },
        src: ['test/client/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*',
            '!<%= yeoman.dist %>/Procfile'
          ]
        }]
      },
      heroku: {
        files: [{
          dot: true,
          src: [
            'heroku/*',
            '!heroku/.git*',
            '!heroku/Procfile'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Debugging with node inspector
    'node-inspector': {
      custom: {
        options: {
          'web-host': 'localhost'
        }
      }
    },

    // Use nodemon to run server in debug mode with an initial breakpoint
    nodemon: {
      debug: {
        script: 'server.js',
        options: {
          nodeArgs: ['--debug-brk'],
          env: {
            PORT: process.env.PORT || 9000
          },
          callback: function (nodemon) {
            nodemon.on('log', function (event) {
              console.log(event.colour);
            });

            // opens browser on initial server start
            nodemon.on('config:update', function () {
              setTimeout(function () {
                require('open')('http://localhost:8080/debug?port=5858');
              }, 500);
            });
          }
        }
      }
    },

    // Automatically inject Bower components into the app
    'bower-install': {
      app: {
        html: '<%= yeoman.app %>/views/index.html',
        ignorePath: '<%= yeoman.app %>/',
        exclude: ['bootstrap-sass']
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/public/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/public/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/public/styles/{,*/}*.css',
            '<%= yeoman.dist %>/public/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/public/styles/fonts/*'
          ]
        }
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: ['<%= yeoman.app %>/views/index.html',
             '<%= yeoman.app %>/views/index.jade'],
      options: {
        dest: '<%= yeoman.dist %>/public'
      }
    },

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/views/{,*/}*.html',
             '<%= yeoman.dist %>/views/{,*/}*.jade'],
      css: ['<%= yeoman.dist %>/public/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>/public']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/public/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/public/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          //collapseWhitespace: true,
          //collapseBooleanAttributes: true,
          //removeCommentsFromCDATA: true,
          //removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/views',
          src: ['*.html', 'partials/**/*.html'],
          dest: '<%= yeoman.dist %>/views'
        }]
      }
    },

    // Allow the use of non-minsafe AngularJS files. Automatically makes it
    // minsafe compatible so Uglify does not destroy the ng references
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/views/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>/public',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            'bower_components/**/*',
            'images/{,*/}*.{webp}',
            'fonts/**/*'
          ]
        }, {
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>/views',
          dest: '<%= yeoman.dist %>/views',
          src: '**/*.jade'
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/public/images',
          src: ['generated/*']
        }, {
          expand: true,
          dest: '<%= yeoman.dist %>',
          src: [
            'package.json',
            'server.js',
            'lib/**/*'
          ]
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      debug: {
        tasks: [
          'nodemon',
          'node-inspector'
        ],
        options: {
          logConcurrentOutput: true
        }
      },
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin',
        'htmlmin'
      ]
    },

    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%= yeoman.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    // Test settings
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    },

    mochaTest: {
      options: {
        reporter: 'spec'
      },
      src: ['test/server/**/*.js']
    },

    env: {
      test: {
        NODE_ENV: 'test'
      }
    }
  });

  // Used for delaying livereload until after server has restarted
  grunt.registerTask('wait', function () {
    grunt.log.ok('Waiting for server reload...');

    var done = this.async();

    setTimeout(function () {
      grunt.log.writeln('Done waiting!');
      done();
    }, 500);
  });

  grunt.registerTask('express-keepalive', 'Keep grunt running', function() {
    this.async();
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'express:prod', 'open', 'express-keepalive']);
    }

    if (target === 'debug') {
      return grunt.task.run([
        'clean:server',
        'bower-install',
        'concurrent:server',
        'autoprefixer',
        'concurrent:debug'
      ]);
    }

    grunt.task.run([
      'clean:server',
      'bower-install',
      'concurrent:server',
      'autoprefixer',
      'express:dev',
      'open',
      'watch'
    ]);
  });

  grunt.registerTask('server', function () {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve']);
  });

  grunt.registerTask('test', function(target) {
    if (target === 'server') {
      return grunt.task.run([
        'env:test',
        'mochaTest'
      ]);
    }

    if (target === 'client') {
      return grunt.task.run([
        'clean:server',
        'concurrent:test',
        'autoprefixer',
        'karma'
      ]);
    }

    grunt.task.run([
      'env:test',
      'mochaTest',
      'clean:server',
      'concurrent:test',
      'autoprefixer',
      'karma'
    ]);
  });

  grunt.registerTask('build', [
    'clean:dist',
    'bower-install',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'rev',
    'usemin'
  ]);

  grunt.registerTask('heroku', function () {
    grunt.log.warn('The `heroku` task has been deprecated. Use `grunt build` to build for deployment.');
    grunt.task.run(['build']);
  });

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>fixed grunt file to pass test on travis<commit_after>// Generated on 2014-03-11 using generator-angular-fullstack 1.3.2
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

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);

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

        // Project settings
        yeoman: {
            // configurable paths
            app: require('./bower.json').appPath || 'app',
            dist: 'dist'
        },
        express: {
            options: {
                port: process.env.PORT || 9000
            },
            dev: {
                options: {
                    script: 'server.js',
                    debug: true
                }
            },
            prod: {
                options: {
                    script: 'dist/server.js',
                    node_env: 'production'
                }
            }
        },
        open: {
            server: {
                url: 'http://localhost:<%= express.options.port %>'
            }
        },
        watch: {
            js: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
                tasks: ['newer:jshint:all'],
                options: {
                    livereload: true
                }
            },
            mochaTest: {
                files: ['test/server/{,*/}*.js'],
                tasks: ['mochaTest']
            },
            jsTest: {
                files: ['test/client/spec/{,*/}*.js'],
                tasks: ['newer:jshint:test', 'karma']
            },
            compass: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
                tasks: ['compass:server', 'autoprefixer']
            },
            gruntfile: {
                files: ['Gruntfile.js']
            },
            livereload: {
                files: [
          '<%= yeoman.app %>/views/{,*//*}*.{html,jade}',
          '{.tmp,<%= yeoman.app %>}/styles/{,*//*}*.css',
          '{.tmp,<%= yeoman.app %>}/scripts/{,*//*}*.js',
          '<%= yeoman.app %>/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}',
        ],

                options: {
                    livereload: true
                }
            },
            express: {
                files: [
          'server.js',
          'lib/**/*.{js,json}'
        ],
                tasks: ['newer:jshint:server', 'express:dev', 'wait'],
                options: {
                    livereload: true,
                    nospawn: true //Without this option specified express won't be reloaded
                }
            }
        },

        // Make sure code styles are up to par and there are no obvious mistakes
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: require('jshint-stylish')
            },
            server: {
                options: {
                    jshintrc: 'lib/.jshintrc'
                },
                src: ['lib/{,*/}*.js']
            },
            all: [
        '<%= yeoman.app %>/scripts/{,*/}*.js'
      ],
            test: {
                options: {
                    jshintrc: 'test/client/.jshintrc'
                },
                src: ['test/client/spec/{,*/}*.js']
            }
        },

        // Empties folders to start fresh
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
            '.tmp',
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*',
            '!<%= yeoman.dist %>/Procfile'
          ]
        }]
            },
            heroku: {
                files: [{
                    dot: true,
                    src: [
            'heroku/*',
            '!heroku/.git*',
            '!heroku/Procfile'
          ]
        }]
            },
            server: '.tmp'
        },

        // Add vendor prefixed styles
        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
        }]
            }
        },

        // Debugging with node inspector
        'node-inspector': {
            custom: {
                options: {
                    'web-host': 'localhost'
                }
            }
        },

        // Use nodemon to run server in debug mode with an initial breakpoint
        nodemon: {
            debug: {
                script: 'server.js',
                options: {
                    nodeArgs: ['--debug-brk'],
                    env: {
                        PORT: process.env.PORT || 9000
                    },
                    callback: function (nodemon) {
                        nodemon.on('log', function (event) {
                            console.log(event.colour);
                        });

                        // opens browser on initial server start
                        nodemon.on('config:update', function () {
                            setTimeout(function () {
                                require('open')('http://localhost:8080/debug?port=5858');
                            }, 500);
                        });
                    }
                }
            }
        },

        // Automatically inject Bower components into the app
        'bower-install': {
            app: {
                html: '<%= yeoman.app %>/views/index.html',
                ignorePath: '<%= yeoman.app %>/',
                exclude: ['bootstrap-sass']
            }
        },

        // Compiles Sass to CSS and generates necessary files if requested
        compass: {
            options: {
                sassDir: '<%= yeoman.app %>/styles',
                cssDir: '.tmp/styles',
                generatedImagesDir: '.tmp/images/generated',
                imagesDir: '<%= yeoman.app %>/images',
                javascriptsDir: '<%= yeoman.app %>/scripts',
                fontsDir: '<%= yeoman.app %>/styles/fonts',
                importPath: '<%= yeoman.app %>/bower_components',
                httpImagesPath: '/images',
                httpGeneratedImagesPath: '/images/generated',
                httpFontsPath: '/styles/fonts',
                relativeAssets: false,
                assetCacheBuster: false,
                raw: 'Sass::Script::Number.precision = 10\n'
            },
            dist: {
                options: {
                    generatedImagesDir: '<%= yeoman.dist %>/public/images/generated'
                }
            },
            server: {
                options: {
                    debugInfo: true
                }
            }
        },

        // Renames files for browser caching purposes
        rev: {
            dist: {
                files: {
                    src: [
            '<%= yeoman.dist %>/public/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/public/styles/{,*/}*.css',
            '<%= yeoman.dist %>/public/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/public/styles/fonts/*'
          ]
                }
            }
        },

        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            html: ['<%= yeoman.app %>/views/index.html',
             '<%= yeoman.app %>/views/index.jade'],
            options: {
                dest: '<%= yeoman.dist %>/public'
            }
        },

        // Performs rewrites based on rev and the useminPrepare configuration
        usemin: {
            html: ['<%= yeoman.dist %>/views/{,*/}*.html',
             '<%= yeoman.dist %>/views/{,*/}*.jade'],
            css: ['<%= yeoman.dist %>/public/styles/{,*/}*.css'],
            options: {
                assetsDirs: ['<%= yeoman.dist %>/public']
            }
        },

        // The following *-min tasks produce minified files in the dist folder
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg,gif}',
                    dest: '<%= yeoman.dist %>/public/images'
        }]
            }
        },

        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/public/images'
        }]
            }
        },

        htmlmin: {
            dist: {
                options: {
                    //collapseWhitespace: true,
                    //collapseBooleanAttributes: true,
                    //removeCommentsFromCDATA: true,
                    //removeOptionalTags: true
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/views',
                    src: ['*.html', 'partials/**/*.html'],
                    dest: '<%= yeoman.dist %>/views'
        }]
            }
        },

        // Allow the use of non-minsafe AngularJS files. Automatically makes it
        // minsafe compatible so Uglify does not destroy the ng references
        ngmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/concat/scripts',
                    src: '*.js',
                    dest: '.tmp/concat/scripts'
        }]
            }
        },

        // Replace Google CDN references
        cdnify: {
            dist: {
                html: ['<%= yeoman.dist %>/views/*.html']
            }
        },

        // Copies remaining files to places other tasks can use
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>/public',
                    src: [
            '*.{ico,png,txt}',
            '.htaccess',
            'bower_components/**/*',
            'images/{,*/}*.{webp}',
            'fonts/**/*'
          ]
        }, {
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>/views',
                    dest: '<%= yeoman.dist %>/views',
                    src: '**/*.jade'
        }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/public/images',
                    src: ['generated/*']
        }, {
                    expand: true,
                    dest: '<%= yeoman.dist %>',
                    src: [
            'package.json',
            'server.js',
            'lib/**/*'
          ]
        }]
            },
            styles: {
                expand: true,
                cwd: '<%= yeoman.app %>/styles',
                dest: '.tmp/styles/',
                src: '{,*/}*.css'
            }
        },

        // Run some tasks in parallel to speed up the build process
        concurrent: {
            server: [
        'compass:server'
      ],
            test: [
      ],
            debug: {
                tasks: [
          'nodemon',
          'node-inspector'
        ],
                options: {
                    logConcurrentOutput: true
                }
            },
            dist: [
        'compass:dist',
        'imagemin',
        'svgmin',
        'htmlmin'
      ]
        },

        // By default, your `index.html`'s <!-- Usemin block --> will take care of
        // minification. These next options are pre-configured if you do not wish
        // to use the Usemin blocks.
        // cssmin: {
        //   dist: {
        //     files: {
        //       '<%= yeoman.dist %>/styles/main.css': [
        //         '.tmp/styles/{,*/}*.css',
        //         '<%= yeoman.app %>/styles/{,*/}*.css'
        //       ]
        //     }
        //   }
        // },
        // uglify: {
        //   dist: {
        //     files: {
        //       '<%= yeoman.dist %>/scripts/scripts.js': [
        //         '<%= yeoman.dist %>/scripts/scripts.js'
        //       ]
        //     }
        //   }
        // },
        // concat: {
        //   dist: {}
        // },

        // Test settings
        karma: {
            unit: {
                configFile: 'karma.conf.js',
                singleRun: true
            }
        },

        mochaTest: {
            options: {
                reporter: 'spec'
            },
            src: ['test/server/**/*.js']
        },

        env: {
            test: {
                NODE_ENV: 'test'
            }
        }
    });

    // Used for delaying livereload until after server has restarted
    grunt.registerTask('wait', function () {
        grunt.log.ok('Waiting for server reload...');

        var done = this.async();

        setTimeout(function () {
            grunt.log.writeln('Done waiting!');
            done();
        }, 500);
    });

    grunt.registerTask('express-keepalive', 'Keep grunt running', function () {
        this.async();
    });

    grunt.registerTask('serve', function (target) {
        if (target === 'dist') {
            return grunt.task.run(['build', 'express:prod', 'open', 'express-keepalive']);
        }

        if (target === 'debug') {
            return grunt.task.run([
        'clean:server',
        'bower-install',
        'concurrent:server',
        'autoprefixer',
        'concurrent:debug'
      ]);
        }

        grunt.task.run([
      'clean:server',
      'bower-install',
      'concurrent:server',
      'autoprefixer',
      'express:dev',
      'open',
      'watch'
    ]);
    });

    grunt.registerTask('server', function () {
        grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
        grunt.task.run(['serve']);
    });

    grunt.registerTask('test', function (target) {
        if (target === 'server') {
            return grunt.task.run([
        'env:test',
        'mochaTest'
      ]);
        }

        if (target === 'client') {
            return grunt.task.run([
        'clean:server',
        'concurrent:test',
        'autoprefixer',
        'karma'
      ]);
        }

        grunt.task.run([
      'env:test',
      'mochaTest',
      'clean:server',
      'concurrent:test',
      'autoprefixer',
      'karma'
    ]);
    });

    grunt.registerTask('build', [
    'clean:dist',
    'bower-install',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'rev',
    'usemin'
  ]);

    grunt.registerTask('heroku', function () {
        grunt.log.warn('The `heroku` task has been deprecated. Use `grunt build` to build for deployment.');
        grunt.task.run(['build']);
    });

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


<commit_before>'use strict';

module.exports = function(grunt) {

	grunt.initConfig({
		"clean": {
			dist: ['polyfills/__dist']
		},
		"simplemocha": {
			options: {
				globals: ['should'],
				timeout: 5000,
				ignoreLeaks: false,
				ui: 'bdd',
				reporter: 'spec'
			},
			all: {
				src: ['test/node/**/*.js']
			}
		},
		"saucelabs": {
			compat: {
				options: {
					urls: {
						polyfilled: 'http://127.0.0.1:3000/test/director?mode=all',
						native: 'http://127.0.0.1:3000/test/director?mode=control'
					},
					browsers: browsers.full
				}
			},
			ci: {
				options: {
					cibuild: true,
					urls: {
						default: 'http://127.0.0.1:3000/test/director?mode=targeted'
					},
					browsers: browsers.ci
				}
			},
			quick: {
				options: {
					cibuild: true,
					urls: {
						default: 'http://127.0.0.1:3000/test/director?mode=targeted'
					},
					browsers: browsers.quick
				}
			}
		},
		"watch": {
			options: {
				spawn: false
			},
			js: {
				files: ['bin/*', 'docs/*.html', 'service/*.js', 'lib/*.js'],
				tasks: ['service:polyfillservice:restart']
			},
			polyfills: {
				files: ['polyfills/**/*.js', 'polyfills/**/config.json', '!polyfills/__dist/**'],
				tasks: ['service:polyfillservice:stop', 'buildsources', 'service:polyfillservice:start']
			}
		},
		"service": {
			polyfillservice: {
				shellCommand: __dirname + '/bin/polyfill-service',
				pidFile: __dirname+'/.service.pid',
				generatePID: true,
				options: {
					cwd: __dirname,
					failOnError: true
				}
			}
		},
		"updatelibrary": {
			options: {
				expand: true
			},
			tasks: {
				src: ['polyfills/**/update.task.js'],
			}
		}
	});

	grunt.loadTasks('tasks');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-simple-mocha');

	grunt.registerTask("test", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:quick",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("compatgen", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:compat",
		"compattable",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("ci", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:ci",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("build", [
		"clean",
		"buildsources",
	]);

	grunt.registerTask("devbuild", [
		"clean",
		"buildsources",
	]);

	grunt.registerTask('dev', [
		"service",
		"watch"
	]);
};

var browsers = {
	quick: [
		'chrome/46',
		'firefox/41',
		'ie/12',
		'ie/11',
		'ie/8',
		'android/4.4'
	],
	ci: [
		'chrome/46',
		'chrome/35',
		'firefox/41',
		'firefox/30',
		'ie/12',
		'ie/11',
		'ie/10',
		'ie/9',
		'ie/8',
		'ie/7',
		'ie/6',
		'safari/9',
		'safari/8',
		'android/4.4'
	],
	full: [
		'chrome/46',
		'chrome/42',
		'chrome/35',
		'chrome/30',
		'firefox/41',
		'firefox/33',
		'firefox/30',
		'firefox/20',
		'ie/12',
		'ie/11',
		'ie/10',
		'ie/9',
		'ie/8',
		'ie/7',
		'ie/6',
		'safari/9',
		'safari/8',
		'safari/5.1',
		'android/4.4',
		'android/4.3',
		'android/4.2',
		'android/4.1',
		'ios_saf/9.1'
	]
};
<commit_msg>Adapt grunt to new dotenv mechanism<commit_after>'use strict';

require('dotenv').config({silent: true});

module.exports = function(grunt) {

	grunt.initConfig({
		"clean": {
			dist: ['polyfills/__dist']
		},
		"simplemocha": {
			options: {
				globals: ['should'],
				timeout: 5000,
				ignoreLeaks: false,
				ui: 'bdd',
				reporter: 'spec'
			},
			all: {
				src: ['test/node/**/*.js']
			}
		},
		"saucelabs": {
			compat: {
				options: {
					urls: {
						polyfilled: 'http://127.0.0.1:3000/test/director?mode=all',
						native: 'http://127.0.0.1:3000/test/director?mode=control'
					},
					browsers: browsers.full
				}
			},
			ci: {
				options: {
					cibuild: true,
					urls: {
						default: 'http://127.0.0.1:3000/test/director?mode=targeted'
					},
					browsers: browsers.ci
				}
			},
			quick: {
				options: {
					cibuild: true,
					urls: {
						default: 'http://127.0.0.1:3000/test/director?mode=targeted'
					},
					browsers: browsers.quick
				}
			}
		},
		"watch": {
			options: {
				spawn: false
			},
			js: {
				files: ['bin/*', 'docs/*.html', 'service/*.js', 'lib/*.js'],
				tasks: ['service:polyfillservice:restart']
			},
			polyfills: {
				files: ['polyfills/**/*.js', 'polyfills/**/config.json', '!polyfills/__dist/**'],
				tasks: ['service:polyfillservice:stop', 'buildsources', 'service:polyfillservice:start']
			}
		},
		"service": {
			polyfillservice: {
				shellCommand: __dirname + '/bin/polyfill-service',
				pidFile: __dirname+'/.service.pid',
				generatePID: true,
				options: {
					cwd: __dirname,
					failOnError: true
				}
			}
		},
		"updatelibrary": {
			options: {
				expand: true
			},
			tasks: {
				src: ['polyfills/**/update.task.js'],
			}
		}
	});

	grunt.loadTasks('tasks');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-simple-mocha');

	grunt.registerTask("test", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:quick",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("compatgen", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:compat",
		"compattable",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("ci", [
		"buildsources",
		"simplemocha",
		"service",
		"saucelabs:ci",
		"service:polyfillservice:stop"
	]);

	grunt.registerTask("build", [
		"clean",
		"buildsources",
	]);

	grunt.registerTask("devbuild", [
		"clean",
		"buildsources",
	]);

	grunt.registerTask('dev', [
		"service",
		"watch"
	]);
};

var browsers = {
	quick: [
		'chrome/46',
		'firefox/41',
		'ie/12',
		'ie/11',
		'ie/8',
		'android/4.4'
	],
	ci: [
		'chrome/46',
		'chrome/35',
		'firefox/41',
		'firefox/30',
		'ie/12',
		'ie/11',
		'ie/10',
		'ie/9',
		'ie/8',
		'ie/7',
		'ie/6',
		'safari/9',
		'safari/8',
		'android/4.4'
	],
	full: [
		'chrome/46',
		'chrome/42',
		'chrome/35',
		'chrome/30',
		'firefox/41',
		'firefox/33',
		'firefox/30',
		'firefox/20',
		'ie/12',
		'ie/11',
		'ie/10',
		'ie/9',
		'ie/8',
		'ie/7',
		'ie/6',
		'safari/9',
		'safari/8',
		'safari/5.1',
		'android/4.4',
		'android/4.3',
		'android/4.2',
		'android/4.1',
		'ios_saf/9.1'
	]
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {

  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    jshint: {
      plugin: ['src/threadpool.js'],
      grunt: {
        options: {
          node: true
        },
        files: {
          src: ['Gruntfile.js']
        }
      }
    },
    uglify: {
      js: {
        files: {
          'dist/threadpool.min.js': ['src/threadpool.js'],
          'dist/evalWorker.min.js': ['src/evalWorker.js']
        }
      }
    },
    watch: {
      js: {
        files: ['src/*.js'],
        tasks: ['uglify', 'deploy']
      }
    },

    jasmine_node: {
      options: {
        useHelpers: true
      },
      all: ['spec/']
    },

    // github pages deployment:
    copy: {
      public: {
        files: [
          { expand: true, flatten: true, src: ['dist/*.js'], dest: 'public/' },
          { expand: true, src: ['samples/**'], dest: 'public/' }
        ]
      }
    },
    'gh-pages': {
      options: {
        base: 'public'
      },
      src: ['**']
    },

    clean: ['.grunt/', 'public/']
  });

  grunt.registerTask('test', ['jasmine_node']);
  grunt.registerTask('default', ['jshint', 'uglify']);

  grunt.registerTask('deploy', ['uglify', 'copy:public', 'gh-pages']);

};
<commit_msg>Default task now runs tests.<commit_after>'use strict';

module.exports = function (grunt) {

  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    jshint: {
      plugin: ['src/threadpool.js'],
      grunt: {
        options: {
          node: true
        },
        files: {
          src: ['Gruntfile.js']
        }
      }
    },
    uglify: {
      js: {
        files: {
          'dist/threadpool.min.js': ['src/threadpool.js'],
          'dist/evalWorker.min.js': ['src/evalWorker.js']
        }
      }
    },
    watch: {
      js: {
        files: ['src/*.js'],
        tasks: ['uglify', 'deploy']
      }
    },

    jasmine_node: {
      options: {
        useHelpers: true
      },
      all: ['spec/']
    },

    // github pages deployment:
    copy: {
      public: {
        files: [
          { expand: true, flatten: true, src: ['dist/*.js'], dest: 'public/' },
          { expand: true, src: ['samples/**'], dest: 'public/' }
        ]
      }
    },
    'gh-pages': {
      options: {
        base: 'public'
      },
      src: ['**']
    },

    clean: ['.grunt/', 'public/']
  });

  grunt.registerTask('test', ['jasmine_node']);
  grunt.registerTask('default', ['jshint', 'test', 'uglify']);

  grunt.registerTask('deploy', ['uglify', 'copy:public', 'gh-pages']);

};
<|endoftext|>


<commit_before>// Generated on 2014-03-23 using generator-angular 0.7.1
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

var path    = require('path'),
    fs      = require('fs');

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);

    var yeoman = {
        // configurable paths
        app: require('./bower.json').appPath || 'app',
        dist: 'dist'
    };

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

        // Project settings
        yeoman: yeoman,

        // Watches files for changes and runs tasks based on the changed files
        watch: {
            js: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
                tasks: ['newer:jshint:all'],
                options: {
                    livereload: true
                }
            },
            jsTest: {
                files: ['test/spec/{,*/}*.js'],
                tasks: ['newer:jshint:test', 'karma']
            },
            compass: {
                files: [
                    "<%= yeoman.app %>/styles/scss/**/{,*/}*.scss",
                    "<%= yeoman.app %>/components/**/{,*/}*.scss",
                    "<%= yeoman.app %>/directives/**/{,*/}*.scss",
                    "<%= yeoman.app %>/pages/**/{,*/}*.scss",
                    "<%= yeoman.app %>/scripts/lib/**/{,*/}*.scss"
                ],
                tasks: ['compass:dev']
            },
            gruntfile: {
                files: ['Gruntfile.js']
            },
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    '<%= yeoman.app %>/{,*/}*.html',
                    '.tmp/styles/{,*/}*.css',
                    '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },

        // The actual grunt server settings
        connect: {
            options: {
                port: 9000,
                // Change this to '0.0.0.0' to access the server from outside.
                hostname: 'localhost',
                livereload: 35729,
                middleware: function (connect, options) {
                    var optBase = (typeof options.base === 'string') ? [options.base] : options.base;
                    return [require('connect-modrewrite')(['!(\\..+)$ / [L]'])].concat(
                        optBase.map(function (path) {
                            return connect.static(path);
                        }));
                }
            },
            livereload: {
                options: {
                    open: true,
                    base: [
                        '.tmp',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            test: {
                options: {
                    port: 9001,
                    base: [
                        '.tmp',
                        'test',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            dist: {
                options: {
                    base: '<%= yeoman.dist %>'
                }
            }
        },

        ngconstant: {
            options: {
                wrap: '"use strict";\n\n <%= __ngModule %>',
                deps: false,
                constants: {
                    env: require('./environments/all')
                },
                space: ' '
            },
            development: [
                {
                    dest: '<%= yeoman.app %>/scripts/config/env/constants.js',
                    name: 'swamp.config',
                    constants: {
                        env: require('./environments/development')
                    }
                }
            ],
            production: [
                {
                    dest: '<%= yeoman.app %>/scripts/config/env/constants.js',
                    name: 'swamp.config',
                    constants: {
                        env: require('./environments/production')
                    }
                }
            ]
        },

        // Make sure code styles are up to par and there are no obvious mistakes
//        jshint: {
//            options: {
//                jshintrc: '.jshintrc',
//                reporter: require('jshint-stylish')
//            },
//            all: [
//                'Gruntfile.js',
//                '<%= yeoman.app %>/scripts/{,*/}*.js'
//            ],
//            test: {
//                options: {
//                    jshintrc: 'test/.jshintrc'
//                },
//                src: ['test/spec/{,*/}*.js']
//            }
//        },

        // Empties folders to start fresh
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            swamp: {
                options: { force: true },
                files: [{
                    dot: true,
                    src: [
                        '../swamp/dashboard/views',
                        '../swamp/dashboard/public'
                    ]
                }]
            },
            server: '.tmp'
        },

        // Add vendor prefixed styles
        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },

        // Automatically inject Bower components into the app
        'bower-install': {
            app: {
                html: '<%= yeoman.app %>/index.html',
                ignorePath: '<%= yeoman.app %>/'
            }
        },

        // Compiles Sass to CSS and generates necessary files if requested
        compass: {
            dev: {
                options: {
                    sassDir: '<%= yeoman.app %>/styles/scss',
                    cssDir: '<%= yeoman.app %>/styles/',
                    specify: ['<%= yeoman.app %>/styles/scss/main.scss', '<%= yeoman.app %>/styles/scss/stream.main.scss']
                }
            },
            dist: {
                options: {
                    generatedImagesDir: '<%= yeoman.dist %>/assets/images/generated',
                    sassDir: '<%= yeoman.app %>/styles/scss',
                    cssDir: '<%= yeoman.app %>/styles/',
                    specify: ['<%= yeoman.app %>/styles/scss/main.scss', '<%= yeoman.app %>/styles/scss/stream.main.scss' ]
                }
            },
            server: {
                options: {
                    debugInfo: true
                }
            }
        },

        // Renames files for browser caching purposes
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                        //'<%= yeoman.dist %>/assets/fonts/*'
                    ]
                }
            }
        },

        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            html: '<%= yeoman.app %>/index.html',
            options: {
                dest: '<%= yeoman.dist %>'
            }
        },

        // Performs rewrites based on rev and the useminPrepare configuration
        usemin: {
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
            options: {
                assetsDirs: ['<%= yeoman.dist %>']
            }
        },

        // The following *-min tasks produce minified files in the dist folder
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg,gif}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        htmlmin: {
            dist: {
                options: {
                    collapseWhitespace: true,
                    collapseBooleanAttributes: true,
                    removeCommentsFromCDATA: true,
                    removeOptionalTags: false
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.dist %>',
                    src: ['*.html', 'pages/{,*/}*.html','components/{,*/}*.html','directives/{,*/}*.html'],
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },

        // Allow the use of non-minsafe AngularJS files. Automatically makes it
        // minsafe compatible so Uglify does not destroy the ng references
        ngmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/concat/scripts',
                    src: '*.js',
                    dest: '.tmp/concat/scripts'
                }]
            }
        },

        // Replace Google CDN references
        cdnify: {
            dist: {
                html: ['<%= yeoman.dist %>/*.html']
            }
        },

        // Copies remaining files to places other tasks can use
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,png,txt}',
                        '*.html',
                        'images/{,*/}*.{webp}',
                        'assets/**/*',
                        'pages/**/*.html',
                        'components/**/*.html',
                        'directives/**/*.html'
                    ]
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: ['generated/*']
                }]
            },
            styles: {
                expand: true,
                cwd: '<%= yeoman.app %>/styles',
                dest: '.tmp/styles/',
                src: '{,*/}*.css'
            },

            // copy the swamp dashboard compiled files into the swamp project
            swamp: (function() {

                var copy_swamp = {};

                if(fs.existsSync('../swamp')) {

                    copy_swamp = {
                        files: [{
                            expand: true,
                            dot: true,
                            cwd: '<%= yeoman.dist %>',
                            dest: '../swamp/dashboard/public/',
                            src: [
                                'scripts/**/*',
                                'styles/**/*',
                                'assets/**/*'
                            ]
                        }, {
                            expand: true,
                            dot: true,
                            cwd: '<%= yeoman.dist %>',
                            dest: '../swamp/dashboard/views/',
                            src: [
                                'index.ejs',
                                'ioStream.ejs'
                            ]
                        }]
                    };

                }

                return copy_swamp;
            })()
        },

        // Run some tasks in parallel to speed up the build process
        concurrent: {
            server: [
                'compass:server'
            ],
            test: [
                'compass'
            ],
            dist: [
                'compass:dist',
                'imagemin',
                'svgmin'
            ]
        },

        // Test settings
        karma: {
            unit: {
                configFile: 'karma.conf.js',
                singleRun: true
            }
        },

        ngtemplates: {
            dest:          {
                src:        ['<%= yeoman.dist %>/pages/**/*.html','<%= yeoman.dist %>/directives/**/*.html','<%= yeoman.dist %>/components/**/*.html'],
                dest:       '<%= yeoman.dist %>/scripts/templates.js',
                options:{
                    bootstrap: function(module, script) {
                        return "app.run(['$templateCache', function($templateCache){ "+ script.replace(/dist\//g,'') + "} ]);"
                    },
                    htmlmin: {
                        collapseBooleanAttributes:      false,
                        collapseWhitespace:             true,
                        removeAttributeQuotes:          true,
                        removeComments:                 true, // Only if you don't use comment directives!
                        removeEmptyAttributes:          false,
                        removeRedundantAttributes:      false,
                        removeScriptTypeAttributes:     false,
                        removeStyleLinkTypeAttributes:  false
                    }
                }
            }
        },

        exec: {
            gitAddSwampDashboardAssets: {
                cwd: '../swamp',
                cmd: 'git add --all -f dashboard/ '
            },

            gitCommitSwampDashboard: {
                cwd: '../swamp',
                cmd: 'git commit dashboard/* -m "Build Dashboard"'
            }
        }
    });

    // creates the .ejs file from the .html
    grunt.registerTask('converthtml', function() {
        var index_html = fs.readFileSync(path.resolve(yeoman.dist, 'index.html'));
        var io_stream = fs.readFileSync(path.resolve(yeoman.dist, 'ioStream.html'));

        fs.writeFileSync(path.resolve(yeoman.dist, 'index.ejs'), index_html);
        fs.writeFileSync(path.resolve(yeoman.dist, 'ioStream.ejs'), io_stream);

    });

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

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

    grunt.registerTask('server', function () {
        grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
        grunt.task.run(['serve']);
    });

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

    grunt.registerTask('build', [
        'clean:dist',
        //'bower-install',
        'ngconstant:production',
        'useminPrepare',
        'concurrent:dist',
        'autoprefixer',
        'concat',
        'ngmin',
        'copy:dist',
        'cdnify',
        'cssmin',
        'uglify',
        'ngtemplates',
        'rev',
        'usemin',
        'htmlmin',
        'converthtml',
        'clean:swamp',
        'copy:swamp',
        'exec:gitAddSwampDashboardAssets',
        'exec:gitCommitSwampDashboard',
        'ngconstant:development'
    ]);

    grunt.registerTask('default', [
        'newer:jshint',
        'test',
        'build'
    ]);
};
<commit_msg>updated usemin to iostream in grunt<commit_after>// Generated on 2014-03-23 using generator-angular 0.7.1
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

var path    = require('path'),
    fs      = require('fs');

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);

    var yeoman = {
        // configurable paths
        app: require('./bower.json').appPath || 'app',
        dist: 'dist'
    };

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

        // Project settings
        yeoman: yeoman,

        // Watches files for changes and runs tasks based on the changed files
        watch: {
            js: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
                tasks: ['newer:jshint:all'],
                options: {
                    livereload: true
                }
            },
            jsTest: {
                files: ['test/spec/{,*/}*.js'],
                tasks: ['newer:jshint:test', 'karma']
            },
            compass: {
                files: [
                    "<%= yeoman.app %>/styles/scss/**/{,*/}*.scss",
                    "<%= yeoman.app %>/components/**/{,*/}*.scss",
                    "<%= yeoman.app %>/directives/**/{,*/}*.scss",
                    "<%= yeoman.app %>/pages/**/{,*/}*.scss",
                    "<%= yeoman.app %>/scripts/lib/**/{,*/}*.scss"
                ],
                tasks: ['compass:dev']
            },
            gruntfile: {
                files: ['Gruntfile.js']
            },
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    '<%= yeoman.app %>/{,*/}*.html',
                    '.tmp/styles/{,*/}*.css',
                    '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },

        // The actual grunt server settings
        connect: {
            options: {
                port: 9000,
                // Change this to '0.0.0.0' to access the server from outside.
                hostname: 'localhost',
                livereload: 35729,
                middleware: function (connect, options) {
                    var optBase = (typeof options.base === 'string') ? [options.base] : options.base;
                    return [require('connect-modrewrite')(['!(\\..+)$ / [L]'])].concat(
                        optBase.map(function (path) {
                            return connect.static(path);
                        }));
                }
            },
            livereload: {
                options: {
                    open: true,
                    base: [
                        '.tmp',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            test: {
                options: {
                    port: 9001,
                    base: [
                        '.tmp',
                        'test',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            dist: {
                options: {
                    base: '<%= yeoman.dist %>'
                }
            }
        },

        ngconstant: {
            options: {
                wrap: '"use strict";\n\n <%= __ngModule %>',
                deps: false,
                constants: {
                    env: require('./environments/all')
                },
                space: ' '
            },
            development: [
                {
                    dest: '<%= yeoman.app %>/scripts/config/env/constants.js',
                    name: 'swamp.config',
                    constants: {
                        env: require('./environments/development')
                    }
                }
            ],
            production: [
                {
                    dest: '<%= yeoman.app %>/scripts/config/env/constants.js',
                    name: 'swamp.config',
                    constants: {
                        env: require('./environments/production')
                    }
                }
            ]
        },

        // Make sure code styles are up to par and there are no obvious mistakes
//        jshint: {
//            options: {
//                jshintrc: '.jshintrc',
//                reporter: require('jshint-stylish')
//            },
//            all: [
//                'Gruntfile.js',
//                '<%= yeoman.app %>/scripts/{,*/}*.js'
//            ],
//            test: {
//                options: {
//                    jshintrc: 'test/.jshintrc'
//                },
//                src: ['test/spec/{,*/}*.js']
//            }
//        },

        // Empties folders to start fresh
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            swamp: {
                options: { force: true },
                files: [{
                    dot: true,
                    src: [
                        '../swamp/dashboard/views',
                        '../swamp/dashboard/public'
                    ]
                }]
            },
            server: '.tmp'
        },

        // Add vendor prefixed styles
        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },

        // Automatically inject Bower components into the app
        'bower-install': {
            app: {
                html: '<%= yeoman.app %>/index.html',
                ignorePath: '<%= yeoman.app %>/'
            }
        },

        // Compiles Sass to CSS and generates necessary files if requested
        compass: {
            dev: {
                options: {
                    sassDir: '<%= yeoman.app %>/styles/scss',
                    cssDir: '<%= yeoman.app %>/styles/',
                    specify: ['<%= yeoman.app %>/styles/scss/main.scss', '<%= yeoman.app %>/styles/scss/stream.main.scss']
                }
            },
            dist: {
                options: {
                    generatedImagesDir: '<%= yeoman.dist %>/assets/images/generated',
                    sassDir: '<%= yeoman.app %>/styles/scss',
                    cssDir: '<%= yeoman.app %>/styles/',
                    specify: ['<%= yeoman.app %>/styles/scss/main.scss', '<%= yeoman.app %>/styles/scss/stream.main.scss' ]
                }
            },
            server: {
                options: {
                    debugInfo: true
                }
            }
        },

        // Renames files for browser caching purposes
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                        //'<%= yeoman.dist %>/assets/fonts/*'
                    ]
                }
            }
        },

        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            html: ['<%= yeoman.app %>/index.html', '<%= yeoman.app %>/ioStream.html'],
            options: {
                dest: '<%= yeoman.dist %>'
            }
        },

        // Performs rewrites based on rev and the useminPrepare configuration
        usemin: {
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
            options: {
                assetsDirs: ['<%= yeoman.dist %>']
            }
        },

        // The following *-min tasks produce minified files in the dist folder
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg,gif}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        htmlmin: {
            dist: {
                options: {
                    collapseWhitespace: true,
                    collapseBooleanAttributes: true,
                    removeCommentsFromCDATA: true,
                    removeOptionalTags: false
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.dist %>',
                    src: ['*.html', 'pages/{,*/}*.html','components/{,*/}*.html','directives/{,*/}*.html'],
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },

        // Allow the use of non-minsafe AngularJS files. Automatically makes it
        // minsafe compatible so Uglify does not destroy the ng references
        ngmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/concat/scripts',
                    src: '*.js',
                    dest: '.tmp/concat/scripts'
                }]
            }
        },

        // Replace Google CDN references
        cdnify: {
            dist: {
                html: ['<%= yeoman.dist %>/*.html']
            }
        },

        // Copies remaining files to places other tasks can use
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,png,txt}',
                        '*.html',
                        'images/{,*/}*.{webp}',
                        'assets/**/*',
                        'pages/**/*.html',
                        'components/**/*.html',
                        'directives/**/*.html'
                    ]
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: ['generated/*']
                }]
            },
            styles: {
                expand: true,
                cwd: '<%= yeoman.app %>/styles',
                dest: '.tmp/styles/',
                src: '{,*/}*.css'
            },

            // copy the swamp dashboard compiled files into the swamp project
            swamp: (function() {

                var copy_swamp = {};

                if(fs.existsSync('../swamp')) {

                    copy_swamp = {
                        files: [{
                            expand: true,
                            dot: true,
                            cwd: '<%= yeoman.dist %>',
                            dest: '../swamp/dashboard/public/',
                            src: [
                                'scripts/**/*',
                                'styles/**/*',
                                'assets/**/*'
                            ]
                        }, {
                            expand: true,
                            dot: true,
                            cwd: '<%= yeoman.dist %>',
                            dest: '../swamp/dashboard/views/',
                            src: [
                                'index.ejs',
                                'ioStream.ejs'
                            ]
                        }]
                    };

                }

                return copy_swamp;
            })()
        },

        // Run some tasks in parallel to speed up the build process
        concurrent: {
            server: [
                'compass:server'
            ],
            test: [
                'compass'
            ],
            dist: [
                'compass:dist',
                'imagemin',
                'svgmin'
            ]
        },

        // Test settings
        karma: {
            unit: {
                configFile: 'karma.conf.js',
                singleRun: true
            }
        },

        ngtemplates: {
            dest:          {
                src:        ['<%= yeoman.dist %>/pages/**/*.html','<%= yeoman.dist %>/directives/**/*.html','<%= yeoman.dist %>/components/**/*.html'],
                dest:       '<%= yeoman.dist %>/scripts/templates.js',
                options:{
                    bootstrap: function(module, script) {
                        return "app.run(['$templateCache', function($templateCache){ "+ script.replace(/dist\//g,'') + "} ]);"
                    },
                    htmlmin: {
                        collapseBooleanAttributes:      false,
                        collapseWhitespace:             true,
                        removeAttributeQuotes:          true,
                        removeComments:                 true, // Only if you don't use comment directives!
                        removeEmptyAttributes:          false,
                        removeRedundantAttributes:      false,
                        removeScriptTypeAttributes:     false,
                        removeStyleLinkTypeAttributes:  false
                    }
                }
            }
        },

        exec: {
            gitAddSwampDashboardAssets: {
                cwd: '../swamp',
                cmd: 'git add --all -f dashboard/ '
            },

            gitCommitSwampDashboard: {
                cwd: '../swamp',
                cmd: 'git commit dashboard/* -m "Build Dashboard"'
            }
        }
    });

    // creates the .ejs file from the .html
    grunt.registerTask('converthtml', function() {
        var index_html = fs.readFileSync(path.resolve(yeoman.dist, 'index.html'));
        var io_stream = fs.readFileSync(path.resolve(yeoman.dist, 'ioStream.html'));

        fs.writeFileSync(path.resolve(yeoman.dist, 'index.ejs'), index_html);
        fs.writeFileSync(path.resolve(yeoman.dist, 'ioStream.ejs'), io_stream);

    });

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

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

    grunt.registerTask('server', function () {
        grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
        grunt.task.run(['serve']);
    });

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

    grunt.registerTask('build', [
        'clean:dist',
        //'bower-install',
        'ngconstant:production',
        'useminPrepare',
        'concurrent:dist',
        'autoprefixer',
        'concat',
        'ngmin',
        'copy:dist',
        'cdnify',
        'cssmin',
        'uglify',
        'ngtemplates',
        'rev',
        'usemin',
        'htmlmin',
        'converthtml',
        'clean:swamp',
        'copy:swamp',
        'exec:gitAddSwampDashboardAssets',
        'exec:gitCommitSwampDashboard',
        'ngconstant:development'
    ]);

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