<commit_before>// Generated on 2015-07-11 using generator-angular 0.12.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'

module.exports = function (grunt) {

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

  // Automatically load required Grunt tasks
  require('jit-grunt')(grunt, {
    useminPrepare: 'grunt-usemin',
    ngtemplates: 'grunt-angular-templates',
    cdnify: 'grunt-google-cdn'
  });

  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-build-control');

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

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

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    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']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer:server']
      },
      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: '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().use(
                '/app/styles',
                connect.static('./app/styles')
              ),
              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 %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    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']
      }
    },

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

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

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      test: {
        devDependencies: true,
        src: '<%= karma.unit.configFile %>',
        ignorePath:  /\.\.\//,
        fileTypes:{
          js: {
            block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
              detect: {
                js: /'(.*\.js)'/gi
              },
              replace: {
                js: '\'{{filePath}}\','
              }
            }
          }
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

    // 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: './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 %>/images/generated'
        }
      },
      server: {
        options: {
          sourcemap: false
        }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/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 %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
      options: {
        assetsDirs: [
          '<%= yeoman.dist %>',
          '<%= yeoman.dist %>/images',
          '<%= yeoman.dist %>/styles'
        ],
        patterns: {
          js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']]
        }
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // 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'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    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,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    ngtemplates: {
      dist: {
        options: {
          module: 'dc15App',
          htmlmin: '<%= htmlmin.dist.options %>',
          usemin: 'scripts/scripts.js'
        },
        cwd: '<%= yeoman.app %>',
        src: 'views/{,*/}*.html',
        dest: '.tmp/templateCache.js'
      }
    },

    // ng-annotate tries to make the code safe for minification automatically
    // by using the Angular long form for dependency injection.
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

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

    uglify: {
      my_target: {
        files: [{
          expand: true,
          cwd: 'src/js',
          src: '**/*.js',
          dest: 'dest/js'
        }]
      }
    },

    // 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}',
            '.htaccess',
            '*.html',
            'images/{,*/}*.{webp}',
            'img/*',
            'js/*',
            'styles/fonts/{,*/}*.*'
          ]
        },
        {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        },
        {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        },
          {
            expand: true,
            cwd: 'bower_components/font-awesome/fonts/',
            src: ['*.*'],
            dest: '<%= yeoman.dist %>/fonts'
          }
        ]
      },
      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'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    buildcontrol: {
      dist: {
        options: {
          remote: 'git@github.com:DrupalHub/dcamp15.git',
          branch: 'gh-pages',
          commit: true,
          push: true
        }
      }
    },

    // Test settings
    karma: {
      unit: {
        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:server',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

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

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    //'autoprefixer',
    //'ngtemplates',
    //'concat',
    'ngAnnotate',
    'copy:dist',
    //'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);

  grunt.registerTask('deploy', ['buildcontrol']);
};
<commit_msg>Commit changes.<commit_after>// Generated on 2015-07-11 using generator-angular 0.12.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'

module.exports = function (grunt) {

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

  // Automatically load required Grunt tasks
  require('jit-grunt')(grunt, {
    useminPrepare: 'grunt-usemin',
    ngtemplates: 'grunt-angular-templates',
    cdnify: 'grunt-google-cdn'
  });

  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-build-control');

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

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

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    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']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer:server']
      },
      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: '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().use(
                '/app/styles',
                connect.static('./app/styles')
              ),
              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 %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    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']
      }
    },

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

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

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      test: {
        devDependencies: true,
        src: '<%= karma.unit.configFile %>',
        ignorePath:  /\.\.\//,
        fileTypes:{
          js: {
            block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
              detect: {
                js: /'(.*\.js)'/gi
              },
              replace: {
                js: '\'{{filePath}}\','
              }
            }
          }
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

    // 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: './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 %>/images/generated'
        }
      },
      server: {
        options: {
          sourcemap: false
        }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/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 %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
      options: {
        assetsDirs: [
          '<%= yeoman.dist %>',
          '<%= yeoman.dist %>/images',
          '<%= yeoman.dist %>/styles'
        ],
        patterns: {
          js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']]
        }
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // 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'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    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,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    ngtemplates: {
      dist: {
        options: {
          module: 'dc15App',
          htmlmin: '<%= htmlmin.dist.options %>',
          usemin: 'scripts/scripts.js'
        },
        cwd: '<%= yeoman.app %>',
        src: 'views/{,*/}*.html',
        dest: '.tmp/templateCache.js'
      }
    },

    // ng-annotate tries to make the code safe for minification automatically
    // by using the Angular long form for dependency injection.
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

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

    uglify: {
      my_target: {
        files: [{
          expand: true,
          cwd: 'src/js',
          src: '**/*.js',
          dest: 'dest/js'
        }]
      }
    },

    // 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}',
            '.htaccess',
            '*.html',
            'images/{,*/}*.{webp}',
            'img/*',
            'js/*',
            'styles/fonts/{,*/}*.*'
          ]
        },
        {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        },
        {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        },
          {
            expand: true,
            cwd: 'bower_components/font-awesome/fonts/',
            src: ['*.*'],
            dest: '<%= yeoman.dist %>/fonts'
          }
        ]
      },
      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'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    buildcontrol: {
      dist: {
        options: {
          remote: 'git@github.com:DrupalHub/dcamp15.git',
          branch: 'gh-pages',
          commit: true,
          push: true
        }
      }
    },

    // Test settings
    karma: {
      unit: {
        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:server',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

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

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    //'autoprefixer',
    //'ngtemplates',
    //'concat',
    'ngAnnotate',
    'copy:dist',
    //'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);

  grunt.registerTask('deploy', ['build','buildcontrol']);
};
<|endoftext|>


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

    /**
     * Load required Grunt tasks. These are installed based on the versions listed
     * in `package.json` when you do `npm install` in this directory.
     */
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-ngmin');

    /**
     * Load in our build configuration file.
     */
    var userConfig = require('./build.config.js');

    /**
     * This is the configuration object Grunt uses to give each plugin its
     * instructions.
     */
    var taskConfig = {
        /**
         * We read in our `package.json` file so we can access the package name and
         * version. It's already there, so we don't repeat ourselves here.
         */
        pkg: grunt.file.readJSON("package.json"),

        /**
         * The directories to delete when `grunt clean` is executed.
         */
        clean: [
            '<%= build_dir %>'
        ],

        /**
         * The `copy` task just copies files from A to B. We use it here to copy
         * our project assets (images, fonts, etc.) and javascripts into
         * `build_dir`, and then to copy the assets to `compile_dir`.
         */
        copy: {
            build_app_assets: {
                files: [
                    {
                        src: [ '**' ],
                        dest: '<%= build_dir %>/assets/',
                        cwd: 'src/assets',
                        expand: true
                    }
                ]
            },
            build_app_tpl: {
                files: [
                    {
                        src: [ '<%= app_files.tpl %>' ],
                        dest: '<%= build_dir %>/pages/',
                        cwd: '.',
                        expand: true,
                        flatten: true
                    }
                ]
            },
            build_bower_assets: {
                files: [
                    {
                        src: [ '<%= bower_files.assets %>' ],
                        dest: '<%= build_dir %>/assets/',
                        cwd: '.',
                        expand: true,
                        flatten: true
                    }
                ]
            },
            build_appjs: {
                files: [
                    {
                        src: [ '<%= app_files.js %>' ],
                        dest: '<%= build_dir %>/js',
                        cwd: '.',
                        expand: true,
                        flatten: true
                    }
                ]
            },
            build_bowerjs: {
                files: [
                    {
                        src: [ '<%= bower_files.js %>','<%= bower_files.css %>' ],
                        dest: '<%= build_dir %>/',
                        cwd: '.',
                        expand: true
                    }
                ]
            }
        },

        /**
         * `ng-min` annotates the sources before minifying. That is, it allows us
         * to code without the array syntax.
         */
        ngmin: {
            compile: {
                files: [
                    {
                        src: [ '<%= app_files.js %>' ],
                        cwd: '<%= build_dir %>',
                        dest: '<%= build_dir %>',
                        expand: true
                    }
                ]
            }
        },

        /**
         * `jshint` defines the rules of our linter as well as which files we
         * should check. This file, all javascript sources, and all our unit tests
         * are linted based on the policies listed in `options`. But we can also
         * specify exclusionary patterns by prefixing them with an exclamation
         * point (!); this is useful when code comes from a third party but is
         * nonetheless inside `src/`.
         */
        jshint: {
            src: [
                '<%= app_files.js %>'
            ],
            options: {
                bitwise: true,
                curly: true,
                eqeqeq: true,
                eqnull: true,
                evil: true,
                forin: true,
                globalstrict: true,
                immed: true,
                latedef: false,
                newcap: true,
                noarg: true,
                noempty: true,
                nonew: true,
                trailing: true,
                undef: true,
                unused: true,

                camelcase: true,
                indent: 4,
                quotmark: 'single',

                '-W055': true,
                '-W098': true,
                '-W116': true,

                globals: {
                    angular: false,
                    module: false,
                    $: false,
                    window: false,
                    console: false,
                    confirm: false
                }
            }
        },

        /**
         * The `index` task compiles the `index.html` file as a Grunt template. CSS
         * and JS files co-exist here but they get split apart later.
         */
        index: {

            /**
             * During development, we don't want to have wait for compilation,
             * concatenation, minification, etc. So to avoid these steps, we simply
             * add all script files directly to the `<head>` of `index.html`. The
             * `src` property contains the list of included files.
             */
            build: {
                dir: '<%= build_dir %>',
                src: [
                    '<%= bower_files.js %>',
                    '<%= build_dir %>/js/**/*.js',
                    '<%= bower_files.css %>',
                ]
            }
        },

        /**
         * And for rapid development, we have a watch set up that checks to see if
         * any of the files listed below change, and then to execute the listed
         * tasks when they do. This just saves us from having to type "grunt" into
         * the command-line every time we want to see what we're working on; we can
         * instead just leave "grunt watch" running in a background terminal. Set it
         * and forget it, as Ron Popeil used to tell us.
         *
         * But we don't need the same thing to happen for all the files.
         */
        delta: {
            /**
             * By default, we want the Live Reload to work for all tasks; this is
             * overridden in some tasks (like this file) where browser resources are
             * unaffected. It runs by default on port 35729, which your browser
             * plugin should auto-detect.
             */
            options: {
                livereload: true
            },

            /**
             * When the Gruntfile changes, we just want to lint it. In fact, when
             * your Gruntfile changes, it will automatically be reloaded!
             */
            gruntfile: {
                files: 'Gruntfile.js',
                tasks: [ 'jshint:gruntfile' ],
                options: {
                    livereload: false
                }
            },

            /**
             * When our JavaScript source files change, we want to run lint them and
             * run our unit tests.
             */
            jssrc: {
                files: [
                    '<%= app_files.js %>'
                ],
                tasks: [ 'jshint:src', 'copy:build_appjs' ]
            },

            /**
             * When assets are changed, copy them. Note that this will *not* copy new
             * files, so this is probably not very useful.
             */
            assets: {
                files: [
                    'src/assets/**/*'
                ],
                tasks: [ 'copy:build_app_assets', 'copy:build_bower_assets' ]
            },

            /**
             * When index.html changes, we need to compile it.
             */
            html: {
                files: [ '<%= app_files.html %>' ],
                tasks: [ 'index:build' ]
            },
        }
    };

    grunt.initConfig(grunt.util._.extend(taskConfig, userConfig));

    /**
     * In order to make it safe to just compile or copy *only* what was changed,
     * we need to ensure we are starting from a clean, fresh build. So we rename
     * the `watch` task to `delta` (that's why the configuration var above is
     * `delta`) and then add a new task called `watch` that does a clean build
     * before watching for changes.
     */
    grunt.renameTask('watch', 'delta');
    grunt.registerTask('watch', [ 'build', 'delta' ]);

    /**
     * The default task is to build and compile.
     */
    grunt.registerTask('default', [ 'build']);

    /**
     * The `build` task gets your app ready to run for development and testing.
     */
    grunt.registerTask('build', [
        'clean', 'jshint',
        'copy:build_app_assets', 'copy:build_bower_assets', 'copy:build_app_tpl',
        'copy:build_appjs', 'ngmin', 'copy:build_bowerjs', 'index:build'
    ]);

    /**
     * A utility function to get all app JavaScript sources.
     */
    function filterForJS(files) {
        return files.filter(function (file) {
            return file.match(/\.js$/);
        });
    }

    /**
     * A utility function to get all app CSS sources.
     */
    function filterForCSS(files) {
        return files.filter(function (file) {
            return file.match(/\.css$/);
        });
    }

    /**
     * The index.html template includes the stylesheet and javascript sources
     * based on dynamic names calculated in this Gruntfile. This task assembles
     * the list into variables for the template to use and then runs the
     * compilation.
     */
    grunt.registerMultiTask('index', 'Process index.html template', function () {
        var dirRE = new RegExp('^(' + grunt.config('build_dir') + '|' + grunt.config('compile_dir') + ')\/', 'g');
        var jsFiles = filterForJS(this.filesSrc).map(function (file) {
            return file.replace(dirRE, '');
        });
        var cssFiles = filterForCSS(this.filesSrc).map(function (file) {
            return file.replace(dirRE, '');
        });

        grunt.file.copy('src/index.html', this.data.dir + '/index.html', {
            process: function (contents, path) {
                return grunt.template.process(contents, {
                    data: {
                        scripts: jsFiles,
                        styles: cssFiles,
                        version: grunt.config('pkg.version')
                    }
                });
            }
        });
    });
};
<commit_msg>typos<commit_after>module.exports = function (grunt) {

    /**
     * Load required Grunt tasks. These are installed based on the versions listed
     * in `package.json` when you do `npm install` in this directory.
     */
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-ngmin');

    /**
     * Load in our build configuration file.
     */
    var userConfig = require('./build.config.js');

    /**
     * This is the configuration object Grunt uses to give each plugin its
     * instructions.
     */
    var taskConfig = {
        /**
         * We read in our `package.json` file so we can access the package name and
         * version. It's already there, so we don't repeat ourselves here.
         */
        pkg: grunt.file.readJSON("package.json"),

        /**
         * The directories to delete when `grunt clean` is executed.
         */
        clean: [
            '<%= build_dir %>'
        ],

        /**
         * The `copy` task just copies files from A to B. We use it here to copy
         * our project assets (images, fonts, etc.) and javascripts into
         * `build_dir`, and then to copy the assets to `compile_dir`.
         */
        copy: {
            build_app_assets: {
                files: [
                    {
                        src: [ '**' ],
                        dest: '<%= build_dir %>/assets/',
                        cwd: 'src/assets',
                        expand: true
                    }
                ]
            },
            build_app_tpl: {
                files: [
                    {
                        src: [ '<%= app_files.tpl %>' ],
                        dest: '<%= build_dir %>/pages/',
                        cwd: '.',
                        expand: true,
                        flatten: true
                    }
                ]
            },
            build_bower_assets: {
                files: [
                    {
                        src: [ '<%= bower_files.assets %>' ],
                        dest: '<%= build_dir %>/assets/',
                        cwd: '.',
                        expand: true,
                        flatten: true
                    }
                ]
            },
            build_appjs: {
                files: [
                    {
                        src: [ '<%= app_files.js %>' ],
                        dest: '<%= build_dir %>/js',
                        cwd: '.',
                        expand: true,
                        flatten: true
                    }
                ]
            },
            build_bowerjs: {
                files: [
                    {
                        src: [ '<%= bower_files.js %>','<%= bower_files.css %>' ],
                        dest: '<%= build_dir %>/',
                        cwd: '.',
                        expand: true
                    }
                ]
            }
        },

        /**
         * `ng-min` annotates the sources before minifying. That is, it allows us
         * to code without the array syntax.
         */
        ngmin: {
            compile: {
                files: [
                    {
                        src: [ '<%= app_files.js %>' ],
                        cwd: '<%= build_dir %>',
                        dest: '<%= build_dir %>',
                        expand: true
                    }
                ]
            }
        },

        /**
         * `jshint` defines the rules of our linter as well as which files we
         * should check. This file, all javascript sources, and all our unit tests
         * are linted based on the policies listed in `options`. But we can also
         * specify exclusionary patterns by prefixing them with an exclamation
         * point (!); this is useful when code comes from a third party but is
         * nonetheless inside `src/`.
         */
        jshint: {
            src: [
                '<%= app_files.js %>'
            ],
            options: {
                bitwise: true,
                curly: true,
                eqeqeq: true,
                eqnull: true,
                evil: true,
                forin: true,
                globalstrict: true,
                immed: true,
                latedef: false,
                newcap: true,
                noarg: true,
                noempty: true,
                nonew: true,
                trailing: true,
                undef: true,
                unused: true,

                camelcase: true,
                indent: 4,
                quotmark: 'single',

                '-W055': true,
                '-W098': true,
                '-W116': true,

                globals: {
                    angular: false,
                    module: false,
                    $: false,
                    window: false,
                    console: false,
                    confirm: false
                }
            }
        },

        /**
         * The `index` task compiles the `index.html` file as a Grunt template. CSS
         * and JS files co-exist here but they get split apart later.
         */
        index: {

            /**
             * During development, we don't want to have wait for compilation,
             * concatenation, minification, etc. So to avoid these steps, we simply
             * add all script files directly to the `<head>` of `index.html`. The
             * `src` property contains the list of included files.
             */
            build: {
                dir: '<%= build_dir %>',
                src: [
                    '<%= bower_files.js %>',
                    '<%= build_dir %>/js/**/*.js',
                    '<%= bower_files.css %>'
                ]
            }
        },

        /**
         * And for rapid development, we have a watch set up that checks to see if
         * any of the files listed below change, and then to execute the listed
         * tasks when they do. This just saves us from having to type "grunt" into
         * the command-line every time we want to see what we're working on; we can
         * instead just leave "grunt watch" running in a background terminal. Set it
         * and forget it, as Ron Popeil used to tell us.
         *
         * But we don't need the same thing to happen for all the files.
         */
        delta: {
            /**
             * By default, we want the Live Reload to work for all tasks; this is
             * overridden in some tasks (like this file) where browser resources are
             * unaffected. It runs by default on port 35729, which your browser
             * plugin should auto-detect.
             */
            options: {
                livereload: true
            },

            /**
             * When the Gruntfile changes, we just want to lint it. In fact, when
             * your Gruntfile changes, it will automatically be reloaded!
             */
            gruntfile: {
                files: 'Gruntfile.js',
                tasks: [ 'jshint:gruntfile' ],
                options: {
                    livereload: false
                }
            },

            /**
             * When our JavaScript source files change, we want to run lint them and
             * run our unit tests.
             */
            jssrc: {
                files: [
                    '<%= app_files.js %>'
                ],
                tasks: [ 'jshint:src', 'copy:build_appjs' ]
            },

            /**
             * When assets are changed, copy them. Note that this will *not* copy new
             * files, so this is probably not very useful.
             */
            assets: {
                files: [
                    'src/assets/**/*'
                ],
                tasks: [ 'copy:build_app_assets', 'copy:build_bower_assets' ]
            },

            /**
             * When index.html changes, we need to compile it.
             */
            html: {
                files: [ '<%= app_files.html %>' ],
                tasks: [ 'index:build' ]
            }
        }
    };

    grunt.initConfig(grunt.util._.extend(taskConfig, userConfig));

    /**
     * In order to make it safe to just compile or copy *only* what was changed,
     * we need to ensure we are starting from a clean, fresh build. So we rename
     * the `watch` task to `delta` (that's why the configuration var above is
     * `delta`) and then add a new task called `watch` that does a clean build
     * before watching for changes.
     */
    grunt.renameTask('watch', 'delta');
    grunt.registerTask('watch', [ 'build', 'delta' ]);

    /**
     * The default task is to build and compile.
     */
    grunt.registerTask('default', [ 'build']);

    /**
     * The `build` task gets your app ready to run for development and testing.
     */
    grunt.registerTask('build', [
        'clean', 'jshint',
        'copy:build_app_assets', 'copy:build_bower_assets', 'copy:build_app_tpl',
        'copy:build_appjs', 'ngmin', 'copy:build_bowerjs', 'index:build'
    ]);

    /**
     * A utility function to get all app JavaScript sources.
     */
    function filterForJS(files) {
        return files.filter(function (file) {
            return file.match(/\.js$/);
        });
    }

    /**
     * A utility function to get all app CSS sources.
     */
    function filterForCSS(files) {
        return files.filter(function (file) {
            return file.match(/\.css$/);
        });
    }

    /**
     * The index.html template includes the stylesheet and javascript sources
     * based on dynamic names calculated in this Gruntfile. This task assembles
     * the list into variables for the template to use and then runs the
     * compilation.
     */
    grunt.registerMultiTask('index', 'Process index.html template', function () {
        var dirRE = new RegExp('^(' + grunt.config('build_dir') + '|' + grunt.config('compile_dir') + ')\/', 'g');
        var jsFiles = filterForJS(this.filesSrc).map(function (file) {
            return file.replace(dirRE, '');
        });
        var cssFiles = filterForCSS(this.filesSrc).map(function (file) {
            return file.replace(dirRE, '');
        });

        grunt.file.copy('src/index.html', this.data.dir + '/index.html', {
            process: function (contents, path) {
                return grunt.template.process(contents, {
                    data: {
                        scripts: jsFiles,
                        styles: cssFiles,
                        version: grunt.config('pkg.version')
                    }
                });
            }
        });
    });
};
<|endoftext|>


<commit_before>/*
 * grunt-glob-html
 * https://github.com/gevgeny/grunt-glob-html
 *
 * Copyright (c) 2014 Eugene Gluhotorenko
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({
        jshint: {
            all: [
                'Gruntfile.js', 'tasks/*.js'
            ],
            options: {
                jshintrc: '.jshintrc'
            }
        },

        // Before generating any new files, remove any previously-created files.
        clean: {
            tests: ['test/tmp']
        },

        // Configuration to be run (and then tested).
        globhtml: {
            oneSrc: {
                src: 'test/examples/content.html',
                dest: 'test/tmp/one-src/content.html'
            },
            multipleSrc: {
                src: 'test/examples/*.html',
                dest: 'test/tmp/multiple-src/'
            },
            customBase: {
                src: 'test/examples-custom-base/content.html',
                dest: 'test/tmp/custom-base/content.html',
                base: 'test/examples'
            }
        },

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

    // Actually load this plugin's task(s).
    grunt.loadTasks('tasks');

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');
    grunt.loadNpmTasks('grunt-mocha-test');

    // Whenever the "test" task is run, first clean the "tmp" dir, then run this
    // plugin's task(s), then test the result.
    grunt.registerTask('test', ['clean', 'globhtml', 'mochaTest']);

    // By default, lint and run all tests.
    grunt.registerTask('default', ['jshint', 'test']);

};
<commit_msg>change build to run jslint every time<commit_after>/*
 * grunt-glob-html
 * https://github.com/gevgeny/grunt-glob-html
 *
 * Copyright (c) 2014 Eugene Gluhotorenko
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({
        jshint: {
            all: [
                'Gruntfile.js', 'tasks/*.js'
            ],
            options: {
                jshintrc: '.jshintrc'
            }
        },

        // Before generating any new files, remove any previously-created files.
        clean: {
            tests: ['test/tmp']
        },

        // Configuration to be run (and then tested).
        globhtml: {
            oneSrc: {
                src: 'test/examples/content.html',
                dest: 'test/tmp/one-src/content.html'
            },
            multipleSrc: {
                src: 'test/examples/*.html',
                dest: 'test/tmp/multiple-src/'
            },
            customBase: {
                src: 'test/examples-custom-base/content.html',
                dest: 'test/tmp/custom-base/content.html',
                base: 'test/examples'
            }
        },

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

    // Actually load this plugin's task(s).
    grunt.loadTasks('tasks');

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');
    grunt.loadNpmTasks('grunt-mocha-test');

    grunt.registerTask('default', ['jshint', 'clean', 'globhtml', 'mochaTest']);

};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {
  var srcFiles = [
    'Gruntfile.js',
    'app.js',
    'server.js',
    'api_modules/*.js',
    'tests/*.js',
    'schemas/*.js',
    'include/*.js',
    'shared/*.js'
  ];

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jsbeautifier: {
      files: srcFiles,
      options: {
        js: {
          braceStyle: 'collapse',
          breakChainedMethods: true,
          e4x: true,
          evalCode: false,
          indentChar: ' ',
          indentLevel: 0,
          indentSize: 2,
          indentWithTabs: false,
          jslintHappy: true,
          keepArrayIndentation: false,
          keepFunctionIndentation: false,
          maxPreserveNewlines: 10,
          preserveNewlines: true,
          spaceBeforeConditional: true,
          spaceInParen: false,
          unescapeStrings: false,
          wrapLineLength: 80,
          goodStuff: true

        }
      }
    },
    jshint: {
      files: srcFiles,
      options: {
        bitwise: true,
        curly: true,
        eqeqeq: true,
        immed: true,
        indent: 2,
        latedef: true,
        newcap: true,
        noarg: true,
        nonew: true,
        quotmark: 'single',
        undef: true,
        unused: false,
        strict: true,
        globalstrict: false,
        trailing: true,
        maxlen: 80,
        globals: {
          describe: true, // mocha
          it: true //mocha
        },
        node: true,
        devel: true,

      }
    },
    mochaTest: {
      test: {
        options: {
          reporter: 'spec',
          bail: true,
          colors: true,
          timeout: 30000
        },
        src: [
          'tests/utils.test.js',
          'tests/controlValidation.test.js',
          'tests/userApi.test.js',
          'tests/projectApi.test.js',
          'tests/deviceApi.test.js',
          'tests/profileApi.test.js'
        ]
      }
    },
    browserify: {
      options: {
        debug: true,
        //transform: ['reactify'],
        //extensions: ['.jsx'],
      },
      dev: {
        //options: {
        //  alias: ['react:']  // Make React available externally for dev tools
        //},
        src: ['client/authModule.js','client/dashboardModule.js'],
        dest: 'public/js/bundle.js'
      },
      //production: {
      //  options: {
      //    debug: false
      //  },
      //  src: '<%= browserify.dev.src %>',
      //  dest: 'build/bundle.js'
      //}
    },
    less: {
      development: {
        options: {
        },
        files: {
          "public/css/kube.css": "public/less/kube.less",
          "public/css/auth.css": "public/less/auth.less",
          "public/css/dashboard.css": "public/less/dashboard.less",
        }
      }
    },
    watch: {
      less: {
        files: ['public/less/**/*.less'],
        tasks: ['less'],
      },
      clientCode: {
        files: ['client/*.js'],
        tasks: ['browserify'],
      },
    },
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-jsbeautifier');
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-less');

  grunt.registerTask('test', ['mochaTest']);
  grunt.registerTask('compile', ['less', 'browserify']);
  grunt.registerTask('all', [ 'less', 'jsbeautifier', 'jshint',
    'mochaTest', 'browserify'
  ]);
  grunt.registerTask('default', ['jsbeautifier', 'jshint',
    'browserify']);
  grunt.registerTask('lint', ['jsbeautifier', 'jshint']);

};
<commit_msg>Fixed wrong quotation marks in Gruntfile.<commit_after>'use strict';

module.exports = function (grunt) {
  var srcFiles = [
    'Gruntfile.js',
    'app.js',
    'server.js',
    'api_modules/*.js',
    'tests/*.js',
    'schemas/*.js',
    'include/*.js',
    'shared/*.js'
  ];

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jsbeautifier: {
      files: srcFiles,
      options: {
        js: {
          braceStyle: 'collapse',
          breakChainedMethods: true,
          e4x: true,
          evalCode: false,
          indentChar: ' ',
          indentLevel: 0,
          indentSize: 2,
          indentWithTabs: false,
          jslintHappy: true,
          keepArrayIndentation: false,
          keepFunctionIndentation: false,
          maxPreserveNewlines: 10,
          preserveNewlines: true,
          spaceBeforeConditional: true,
          spaceInParen: false,
          unescapeStrings: false,
          wrapLineLength: 80,
          goodStuff: true

        }
      }
    },
    jshint: {
      files: srcFiles,
      options: {
        bitwise: true,
        curly: true,
        eqeqeq: true,
        immed: true,
        indent: 2,
        latedef: true,
        newcap: true,
        noarg: true,
        nonew: true,
        quotmark: 'single',
        undef: true,
        unused: false,
        strict: true,
        globalstrict: false,
        trailing: true,
        maxlen: 80,
        globals: {
          describe: true, // mocha
          it: true //mocha
        },
        node: true,
        devel: true,

      }
    },
    mochaTest: {
      test: {
        options: {
          reporter: 'spec',
          bail: true,
          colors: true,
          timeout: 30000
        },
        src: [
          'tests/utils.test.js',
          'tests/controlValidation.test.js',
          'tests/userApi.test.js',
          'tests/projectApi.test.js',
          'tests/deviceApi.test.js',
          'tests/profileApi.test.js'
        ]
      }
    },
    browserify: {
      options: {
        debug: true,
        //transform: ['reactify'],
        //extensions: ['.jsx'],
      },
      dev: {
        //options: {
        //  alias: ['react:']  // Make React available externally for dev tools
        //},
        src: ['client/authModule.js', 'client/dashboardModule.js'],
        dest: 'public/js/bundle.js'
      },
      //production: {
      //  options: {
      //    debug: false
      //  },
      //  src: '<%= browserify.dev.src %>',
      //  dest: 'build/bundle.js'
      //}
    },
    less: {
      development: {
        options: {},
        files: {
          'public/css/kube.css': 'public/less/kube.less',
          'public/css/auth.css': 'public/less/auth.less',
          'public/css/dashboard.css': 'public/less/dashboard.less',
        }
      }
    },
    watch: {
      less: {
        files: ['public/less/**/*.less'],
        tasks: ['less'],
      },
      clientCode: {
        files: ['client/*.js'],
        tasks: ['browserify'],
      },
    },
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-jsbeautifier');
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-less');

  grunt.registerTask('test', ['mochaTest']);
  grunt.registerTask('compile', ['less', 'browserify']);
  grunt.registerTask('all', ['less', 'jsbeautifier', 'jshint',
    'mochaTest', 'browserify'
  ]);
  grunt.registerTask('default', ['jsbeautifier', 'jshint',
    'browserify'
  ]);
  grunt.registerTask('lint', ['jsbeautifier', 'jshint']);

};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
    grunt.initConfig({
        //Less Comilation Options
        less: {
            development: {
                options: {
                    paths: ["assets/css"]
                },
                files: {
                    "assets/css/bootstrap.css": "assets/less/bootstrap/bootstrap.less",
                    "assets/css/stylesheet.css": "assets/less/stylesheet.less",
                }
            }
        },
        postcss: {
            options: {
                map: {
                    inline: false, // save all sourcemaps as separate files...
                    annotation: 'assets/css/maps' // ...to the specified directory
                },
                // safe: true,
                processors: [
                    require('pixrem')(), // add fallbacks for rem units
                    require('autoprefixer-core')({
                        browsers: 'last 2 versions'
                    }), // add vendor prefixes
                    require('cssnano')(), // minify the result
                    require('cssnext')() // Plugins to use future CSS features now by adding backwards compatibility css processing
                ]
            },
            dist: {
                files: {
                    "pqr/static/css/pqr.min.css": ['assets/css/pqr.css']
                }
            }
        },
        concat: {
            options: {
                // define a string to put between each file in the concatenated output
                separator: ';\n'
            },
            js: {
                // the files to concatenate (modernizr, then jquery, then bootstrap, then everythign else)
                src: ['assets/js/modernizr/**/*.js', 'assets/js/jquery/**/*.js', 'assets/js/bootstrap/**/*.js', 'assets/js/helpers/**/*.js', 'assets/js/pqr/pqr.js', 'assets/js/pqr/config.js', 'assets/js/**/*.js'],
                // the location of the resulting JS file
                dest: 'pqr/static/js/pqr.js'
            },
            css: {
                //
                src: ['assets/css/bootstrap.css', 'assets/css/**/*.css', '!assets/css/maps', '!assets/css/pqr.css'],
                // the location of the resulting CSS file
                dest: 'assets/css/pqr.css'
            }
        },
        uglify: {
            prod: {
                options: {
                    // define a string to put between each file in the concatenated output
                    banner: '/*! PQR PROD JavaScript Combined and minified on <%= grunt.template.today("dd-mm-yyyy") %> */\n',
                    compress: {
                        drop_console: true, //Don't display any console output for production
                    }
                },
                files: {
                    "pqr/static/js/pqr.min.js": ['pqr/static/js/pqr.js']
                }
            },
            dev: {
                options: {
                    // define a string to put between each file in the concatenated output
                    banner: '/*! PQR DEV JavaScript Combined and minified on <%= grunt.template.today("dd-mm-yyyy") %> */\n',
                    compress: {},
                    beautify: true
                },
                files: {
                    "pqr/static/js/pqr.min.js": ['pqr/static/js/pqr.js']
                }
            }
        },
        focus:{ //Only Run a subset of watch events for production or dev
            dev:{
                include: ['styles_dev', 'scripts_dev', 'configFiles']
            },
            prod:{
                include: ['styles_prod', 'scripts_prod', 'configFiles']
            }
        },
        watch: { //Which folders to watch for changes and run only the tasks required
            styles_prod: {
                files: ['assets/less/**/*.less'],
                tasks: ['less', 'concat:css', 'postcss'],
                options: {
                    nospawn: true
                }
            },
            styles_dev: {
                files: ['assets/less/**/*.less'],
                tasks: ['less', 'concat:css', 'postcss'],
                options: {
                    nospawn: true
                }
            },
            scripts_prod: {
                files: ['assets/js/**/*.js'],
                tasks: ['concat:js', 'uglify:prod']
            },
            styles_dev: {
                files: ['assets/js/**/*.js'],
                tasks: ['concat:js', 'uglify:dev']
            },
            configFiles: {
                files: ['Gruntfile.js', 'package.json'],
                options: {
                    reload: true
                }
            }
        }
    });

    require('load-grunt-tasks')(grunt);
    grunt.registerTask('default', ['focus:prod']);

    grunt.registerTask('prod', ['less', 'concat:css', 'concat:js', 'postcss', 'uglify:prod']);
    grunt.registerTask('prod_watch', ['focus:prod']);

    grunt.registerTask('dev', ['less', 'concat:css', 'concat:js', 'postcss', 'uglify:dev']);
    grunt.registerTask('dev_watch', ['focus:dev']);

};<commit_msg>Updated Grunt File<commit_after>module.exports = function(grunt) {
    grunt.initConfig({
        //Less Comilation Options
        less: {
            development: {
                options: {
                    paths: ["assets/css"]
                },
                files: {
                    "assets/css/bootstrap.css": "assets/less/bootstrap/bootstrap.less",
                    "assets/css/stylesheet.css": "assets/less/stylesheet.less",
                }
            }
        },
        postcss: {
            prod: {
                options: {
                    map: {
                        inline: false, // save all sourcemaps as separate files...
                        annotation: 'assets/css/maps' // ...to the specified directory
                    },
                    // safe: true,
                    processors: [
                        require('pixrem')(), // add fallbacks for rem units
                        require('autoprefixer-core')({
                            browsers: 'last 2 versions'
                        }), // add vendor prefixes
                        require('cssnano')(), // minify the result
                        require('cssnext')() // Plugins to use future CSS features now by adding backwards compatibility css processing
                    ]
                },
                files: {
                    "pqr/static/css/pqr.min.css": ['assets/css/pqr.css']
                }
            },
            dev: {
                options: {
                    map: {
                        inline: false, // save all sourcemaps as separate files...
                        annotation: 'assets/css/maps' // ...to the specified directory
                    },
                    // safe: true,
                    processors: [
                        require('pixrem')(), // add fallbacks for rem units
                        require('autoprefixer-core')({
                            browsers: 'last 2 versions'
                        }), // add vendor prefixes
                        require('cssnext')() // Plugins to use future CSS features now by adding backwards compatibility css processing
                    ]
                },
                files: {
                    "pqr/static/css/pqr.min.css": ['assets/css/pqr.css']
                }
            }
        },
        concat: {
            options: {
                // define a string to put between each file in the concatenated output
                separator: ';\n'
            },
            js: {
                // the files to concatenate (modernizr, then jquery, then bootstrap, then everythign else)
                src: ['assets/js/modernizr/**/*.js', 'assets/js/jquery/**/*.js', 'assets/js/bootstrap/**/*.js', 'assets/js/helpers/**/*.js', 'assets/js/pqr/pqr.js', 'assets/js/pqr/config.js', 'assets/js/**/*.js'],
                // the location of the resulting JS file
                dest: 'pqr/static/js/pqr.js'
            },
            css: {
                //
                src: ['assets/css/bootstrap.css', 'assets/css/**/*.css', '!assets/css/maps', '!assets/css/pqr.css'],
                // the location of the resulting CSS file
                dest: 'assets/css/pqr.css'
            },
            dev_fast: { //Just use the pqr.js file not minified as the min file
                src: ['pqr/static/js/pqr.js'],
                dest: 'pqr/static/js/pqr.min.js'
            }
        },
        uglify: {
            prod: {
                options: {
                    // define a string to put between each file in the concatenated output
                    banner: '/*! PQR PROD JavaScript Combined and minified on <%= grunt.template.today("dd-mm-yyyy") %> */\n',
                    compress: {
                        drop_console: true, //Don't display any console output for production
                    }
                },
                files: {
                    "pqr/static/js/pqr.min.js": ['pqr/static/js/pqr.js']
                }
            },
            dev: {
                options: {
                    // define a string to put between each file in the concatenated output
                    banner: '/*! PQR DEV JavaScript Combined and minified on <%= grunt.template.today("dd-mm-yyyy") %> */\n',
                    compress: {},
                    beautify: true
                },
                files: {
                    "pqr/static/js/pqr.min.js": ['pqr/static/js/pqr.js']
                }
            }
        },
        focus: { //Only Run a subset of watch events for production or dev
            dev: {
                include: ['styles_dev', 'scripts_dev', 'configFiles']
            },
            dev_fast: {
                include: ['styles_dev', 'scripts_dev_fast', 'configFiles']
            },
            prod: {
                include: ['styles_prod', 'scripts_prod', 'configFiles']
            }
        },
        watch: { //Which folders to watch for changes and run only the tasks required
            styles_prod: {
                files: ['assets/less/**/*.less'],
                tasks: ['less', 'concat:css', 'postcss:prod'],
                options: {
                    nospawn: true
                }
            },
            styles_dev: {
                files: ['assets/less/**/*.less'],
                tasks: ['less', 'concat:css', 'postcss:dev'],
                options: {
                    nospawn: true
                }
            },
            scripts_prod: {
                files: ['assets/js/**/*.js'],
                tasks: ['concat:js', 'uglify:prod']
            },
            scripts_dev: {
                files: ['assets/js/**/*.js'],
                tasks: ['concat:js', 'uglify:dev']
            },
            scripts_dev_fast: {
                files: ['assets/js/**/*.js'],
                tasks: ['concat:js', 'concat:dev_fast']
            },
            configFiles: {
                files: ['Gruntfile.js', 'package.json'],
                options: {
                    reload: true
                }
            }
        }
    });
    require('load-grunt-tasks')(grunt);
    grunt.registerTask('default', ['focus:prod']);
    grunt.registerTask('prod', ['less', 'concat:css', 'concat:js', 'postcss:prod', 'uglify:prod']);
    grunt.registerTask('prod_watch', ['focus:prod']);
    grunt.registerTask('dev', ['less', 'concat:css', 'concat:js', 'postcss:dev', 'uglify:dev']);
    grunt.registerTask('dev_watch', ['focus:dev']);
    grunt.registerTask('dev_watch_fast', ['focus:dev_fast']); //Must use the pqr.js
};<|endoftext|>


<commit_before>/**
 * Copyright 2015, Alex Grant, LocalNerve, LLC.
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
'use strict';

var webpack = require('webpack');

/**
 * Generate the webpack assets config
 */
function webpackStatsPlugin(self) {
  self.plugin('done', function(stats) {
    var path = require('path');
    var fs = require('fs');

    var data = stats.toJson();
    var assets = data.assetsByChunkName;
    var output = {
      assets: {}
      // , cdnPath: this.options.output.publicPath
    };

    Object.keys(assets).forEach(function eachAsset(key) {
      var value = assets[key];

      // if regex matched, use [name] for key
      var matches = key.match(self.options.custom.CHUNK_REGEX);
      if (matches) {
        key = matches[1];
      }
      output.assets[key] = value;
    });

    // put it out in the dist
    fs.writeFileSync(
      path.join(__dirname, self.options.custom.assetsJson),
      JSON.stringify(output, null, 4)
    );
  });
}

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

  grunt.initConfig({

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

    clean: ['<%= project.dist.baseDir %>'],

    copy: {
      images: {
        files: [{
          expand: true,
          src: ['<%= project.src.images %>/**'], dest: '<%= project.dist.baseDir %>'
        }]
      },
      statics: {
        files: [{
          src: ['<%= project.src.four04 %>', '<%= project.src.five03 %>'],
          dest: '<%= project.dist.baseDir %>/'
        }]
      }
    },

    compass: {
      options: {
        sassDir: '<%= project.src.styles %>',
        imagesDir: '<%= project.src.images %>',
        fontsDir: '<%= project.src.fonts %>',
        cssDir: '<%= project.dist.styles %>',
        httpPath: '/',
        importPath: [
          // '<%= project.vendor %>/foundation/scss',
          '<%= project.src.components %>'
        ],
        environment: 'development',

        httpGeneratedImagesPath: '<%= project.web.images %>'
      },
      dev: {
        options: {
          watch: true
        }
      },
      prod: {
        options: {
          outputStyle: 'compressed',
          noLineComments: true,
          environment: 'production'
        }
      }
    },

    concurrent: {
      options: {
        logConcurrentOutput: true
      },
      dev: ['cc-compass-dev', 'cc-nodemon-dev', 'cc-webpack-dev'],
      prod: ['cc-compass-prod', 'cc-nodemon-prod', 'cc-webpack-prod']
    },

    cssmin: {
      prod: {
        files: [{
          src: '<%= project.dist.css %>',
          dest: '<%= project.dist.css %>'
        }]
      }
    },

    jshint: {
      options: {
        jshintrc: true
      },
      all: {
        src: [
          '*.js',
          '{actions,components,services,stores}/**/*.js'
        ]
      }
    },

    nconfig: {
      dev: {
        options: {
          overrides: {},
          env: {
            NODE_ENV: 'development',
            DEBUG: '*',
            // ERR_HANDLER_MAINT_ENABLED: TRUE,
            ERR_HANDLER_MAINT_RETRYAFTER: 7200
          }
        }
      },
      prod: {
        options: {
          env: {
            NODE_ENV: 'production'
          }
        }
      }
    },

    nodemon: {
      app: {
        options: {
          ignore: ['<%= project.distbase %>/**'],
          ext: 'js,jsx,md'
        },
        script: './<%= pkg.main %>'
      }
    },

    webpack: {
      dev: {
        custom: {
          assetsJson: '<%= project.src.assetsJson %>',
          CHUNK_REGEX: /^([A-Za-z0-9_\-]+)\..*/
        },
        resolve: {
          extensions: ['', '.js', '.jsx']
        },
        entry: './client.js',
        output: {
          path: '<%= project.dist.scripts %>',
          publicPath: '<%= project.web.scripts %>',
          filename: '[name].js',
          chunkFilename: '[name].js'
        },
        module: {
          loaders: [
            { test: /\.css$/, loader: 'style!css' },
            { test: /\.jsx$/, loader: 'jsx-loader' },
            { test: /\.json$/, loader: 'json-loader'}
          ]
        },
        plugins: [
          new webpack.DefinePlugin({
            DEBUG: true
          }),
          new webpack.NormalModuleReplacementPlugin(/^react(\/addons)?$/, require.resolve('react/addons')),
          function() {
            return webpackStatsPlugin(this);
          }
        ],
        stats: {
          colors: true
        },
        devtool: 'source-map',
        watch: true,
        keepalive: true
      },
      prod: {
        custom: {
          assetsJson: '<%= project.src.assetsJson %>',
          CHUNK_REGEX: /^([A-Za-z0-9_\-]+)\..*/
        },
        resolve: {
          extensions: ['', '.js', '.jsx']
        },
        entry: './client.js',
        output: {
          path: '<%= project.dist.scripts %>',
          publicPath: '<%= project.web.scripts %>',
          filename: '[name].[chunkhash].min.js',
          chunkFilename: '[name].[chunkhash].min.js'
        },
        module: {
          loaders: [
            { test: /\.css$/, loader: 'style!css' },
            { test: /\.jsx$/, loader: 'jsx-loader' },
            { test: /\.json$/, loader: 'json-loader'}
          ]
        },
        plugins: [
          new webpack.DefinePlugin({
            'process.env': {
              NODE_ENV: JSON.stringify('production')
            }
          }),
          // These are performance optimizations for your bundles
          new webpack.optimize.DedupePlugin(),
          new webpack.optimize.OccurenceOrderPlugin(),

          // This ensures requires for `react` and `react/addons` normalize to the same requirement
          new webpack.NormalModuleReplacementPlugin(/^react(\/addons)?$/, require.resolve('react/addons')),

          new webpack.optimize.UglifyJsPlugin({
            compress: {
              warnings: false
            }
          }),

          // generates webpack assets config to use hashed assets in production mode
          function() {
            return webpackStatsPlugin(this);
          }
        ],
        // removes verbosity from builds
        progress: false
      }
    }

  });

  // Custom config task
  // Creates a config instance for the project, saves settings in grunt.config('project')
  //
  // Options:
  //  overrides: An object with config settings that overrides all. see nconf for details and config/index.js for impl.
  //             example: settings:dist:images
  //  env: Set environment variables for this process.
  //
  grunt.registerMultiTask('nconfig', 'Assign config settings to grunt project', function() {
    var configLib = require('./configs');
    var options = this.options();

    if (options.env) {
      Object.keys(options.env).forEach(function(key) {
        process.env[key] = options.env[key];
      });
    }

    grunt.config('project', configLib.create(options.overrides).get('settings'));
  });

  // tasks

  grunt.registerTask('dumpconfigTask', function() {
    var util = require('util');
    var config = require('./configs').create();
    var dump = {
      project: grunt.config('project'),
      nconf: config.get()
    };
    console.log(util.inspect(dump));
  });
  grunt.registerTask('dumpconfig', ['nconfig:prod', 'dumpconfigTask']);

  // serial tasks for concurrent, external grunt processes
  grunt.registerTask('cc-compass-dev', ['nconfig:dev', 'compass:dev']);
  grunt.registerTask('cc-compass-prod', ['nconfig:prod', 'compass:prod', 'cssmin:prod']);
  grunt.registerTask('cc-nodemon-dev', ['nconfig:dev', 'nodemon:app']);
  grunt.registerTask('cc-nodemon-prod', ['nconfig:prod', 'nodemon:app']);
  grunt.registerTask('cc-webpack-dev', ['nconfig:dev', 'webpack:dev']);
  grunt.registerTask('cc-webpack-prod', ['nconfig:prod', 'webpack:prod']);

  grunt.registerTask('default', 'dev');
  grunt.registerTask('dev', ['nconfig:dev', 'clean', 'copy', 'jshint', 'concurrent:dev']);
  grunt.registerTask('prod', ['nconfig:prod', 'clean', 'copy', 'jshint', 'concurrent:prod']);
  grunt.registerTask('build', ['nconfig:prod', 'clean', 'copy', 'compass:prod', 'cssmin:prod', 'webpack:prod']);
};<commit_msg>Cleanup, updated dumpconfig<commit_after>/**
 * Copyright 2015, Alex Grant, LocalNerve, LLC.
 * Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
 */
'use strict';

var webpack = require('webpack');

/**
 * Generate the webpack assets config
 */
function webpackStatsPlugin(self) {
  self.plugin('done', function(stats) {
    var path = require('path');
    var fs = require('fs');

    var data = stats.toJson();
    var assets = data.assetsByChunkName;
    var output = {
      assets: {}
    };

    Object.keys(assets).forEach(function eachAsset(key) {
      var value = assets[key];

      // if regex matched, use [name] for key
      var matches = key.match(self.options.custom.CHUNK_REGEX);
      if (matches) {
        key = matches[1];
      }
      output.assets[key] = value;
    });

    fs.writeFileSync(
      path.join(__dirname, self.options.custom.assetsJson),
      JSON.stringify(output, null, 4)
    );
  });
}

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

  grunt.initConfig({

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

    clean: ['<%= project.dist.baseDir %>'],

    copy: {
      images: {
        files: [{
          expand: true,
          src: ['<%= project.src.images %>/**'], dest: '<%= project.dist.baseDir %>'
        }]
      },
      statics: {
        files: [{
          src: ['<%= project.src.four04 %>', '<%= project.src.five03 %>'],
          dest: '<%= project.dist.baseDir %>/'
        }]
      }
    },

    compass: {
      options: {
        sassDir: '<%= project.src.styles %>',
        imagesDir: '<%= project.src.images %>',
        fontsDir: '<%= project.src.fonts %>',
        cssDir: '<%= project.dist.styles %>',
        httpPath: '/',
        importPath: [
          // '<%= project.vendor %>/foundation/scss',
          '<%= project.src.components %>'
        ],
        environment: 'development',

        httpGeneratedImagesPath: '<%= project.web.images %>'
      },
      dev: {
        options: {
          watch: true
        }
      },
      prod: {
        options: {
          outputStyle: 'compressed',
          noLineComments: true,
          environment: 'production'
        }
      }
    },

    concurrent: {
      options: {
        logConcurrentOutput: true
      },
      dev: ['cc-compass-dev', 'cc-nodemon-dev', 'cc-webpack-dev'],
      prod: ['cc-compass-prod', 'cc-nodemon-prod', 'cc-webpack-prod']
    },

    cssmin: {
      prod: {
        files: [{
          src: '<%= project.dist.css %>',
          dest: '<%= project.dist.css %>'
        }]
      }
    },

    jshint: {
      options: {
        jshintrc: true
      },
      all: {
        src: [
          '*.js',
          '{actions,components,services,stores}/**/*.js'
        ]
      }
    },

    nconfig: {
      dev: {
        options: {
          overrides: {},
          env: {
            DEBUG: '*',
            // ERR_HANDLER_MAINT_ENABLED: TRUE,
            ERR_HANDLER_MAINT_RETRYAFTER: 7200
          }
        }
      },
      prod: {
        options: {
          env: {
            NODE_ENV: 'production'
          }
        }
      }
    },

    nodemon: {
      app: {
        options: {
          ignore: ['<%= project.distbase %>/**'],
          ext: 'js,jsx,md'
        },
        script: './<%= pkg.main %>'
      }
    },

    webpack: {
      dev: {
        custom: {
          assetsJson: '<%= project.src.assetsJson %>',
          CHUNK_REGEX: /^([A-Za-z0-9_\-]+)\..*/
        },
        resolve: {
          extensions: ['', '.js', '.jsx']
        },
        entry: './client.js',
        output: {
          path: '<%= project.dist.scripts %>',
          publicPath: '<%= project.web.scripts %>',
          filename: '[name].js',
          chunkFilename: '[name].js'
        },
        module: {
          loaders: [
            { test: /\.css$/, loader: 'style!css' },
            { test: /\.jsx$/, loader: 'jsx-loader' },
            { test: /\.json$/, loader: 'json-loader'}
          ]
        },
        plugins: [
          new webpack.DefinePlugin({
            DEBUG: true
          }),
          new webpack.NormalModuleReplacementPlugin(/^react(\/addons)?$/, require.resolve('react/addons')),
          function() {
            return webpackStatsPlugin(this);
          }
        ],
        stats: {
          colors: true
        },
        devtool: 'source-map',
        watch: true,
        keepalive: true
      },
      prod: {
        custom: {
          assetsJson: '<%= project.src.assetsJson %>',
          CHUNK_REGEX: /^([A-Za-z0-9_\-]+)\..*/
        },
        resolve: {
          extensions: ['', '.js', '.jsx']
        },
        entry: './client.js',
        output: {
          path: '<%= project.dist.scripts %>',
          publicPath: '<%= project.web.scripts %>',
          filename: '[name].[chunkhash].min.js',
          chunkFilename: '[name].[chunkhash].min.js'
        },
        module: {
          loaders: [
            { test: /\.css$/, loader: 'style!css' },
            { test: /\.jsx$/, loader: 'jsx-loader' },
            { test: /\.json$/, loader: 'json-loader'}
          ]
        },
        plugins: [
          new webpack.DefinePlugin({
            'process.env': {
              NODE_ENV: JSON.stringify('production')
            }
          }),
          // These are performance optimizations for your bundles
          new webpack.optimize.DedupePlugin(),
          new webpack.optimize.OccurenceOrderPlugin(),

          // This ensures requires for `react` and `react/addons` normalize to the same requirement
          new webpack.NormalModuleReplacementPlugin(/^react(\/addons)?$/, require.resolve('react/addons')),

          new webpack.optimize.UglifyJsPlugin({
            compress: {
              warnings: false
            }
          }),

          // generates webpack assets config to use hashed assets in production mode
          function() {
            return webpackStatsPlugin(this);
          }
        ],
        // removes verbosity from builds
        progress: false
      }
    }

  });

  // Custom config task
  // Creates a config for the project, saves config(settings) in grunt.config('project')
  //
  // Options:
  //  overrides: An object with config settings that overrides all.
  //             example: settings:dist:images
  //  env: Set environment variables for this process.
  //
  grunt.registerMultiTask('nconfig', 'Assign config settings to grunt project', function() {
    var configLib = require('./configs');
    var options = this.options();

    if (options.env) {
      Object.keys(options.env).forEach(function(key) {
        process.env[key] = options.env[key];
      });
    }

    grunt.config('project', configLib.create(options.overrides).get('settings'));
  });

  // debug nconfig
  grunt.registerTask('_dumpconfigTask', function() {
    var util = require('util');
    var config = require('./configs').create();
    var dump = {
      project: grunt.config('project'),
      nconf: config.get()
    };
    console.log(util.inspect(dump));
  });
  grunt.registerTask('dumpconfig', 'Debug nconfig', function() {
    var tasks = [
      this.args.shift() === 'prod' ? 'nconfig:prod' : 'nconfig:dev'
    ];
    grunt.task.run(tasks.concat('_dumpconfigTask'));
  });

  // serial tasks for concurrent, external grunt processes
  grunt.registerTask('cc-compass-dev', ['nconfig:dev', 'compass:dev']);
  grunt.registerTask('cc-compass-prod', ['nconfig:prod', 'compass:prod', 'cssmin:prod']);
  grunt.registerTask('cc-nodemon-dev', ['nconfig:dev', 'nodemon:app']);
  grunt.registerTask('cc-nodemon-prod', ['nconfig:prod', 'nodemon:app']);
  grunt.registerTask('cc-webpack-dev', ['nconfig:dev', 'webpack:dev']);
  grunt.registerTask('cc-webpack-prod', ['nconfig:prod', 'webpack:prod']);

  grunt.registerTask('default', 'dev');
  grunt.registerTask('dev', ['nconfig:dev', 'clean', 'copy', 'jshint', 'concurrent:dev']);
  grunt.registerTask('prod', ['nconfig:prod', 'clean', 'copy', 'jshint', 'concurrent:prod']);
  grunt.registerTask('build', ['nconfig:prod', 'clean', 'copy', 'compass:prod', 'cssmin:prod', 'webpack:prod']);
};<|endoftext|>


<commit_before>var CAMERA_Z_DELTA = 0.2;
var SWOOP_DESCENT_DELTA = 0.01;
//var PATH = [[0, -1], [-10, -1], [-10, -8], [10, -8], [10, 8], [14, 8], [14, 11], [0, 11]];

var deltaX = 0.0;
var deltaZ = CAMERA_Z_DELTA;
var rotation_progress = 0.0;
var rotation_target = 0;
var pathIndex = 0;
var targetX;
var targetGridX;
var targetZ;
var targetGridZ;
var targetAngle = 0;
var ROTATION_DELTA = 0.03;
var deltaAngle = ROTATION_DELTA;
var RIGHT_ANGLE = Math.PI / 2;

var animator = new swoopAnimation();
var hoverAnimator;
function animate() {
  animator.animate();
  if (hoverAnimator != undefined) {
    hoverAnimator.animate();
    if (hoverAnimator.finished) {
      hoverAnimator = new hoverAnimation();
    }
  }

  if (animator.finished == true) {
    if (animator instanceof swoopAnimation) {
      animator = new rotationAnimation();
      hoverAnimator = new hoverAnimation();
    }
    else if (animator instanceof forwardAnimation) {
      animator = new rotationAnimation();
    }
    else if (animator instanceof rotationAnimation) {
      animator = new forwardAnimation();
    }
  }

  renderer.render(scene, camera);
  requestAnimFrame(animate);
}

function swoopAnimation() {
  this.finished = false;
}

swoopAnimation.prototype.animate = function() {
  camera.position.y -= SWOOP_DESCENT_DELTA;
  camera.position.z -= deltaZ;

  if (camera.position.z <= (city.HALF_SCENE_DEPTH + (city.STREET_WIDTH / 2))) {
    camera.position.z = city.HALF_SCENE_DEPTH + (city.STREET_WIDTH / 2);

    this.finished = true;
  }
}

function forwardAnimation() {
  this.finished = false;
}

forwardAnimation.prototype.animate = function() {
  camera.position.x += deltaX;
  camera.position.z += deltaZ;

  if ((deltaX < 0 && camera.position.x < targetX) || (deltaX > 0 && camera.position.x > targetX) ||
      (deltaZ < 0 && camera.position.z < targetZ) || (deltaZ > 0 && camera.position.z > targetZ)) {
    camera.position.x = targetX;
    camera.position.z = targetZ;

    this.finished = true;
  }
}

function rotationAnimation() {
  if (targetX == undefined || targetZ == undefined) {
    targetGridX = 0;
    targetGridZ = -1;

    targetX = (targetGridX * city.BLOCK_WIDTH) + (targetGridX * city.STREET_WIDTH);
    targetZ = (targetGridZ * city.BLOCK_WIDTH) + (targetGridZ * city.STREET_WIDTH);
  }
  else {
    var oldTargetGridX = targetGridX;
    var oldTargetGridZ = targetGridZ;

    while (oldTargetGridX == targetGridX && oldTargetGridZ == targetGridZ) {
      if (deltaX == 0) {
        targetGridX = Math.floor(Math.random() * city.BLOCK_ROWS) - (city.BLOCK_ROWS / 2);
      }
      else if (deltaZ == 0) {
        targetGridZ = Math.floor(Math.random() * city.BLOCK_COLUMNS) - (city.BLOCK_COLUMNS / 2);
      }
    }

    targetX = (targetGridX * city.BLOCK_WIDTH) + (targetGridX * city.STREET_WIDTH);
    targetZ = (targetGridZ * city.BLOCK_WIDTH) + (targetGridZ * city.STREET_WIDTH);

  }

  deltaX = (camera.position.x == targetX) ? 0 : 0.2;
  deltaZ = (camera.position.z == targetZ) ? 0 : 0.2;
  deltaX *= (camera.position.x > targetX) ? -1 : 1;
  deltaZ *= (camera.position.z > targetZ) ? -1 : 1;

  var oldTargetAngle = targetAngle;
  if (deltaX != 0 && oldTargetAngle == 0) {  // NORTH
    targetAngle = (deltaX < 0) ? targetAngle + RIGHT_ANGLE : targetAngle - RIGHT_ANGLE;
  }
  else if (deltaZ != 0 && (oldTargetAngle == RIGHT_ANGLE || oldTargetAngle == ((-3 * Math.PI) / 2))) {  // EAST
    targetAngle = (deltaZ < 0) ? targetAngle - RIGHT_ANGLE : targetAngle + RIGHT_ANGLE;
  }
  else if (deltaX != 0 && (oldTargetAngle == Math.PI || oldTargetAngle == Math.PI * -1)) {  // SOUTH
    targetAngle = (deltaX < 0) ? targetAngle - RIGHT_ANGLE : targetAngle + RIGHT_ANGLE;
  }
  else if (deltaZ != 0 && (oldTargetAngle == Math.PI / -2 || oldTargetAngle == (Math.PI * 3) / 2)) {  // WEST
    targetAngle = (deltaZ < 0) ? targetAngle + RIGHT_ANGLE : targetAngle - RIGHT_ANGLE;
  }

  deltaAngle = ROTATION_DELTA;
  deltaAngle *= (targetAngle > oldTargetAngle) ? 1 : -1;

  this.finished = false;
}

rotationAnimation.prototype.animate = function() {
  camera.rotation.y += deltaAngle;

  if ((deltaAngle < 0 && camera.rotation.y <= targetAngle) || (deltaAngle > 0 && camera.rotation.y >= targetAngle)) {
    if (targetAngle >= Math.PI * 2 || targetAngle <= Math.PI * -2) {
      targetAngle = 0;
    }

    camera.rotation.y = targetAngle;
    this.finished = true;
  }
}

function hoverAnimation() {
  this.targetDistance = (Math.random() * 300) + 300;
  this.ticks = 0;
  this.deltaY = (camera.position.y > 0.5) ? -0.05 : 0.05;
  this.minHeight = 0.5;
  this.maxHeight = 15;
  this.finished = false;
}

hoverAnimation.prototype.animate = function() {
  if (camera.position.y >= this.minHeight && camera.position.y <= this.maxHeight) {
    camera.position.y += this.deltaY;
  }
  if (camera.position.y < this.minHeight) {
    camera.position.y = this.minHeight;
  }
  if (camera.position.y > this.maxHeight) {
    camera.position.y = this.maxHeight;
  }

  this.ticks += 1;

  if (this.ticks > this.targetDistance) {
    this.finished = true;
  }
}
<commit_msg>Removing unused commented out code<commit_after>var CAMERA_Z_DELTA = 0.2;
var SWOOP_DESCENT_DELTA = 0.01;

var deltaX = 0.0;
var deltaZ = CAMERA_Z_DELTA;
var rotation_progress = 0.0;
var rotation_target = 0;
var pathIndex = 0;
var targetX;
var targetGridX;
var targetZ;
var targetGridZ;
var targetAngle = 0;
var ROTATION_DELTA = 0.03;
var deltaAngle = ROTATION_DELTA;
var RIGHT_ANGLE = Math.PI / 2;

var animator = new swoopAnimation();
var hoverAnimator;
function animate() {
  animator.animate();
  if (hoverAnimator != undefined) {
    hoverAnimator.animate();
    if (hoverAnimator.finished) {
      hoverAnimator = new hoverAnimation();
    }
  }

  if (animator.finished == true) {
    if (animator instanceof swoopAnimation) {
      animator = new rotationAnimation();
      hoverAnimator = new hoverAnimation();
    }
    else if (animator instanceof forwardAnimation) {
      animator = new rotationAnimation();
    }
    else if (animator instanceof rotationAnimation) {
      animator = new forwardAnimation();
    }
  }

  renderer.render(scene, camera);
  requestAnimFrame(animate);
}

function swoopAnimation() {
  this.finished = false;
}

swoopAnimation.prototype.animate = function() {
  camera.position.y -= SWOOP_DESCENT_DELTA;
  camera.position.z -= deltaZ;

  if (camera.position.z <= (city.HALF_SCENE_DEPTH + (city.STREET_WIDTH / 2))) {
    camera.position.z = city.HALF_SCENE_DEPTH + (city.STREET_WIDTH / 2);

    this.finished = true;
  }
}

function forwardAnimation() {
  this.finished = false;
}

forwardAnimation.prototype.animate = function() {
  camera.position.x += deltaX;
  camera.position.z += deltaZ;

  if ((deltaX < 0 && camera.position.x < targetX) || (deltaX > 0 && camera.position.x > targetX) ||
      (deltaZ < 0 && camera.position.z < targetZ) || (deltaZ > 0 && camera.position.z > targetZ)) {
    camera.position.x = targetX;
    camera.position.z = targetZ;

    this.finished = true;
  }
}

function rotationAnimation() {
  if (targetX == undefined || targetZ == undefined) {
    targetGridX = 0;
    targetGridZ = -1;

    targetX = (targetGridX * city.BLOCK_WIDTH) + (targetGridX * city.STREET_WIDTH);
    targetZ = (targetGridZ * city.BLOCK_WIDTH) + (targetGridZ * city.STREET_WIDTH);
  }
  else {
    var oldTargetGridX = targetGridX;
    var oldTargetGridZ = targetGridZ;

    while (oldTargetGridX == targetGridX && oldTargetGridZ == targetGridZ) {
      if (deltaX == 0) {
        targetGridX = Math.floor(Math.random() * city.BLOCK_ROWS) - (city.BLOCK_ROWS / 2);
      }
      else if (deltaZ == 0) {
        targetGridZ = Math.floor(Math.random() * city.BLOCK_COLUMNS) - (city.BLOCK_COLUMNS / 2);
      }
    }

    targetX = (targetGridX * city.BLOCK_WIDTH) + (targetGridX * city.STREET_WIDTH);
    targetZ = (targetGridZ * city.BLOCK_WIDTH) + (targetGridZ * city.STREET_WIDTH);

  }

  deltaX = (camera.position.x == targetX) ? 0 : 0.2;
  deltaZ = (camera.position.z == targetZ) ? 0 : 0.2;
  deltaX *= (camera.position.x > targetX) ? -1 : 1;
  deltaZ *= (camera.position.z > targetZ) ? -1 : 1;

  var oldTargetAngle = targetAngle;
  if (deltaX != 0 && oldTargetAngle == 0) {  // NORTH
    targetAngle = (deltaX < 0) ? targetAngle + RIGHT_ANGLE : targetAngle - RIGHT_ANGLE;
  }
  else if (deltaZ != 0 && (oldTargetAngle == RIGHT_ANGLE || oldTargetAngle == ((-3 * Math.PI) / 2))) {  // EAST
    targetAngle = (deltaZ < 0) ? targetAngle - RIGHT_ANGLE : targetAngle + RIGHT_ANGLE;
  }
  else if (deltaX != 0 && (oldTargetAngle == Math.PI || oldTargetAngle == Math.PI * -1)) {  // SOUTH
    targetAngle = (deltaX < 0) ? targetAngle - RIGHT_ANGLE : targetAngle + RIGHT_ANGLE;
  }
  else if (deltaZ != 0 && (oldTargetAngle == Math.PI / -2 || oldTargetAngle == (Math.PI * 3) / 2)) {  // WEST
    targetAngle = (deltaZ < 0) ? targetAngle + RIGHT_ANGLE : targetAngle - RIGHT_ANGLE;
  }

  deltaAngle = ROTATION_DELTA;
  deltaAngle *= (targetAngle > oldTargetAngle) ? 1 : -1;

  this.finished = false;
}

rotationAnimation.prototype.animate = function() {
  camera.rotation.y += deltaAngle;

  if ((deltaAngle < 0 && camera.rotation.y <= targetAngle) || (deltaAngle > 0 && camera.rotation.y >= targetAngle)) {
    if (targetAngle >= Math.PI * 2 || targetAngle <= Math.PI * -2) {
      targetAngle = 0;
    }

    camera.rotation.y = targetAngle;
    this.finished = true;
  }
}

function hoverAnimation() {
  this.targetDistance = (Math.random() * 300) + 300;
  this.ticks = 0;
  this.deltaY = (camera.position.y > 0.5) ? -0.05 : 0.05;
  this.minHeight = 0.5;
  this.maxHeight = 15;
  this.finished = false;
}

hoverAnimation.prototype.animate = function() {
  if (camera.position.y >= this.minHeight && camera.position.y <= this.maxHeight) {
    camera.position.y += this.deltaY;
  }
  if (camera.position.y < this.minHeight) {
    camera.position.y = this.minHeight;
  }
  if (camera.position.y > this.maxHeight) {
    camera.position.y = this.maxHeight;
  }

  this.ticks += 1;

  if (this.ticks > this.targetDistance) {
    this.finished = true;
  }
}
<|endoftext|>