<commit_before>module.exports = function (grunt) {
  // Full list of files that must be included by RequireJS
  includes = [
    'jquery.select2'
  ];

  amdIncludes = [
    'almond'
  ];

  fullIncludes = [
    'jquery',

    'select2/compat/matcher',

    'select2/dropdown/attachContainer'
  ].concat(includes);

  var i18nModules = [];
  var i18nPaths = {};

  var i18nFiles = grunt.file.expand({
    cwd: 'src/js'
  }, 'select2/i18n/*.js');

  for (var i = 0; i < i18nFiles.length; i++) {
    var file = i18nFiles[i];
    var name = file.split('.')[0];

    i18nModules.push({
      name: name
    });

    i18nPaths[name] = '../../' + name;
  }

  grunt.initConfig({
    clean: {
      docs: ['docs/_site']
    },

    uglify: {
      'dist': {
        src: 'dist/js/select2.js',
        dest: 'dist/js/select2.min.js'
      },
      'dist.full': {
        src: 'dist/js/select2.full.js',
        dest: 'dist/js/select2.full.min.js'
      }
    },

    qunit: {
      all: [
        'tests/**/*.html'
      ]
    },

    'gh-pages': {
      options: {
        base: 'docs',
        clone: 'node_modules/grunt-gh-pages/repo',
        message: 'Updated docs with master',
        push: false,
        repo: 'git@github.com:kevin-brown/select2.git'
      },
      src: '**'
    },

    jekyll: {
      options: {
        src: 'docs',
        dest: 'docs/_site'
      },
      build: {
        d: null
      },
      serve: {
        options: {
          serve: true,
          watch: true
        }
      }
    },

    jshint: {
      options: {
        jshintrc: true
      },
      code: {
        src: ['src/js/**/*.js']
      },
      tests: {
        src: ['tests/**/*.js']
      }
    },

    sass: {
      dist: {
        options: {
          outputStyle: 'compressed'
        },
        files: {
          'dist/css/select2.min.css': [
            'src/scss/core.scss',
            'src/scss/theme/default/layout.css'
          ]
        }
      },
      dev: {
        options: {
          outputStyle: 'nested'
        },
        files: {
          'dist/css/select2.css': [
            'src/scss/core.scss',
            'src/scss/theme/default/layout.css'
          ]
        }
      }
    },

    requirejs: {
      'dist': {
        options: {
          baseUrl: 'src/js',
          optimize: 'none',
          name: 'select2/core',
          out: 'dist/js/select2.js',
          include: amdIncludes.concat(includes),
          paths: {
            almond: '../../vendor/almond-0.2.9',
            jquery: 'jquery.shim'
          },
          wrap: grunt.file.readJSON('src/js/banner.json')
        }
      },
      'dist.full': {
        options: {
          baseUrl: 'src/js',
          optimize: 'none',
          name: 'select2/core',
          out: 'dist/js/select2.full.js',
          include: amdIncludes.concat(fullIncludes),
          paths: {
            almond: '../../vendor/almond-0.2.9',
            jquery: '../../vendor/jquery-2.1.0'
          },
          wrap: grunt.file.readJSON('src/js/banner.json')
        }
      },
      'amd': {
        options: {
          baseUrl: 'src/js',
          optimize: 'none',
          name: 'select2/core',
          out: 'dist/js/select2.amd.js',
          include: includes,
          paths: {
            jquery: 'empty:'
          },
          wrap: grunt.file.readJSON('src/js/banner.json')
        }
      },
      'amd.full': {
        options: {
          baseUrl: 'src/js',
          optimize: 'none',
          name: 'select2/core',
          out: 'dist/js/select2.amd.full.js',
          include: fullIncludes,
          paths: {
            jquery: 'empty:'
          },
          wrap: grunt.file.readJSON('src/js/banner.json')
        }
      },
      'i18n': {
        options: {
          baseUrl: 'src/js/select2/i18n',
          dir: 'dist/js/i18n',
          paths: i18nPaths,
          modules: i18nModules,
          wrap: grunt.file.readJSON('src/js/banner.json')
        }
      }
    },

    watch: {
      js: {
        files: [
          'src/js/select2/**/*.js',
          'tests/**/*.js'
        ],
        tasks: [
          'compile',
          'test',
          'minify'
        ]
      },
      css: {
        files: [
          'src/scss/**/*.scss'
        ],
        tasks: [
          'compile',
          'minify'
        ]
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-requirejs');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.loadNpmTasks('grunt-gh-pages');
  grunt.loadNpmTasks('grunt-jekyll');
  grunt.loadNpmTasks('grunt-sass');

  grunt.registerTask('default', ['compile', 'test', 'minify']);

  grunt.registerTask('compile', ['requirejs', 'sass:dev']);
  grunt.registerTask('minify', ['uglify', 'sass:dist']);
  grunt.registerTask('test', ['qunit', 'jshint']);

  grunt.registerTask('docs', ['jekyll:serve']);

  grunt.registerTask('release', ['default', 'clean:docs', 'gh-pages']);
};
<commit_msg>Automatically push docs updates<commit_after>module.exports = function (grunt) {
  // Full list of files that must be included by RequireJS
  includes = [
    'jquery.select2'
  ];

  amdIncludes = [
    'almond'
  ];

  fullIncludes = [
    'jquery',

    'select2/compat/matcher',

    'select2/dropdown/attachContainer'
  ].concat(includes);

  var i18nModules = [];
  var i18nPaths = {};

  var i18nFiles = grunt.file.expand({
    cwd: 'src/js'
  }, 'select2/i18n/*.js');

  for (var i = 0; i < i18nFiles.length; i++) {
    var file = i18nFiles[i];
    var name = file.split('.')[0];

    i18nModules.push({
      name: name
    });

    i18nPaths[name] = '../../' + name;
  }

  grunt.initConfig({
    clean: {
      docs: ['docs/_site']
    },

    uglify: {
      'dist': {
        src: 'dist/js/select2.js',
        dest: 'dist/js/select2.min.js'
      },
      'dist.full': {
        src: 'dist/js/select2.full.js',
        dest: 'dist/js/select2.full.min.js'
      }
    },

    qunit: {
      all: [
        'tests/**/*.html'
      ]
    },

    'gh-pages': {
      options: {
        base: 'docs',
        clone: 'node_modules/grunt-gh-pages/repo',
        message: 'Updated docs with master',
        push: true,
        repo: 'git@github.com:kevin-brown/select2.git'
      },
      src: '**'
    },

    jekyll: {
      options: {
        src: 'docs',
        dest: 'docs/_site'
      },
      build: {
        d: null
      },
      serve: {
        options: {
          serve: true,
          watch: true
        }
      }
    },

    jshint: {
      options: {
        jshintrc: true
      },
      code: {
        src: ['src/js/**/*.js']
      },
      tests: {
        src: ['tests/**/*.js']
      }
    },

    sass: {
      dist: {
        options: {
          outputStyle: 'compressed'
        },
        files: {
          'dist/css/select2.min.css': [
            'src/scss/core.scss',
            'src/scss/theme/default/layout.css'
          ]
        }
      },
      dev: {
        options: {
          outputStyle: 'nested'
        },
        files: {
          'dist/css/select2.css': [
            'src/scss/core.scss',
            'src/scss/theme/default/layout.css'
          ]
        }
      }
    },

    requirejs: {
      'dist': {
        options: {
          baseUrl: 'src/js',
          optimize: 'none',
          name: 'select2/core',
          out: 'dist/js/select2.js',
          include: amdIncludes.concat(includes),
          paths: {
            almond: '../../vendor/almond-0.2.9',
            jquery: 'jquery.shim'
          },
          wrap: grunt.file.readJSON('src/js/banner.json')
        }
      },
      'dist.full': {
        options: {
          baseUrl: 'src/js',
          optimize: 'none',
          name: 'select2/core',
          out: 'dist/js/select2.full.js',
          include: amdIncludes.concat(fullIncludes),
          paths: {
            almond: '../../vendor/almond-0.2.9',
            jquery: '../../vendor/jquery-2.1.0'
          },
          wrap: grunt.file.readJSON('src/js/banner.json')
        }
      },
      'amd': {
        options: {
          baseUrl: 'src/js',
          optimize: 'none',
          name: 'select2/core',
          out: 'dist/js/select2.amd.js',
          include: includes,
          paths: {
            jquery: 'empty:'
          },
          wrap: grunt.file.readJSON('src/js/banner.json')
        }
      },
      'amd.full': {
        options: {
          baseUrl: 'src/js',
          optimize: 'none',
          name: 'select2/core',
          out: 'dist/js/select2.amd.full.js',
          include: fullIncludes,
          paths: {
            jquery: 'empty:'
          },
          wrap: grunt.file.readJSON('src/js/banner.json')
        }
      },
      'i18n': {
        options: {
          baseUrl: 'src/js/select2/i18n',
          dir: 'dist/js/i18n',
          paths: i18nPaths,
          modules: i18nModules,
          wrap: grunt.file.readJSON('src/js/banner.json')
        }
      }
    },

    watch: {
      js: {
        files: [
          'src/js/select2/**/*.js',
          'tests/**/*.js'
        ],
        tasks: [
          'compile',
          'test',
          'minify'
        ]
      },
      css: {
        files: [
          'src/scss/**/*.scss'
        ],
        tasks: [
          'compile',
          'minify'
        ]
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-requirejs');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.loadNpmTasks('grunt-gh-pages');
  grunt.loadNpmTasks('grunt-jekyll');
  grunt.loadNpmTasks('grunt-sass');

  grunt.registerTask('default', ['compile', 'test', 'minify']);

  grunt.registerTask('compile', ['requirejs', 'sass:dev']);
  grunt.registerTask('minify', ['uglify', 'sass:dist']);
  grunt.registerTask('test', ['qunit', 'jshint']);

  grunt.registerTask('docs', ['jekyll:serve']);

  grunt.registerTask('release', ['default', 'clean:docs', 'gh-pages']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt){
  grunt.initConfig({
    // Clean
    clean: ['public', 'govuk_modules'],

    // Builds Sass
    sass: {
      dev: {
        options: {
          style: "expanded",
          sourcemap: true,
          includePaths: [
            'govuk_modules/govuk_template/assets/stylesheets',
            'govuk_modules/govuk_frontend_toolkit/stylesheets'
          ],
          outputStyle: 'expanded'
        },
        files: [{
          expand: true,
          cwd: "app/assets/sass",
          src: ["*.scss"],
          dest: "public/stylesheets/",
          ext: ".css"
        }]
      }
    },

    // Copies templates and assets from external modules and dirs
    copy: {
      assets: {
        files: [{
          expand: true,
          cwd: 'app/assets/',
          src: ['**/*', '!sass/**'],
          dest: 'public/'
        }]
      },
      govuk: {
        files: [{
          expand: true,
          cwd: 'node_modules/govuk_frontend_toolkit',
          src: '**',
          dest: 'govuk_modules/govuk_frontend_toolkit/'
        },
        {
          expand: true,
          cwd: 'node_modules/govuk_template_mustache/',
          src: '**',
          dest: 'govuk_modules/govuk_template/'
        }]
      },
    },

    // workaround for libsass
    replace: {
      fixSass: {
        src: ['govuk_modules/govuk_template/**/*.scss', 'govuk_modules/govuk_frontend_toolkit/**/*.scss'],
        overwrite: true,
        replacements: [{
          from: /filter:chroma(.*);/g,
          to: 'filter:unquote("chroma$1");'
        }]
      }
    },

    // Watches assets and sass for changes
    watch: {
      css: {
        files: ['app/assets/sass/**/*.scss'],
        tasks: ['sass'],
        options: {
          spawn: false,
        }
      },
      assets:{
        files: ['app/assets/**/*', '!app/assets/sass/**'],
        tasks: ['copy:assets'],
        options: {
          spawn: false,
        }
      }
    },

    // nodemon watches for changes and restarts app
    nodemon: {
      dev: {
        script: 'server.js',
        options: {
          ext: 'js, json',
          ignore: ['node_modules/**', 'app/assets/**', 'public/**'],
          args: grunt.option.flags()
        }
      }
    },

    concurrent: {
        target: {
            tasks: ['watch', 'nodemon'],
            options: {
                logConcurrentOutput: true
            }
        }
    }
  });

  [
    'grunt-contrib-copy',
    'grunt-contrib-watch',
    'grunt-contrib-clean',
    'grunt-sass',
    'grunt-nodemon',
    'grunt-text-replace',
    'grunt-concurrent'
  ].forEach(function (task) {
    grunt.loadNpmTasks(task);
  });

  grunt.registerTask(
    'convert_template',
    'Converts the govuk_template to use mustache inheritance',
    function () {
      var script = require(__dirname + '/lib/template-conversion.js');

      script.convert();
      grunt.log.writeln('govuk_template converted');
    }
  );

  grunt.registerTask('generate-assets', [
    'clean',
    'copy',
    'convert_template',
    'replace',
    'sass'
  ]);

  grunt.registerTask('default', [
    'generate-assets',
    'concurrent:target'
  ]);

  grunt.event.on('watch', function(action, filepath, target) {

    // just copy the asset that was changed, not all of them

    if (target == "assets"){
      grunt.config('copy.assets.files.0.src', filepath.replace("app/assets/",""));
    }

  });

};
<commit_msg>Create a test grunt task<commit_after>module.exports = function(grunt){
  grunt.initConfig({
    // Clean
    clean: ['public', 'govuk_modules'],

    // Builds Sass
    sass: {
      dev: {
        options: {
          style: "expanded",
          sourcemap: true,
          includePaths: [
            'govuk_modules/govuk_template/assets/stylesheets',
            'govuk_modules/govuk_frontend_toolkit/stylesheets'
          ],
          outputStyle: 'expanded'
        },
        files: [{
          expand: true,
          cwd: "app/assets/sass",
          src: ["*.scss"],
          dest: "public/stylesheets/",
          ext: ".css"
        }]
      }
    },

    // Copies templates and assets from external modules and dirs
    copy: {
      assets: {
        files: [{
          expand: true,
          cwd: 'app/assets/',
          src: ['**/*', '!sass/**'],
          dest: 'public/'
        }]
      },
      govuk: {
        files: [{
          expand: true,
          cwd: 'node_modules/govuk_frontend_toolkit',
          src: '**',
          dest: 'govuk_modules/govuk_frontend_toolkit/'
        },
        {
          expand: true,
          cwd: 'node_modules/govuk_template_mustache/',
          src: '**',
          dest: 'govuk_modules/govuk_template/'
        }]
      },
    },

    // workaround for libsass
    replace: {
      fixSass: {
        src: ['govuk_modules/govuk_template/**/*.scss', 'govuk_modules/govuk_frontend_toolkit/**/*.scss'],
        overwrite: true,
        replacements: [{
          from: /filter:chroma(.*);/g,
          to: 'filter:unquote("chroma$1");'
        }]
      }
    },

    // Watches assets and sass for changes
    watch: {
      css: {
        files: ['app/assets/sass/**/*.scss'],
        tasks: ['sass'],
        options: {
          spawn: false,
        }
      },
      assets:{
        files: ['app/assets/**/*', '!app/assets/sass/**'],
        tasks: ['copy:assets'],
        options: {
          spawn: false,
        }
      }
    },

    // nodemon watches for changes and restarts app
    nodemon: {
      dev: {
        script: 'server.js',
        options: {
          ext: 'js, json',
          ignore: ['node_modules/**', 'app/assets/**', 'public/**'],
          args: grunt.option.flags()
        }
      }
    },

    concurrent: {
        target: {
            tasks: ['watch', 'nodemon'],
            options: {
                logConcurrentOutput: true
            }
        }
    }
  });

  [
    'grunt-contrib-copy',
    'grunt-contrib-watch',
    'grunt-contrib-clean',
    'grunt-sass',
    'grunt-nodemon',
    'grunt-text-replace',
    'grunt-concurrent'
  ].forEach(function (task) {
    grunt.loadNpmTasks(task);
  });

  grunt.registerTask(
    'convert_template',
    'Converts the govuk_template to use mustache inheritance',
    function () {
      var script = require(__dirname + '/lib/template-conversion.js');

      script.convert();
      grunt.log.writeln('govuk_template converted');
    }
  );

  grunt.registerTask('generate-assets', [
    'clean',
    'copy',
    'convert_template',
    'replace',
    'sass'
  ]);

  grunt.registerTask('default', [
    'generate-assets',
    'concurrent:target'
  ]);

  grunt.registerTask(
    'test',
    'default',
    function () {
      grunt.log.writeln('Test that the app runs');
    }
  );

  grunt.event.on('watch', function(action, filepath, target) {

    // just copy the asset that was changed, not all of them

    if (target == "assets"){
      grunt.config('copy.assets.files.0.src', filepath.replace("app/assets/",""));
    }

  });

};
<|endoftext|>


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

    'use strict';

    grunt.initConfig({

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

        browserify: {
            dev: {
                files: {
                    'dist/js/bundle.js': ['js/index.js'],
                    'dist/js/test.js': ['tests/js/web/index.js']
                },
                options: {
                    browserifyOptions: {
                        standalone: 'pulsar',
                        debug: true
                    },
                    transform: [
                        ['babelify', { presets: ['es2015'] } ],
                        ['aliasify', { global: true }]
                    ]
                }
            },
            dist: {
                files: {
                    'dist/js/bundle.js': ['js/index.js'],
                    'dist/js/test.js': ['tests/js/web/index.js']
                },
                options: {
                    browserifyOptions: {
                        standalone: 'pulsar'
                    },
                    transform: [
                        ['babelify', { presets: ['es2015'] } ],
                        ['aliasify', { global: true }],
                        'uglifyify'
                    ]
                }
            }
        },

        phpunit: {
            classes: {
                dir: 'tests/unit/'
            },
            options: {
                bin: 'vendor/bin/phpunit',
                bootstrap: 'tests/unit/bootstrap.php',
                colors: true
            }
        },

        sass: {
            dev: {
                options: {
                    outputStyle: 'nested',
                    sourceMap: true
                },
                files: [{
                    cwd:    'stylesheets/',
                    dest:   'css/',
                    expand: true,
                    ext:    '.css',
                    extDot: 'first',
                    src:    '*.scss'
                }]
            },
            dist_modern: {
                options: {
                    outputStyle: 'compressed'
                },
                files: [{
                    cwd:    'stylesheets/',
                    dest:   'dist/css/',
                    expand: true,
                    flatten: true,
                    ext:    '.css',
                    extDot: 'first',
                    src:    ['pulsar.scss']
                }]
            },
            dist_ie: {
                options: {
                    outputStyle: 'nested'
                },
                files: [{
                    cwd:    'stylesheets/',
                    dest:   'dist/css/',
                    expand: true,
                    flatten: true,
                    ext:    '.css',
                    extDot: 'first',
                    src:    'pulsar-ie*.scss'
                }]
            }
        },

        replace: {
            projector: {
                src: ['stylesheets/pulsar.scss'],
                dest: 'stylesheets/pulsar-theme-projector.scss',
                replacements: [{
                    from: 'palette.base',
                    to: 'palette.projector'
                }]
            },
            projector_ie9: {
                src: ['stylesheets/pulsar-ie9.scss'],
                dest: 'stylesheets/pulsar-ie9-theme-projector.scss',
                replacements: [{
                    from: 'palette.base',
                    to: 'palette.projector'
                }]
            },
            projector_ie8: {
                src: ['stylesheets/pulsar-ie8.scss'],
                dest: 'stylesheets/pulsar-ie8-theme-projector.scss',
                replacements: [{
                    from: 'palette.base',
                    to: 'palette.projector'
                }]
            },
            projector_ie7: {
                src: ['stylesheets/pulsar-ie7.scss'],
                dest: 'stylesheets/pulsar-ie7-theme-projector.scss',
                replacements: [{
                    from: 'palette.base',
                    to: 'palette.projector'
                }]
            }
        },

        autoprefixer: {
            dev: {
                options: {
                    browsers: ['last 2 version', 'ie 7', 'ie 8', 'ie 9']
                },
                expand: true,
                src:    'css/*.css'
            }
        },

        scsslint: {
            allFiles: [
                'stylesheets/*.scss',
            ],
            options: {
                config: '.scss-lint.yml',
                colorizeOutput: true
            },
        },

        watch: {
            css: {
                files: ['stylesheets/**/*.scss'],
                tasks: ['sass:dev', 'autoprefixer', 'bless:css'],
                options: {
                    livereload: true,
                },
            },
            scsslint: {
                files: 'stylesheets/**/*.scss',
                tasks: ['scsslint']
            },
            js: {
                files: ['js/**/*.js', 'tests/js/**/*', 'package.json'],
                tasks: ['browserify:dev']
            }
        },

        jshint: {
            options: {
            jshintrc: '.jshintrc'
            },
            all: ['js/**/*.js']
        },

        mocha: {
            test: {
                src: ['tests/**/*.html'],
                options: {
                    reporter: 'Nyan',
                    run: true
                }
            },
        },

        uglify: {
            concat: {
                options: {
                    banner: '<%= pkg.banner %>',
                    beautify: true
                },
                files: {
                    'dist/js/<%= pkg.name %>.js': ['js/**/*.js']
                }
                },
                minify: {
                options: {
                    banner: '<%= pkg.banner %>',
                    compress: true,
                    report: 'min'
                },
                files: {
                    'dist/js/<%= pkg.name %>.min.js': ['js/**/*.js']
                }
            }
        },

        asciify: {
            banner:{
            text: '<%= pkg.name %>',
            options: {
                font: 'univers',
                log: true
            }
            },
        },

        copy: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '',
                    src: [
                        'fonts/**/*',
                        'images/**/*',
                        'libs/**/*',
                        'views/pulsar/**/*',
                        'src/**/*'
                    ],
                    dest: 'dist/'
                }]
            },
            docs: {
                files: [{
                    cwd: '',
                    expand: true,
                    flatten: true,
                    src: [
                        'dist/js/bundle.js'
                    ],
                    dest: 'docs/assets/'
                }]
            }
        },

        clean: {
            dist: ['dist'],
            favicons: ['views/pulsar/components/favicons-*.html'],
            smoketest: ['tmp/failures/*']
        },

        bump: {
            options: {
                updateConfigs: ['pkg'],
                files: ['pulsar.json', 'package.json', 'composer.json', 'bower.json', 'VERSION'],
                commit: true,
                commitMessage: 'Release v%VERSION%',
                commitFiles: ['-a'],
                createTag: true,
                tagName: '%VERSION%',
                push: true,
                pushTo: 'origin'
            }
        },

        exec: {
            phantomcss: {
                cmd: 'phantomjs tests/css/testsuite.js'
            },
            updateComposer: {
                cmd: 'sudo php composer.phar update'
            },
            updateBrew: {
                cmd: 'brew update && brew upgrade'
            },
            updateBower: {
                cmd: 'bower update'
            },
            updateGems: {
                cmd: 'sudo gem update'
            },
            updateNpm: {
                cmd: 'sudo npm install'
            },
            wraithUpdate: {
                cmd: 'php tests/css/updateWraith.php'
            },
            wraithHistory: {
                cmd: 'wraith history wraith.yml'
            },
            wraithLatest: {
                cmd: 'wraith latest wraith.yml'
            },
            fixProximaNova: {
                cmd: 'git update-index --skip-worktree fonts/_config.fonts.scss'
            }
        },

        realFavicon: {
            options: {
                settings: {
                    scalingAlgorithm: 'Mitchell',
                    errorOnImageTooSmall: false
                }
            },
            cms: {
                src: 'images/favicons/src/favicon-cms.svg',
                dest: 'images/favicons/cms',
                options: {
                    iconsPath: '/jadu/bundles/pulsar/images/favicons/cms/',
                    html: [ 'views/pulsar/components/favicons-cms.html' ],
                    design: {
                        ios: {
                            pictureAspect: 'backgroundAndMargin',
                            backgroundColor: '#ffffff',
                            margin: '14%'
                        },
                        desktopBrowser: {},
                        androidChrome: {
                            pictureAspect: 'backgroundAndMargin',
                            margin: '17%',
                            backgroundColor: '#ffffff',
                            themeColor: '#ffffff',
                            manifest: {
                                name: 'Continuum',
                                display: 'browser',
                                orientation: 'notSet',
                                onConflict: 'override'
                            }
                        },
                        windows: {
                            pictureAspect: 'whiteSilhouette',
                            backgroundColor: '#15a6d1',
                            onConflict: 'override'
                        }
                    }
                }
            },
            xfp: {
                src: 'images/favicons/src/favicon-xfp.svg',
                dest: 'images/favicons/xfp',
                options: {
                    iconsPath: '/images/favicons/xfp/',
                    html: [ 'views/pulsar/components/favicons-xfp.html' ],
                    design: {
                        ios: {
                            pictureAspect: 'backgroundAndMargin',
                            backgroundColor: '#ffffff',
                            margin: '14%'
                        },
                        desktopBrowser: {},
                        androidChrome: {
                            pictureAspect: 'backgroundAndMargin',
                            margin: '17%',
                            backgroundColor: '#ffffff',
                            themeColor: '#ffffff',
                            manifest: {
                                name: 'Continuum',
                                display: 'browser',
                                orientation: 'notSet',
                                onConflict: 'override'
                            }
                        },
                        windows: {
                            pictureAspect: 'whiteSilhouette',
                            backgroundColor: '#80BA27',
                            onConflict: 'override'
                        }
                    }
                }
            },
            cxm: {
                src: 'images/favicons/src/favicon-cxm.svg',
                dest: 'images/favicons/cxm',
                options: {
                    iconsPath: '/images/favicons/cxm/',
                    html: [ 'views/pulsar/components/favicons-cxm.html' ],
                    design: {
                        ios: {
                            pictureAspect: 'backgroundAndMargin',
                            backgroundColor: '#ffffff',
                            margin: '14%'
                        },
                        desktopBrowser: {},
                        androidChrome: {
                            pictureAspect: 'backgroundAndMargin',
                            margin: '17%',
                            backgroundColor: '#ffffff',
                            themeColor: '#ffffff',
                            manifest: {
                                name: 'Continuum',
                                display: 'browser',
                                orientation: 'notSet',
                                onConflict: 'override'
                            }
                        },
                        windows: {
                            pictureAspect: 'whiteSilhouette',
                            backgroundColor: '#54B9A9',
                            onConflict: 'override'
                        }
                    }
                }
            },
            cp: {
                src: 'images/favicons/src/favicon-cp.svg',
                dest: 'images/favicons/cp',
                options: {
                    iconsPath: '/images/favicons/cp/',
                    html: [ 'views/pulsar/components/favicons-cp.html' ],
                    design: {
                        ios: {
                            pictureAspect: 'backgroundAndMargin',
                            backgroundColor: '#ffffff',
                            margin: '14%'
                        },
                        desktopBrowser: {},
                        androidChrome: {
                            pictureAspect: 'backgroundAndMargin',
                            margin: '17%',
                            backgroundColor: '#ffffff',
                            themeColor: '#ffffff',
                            manifest: {
                                name: 'Continuum',
                                display: 'browser',
                                orientation: 'notSet',
                                onConflict: 'override'
                            }
                        },
                        windows: {
                            pictureAspect: 'whiteSilhouette',
                            backgroundColor: '#DC5172',
                            onConflict: 'override'
                        }
                    }
                }
            }
        },

        bless: {
            css: {
                options: {
                    cacheBuster: true,
                    compress: true,
                    logCount: true
                },
                files: {
                    'css/pulsar-ie7.min.css': 'css/pulsar-ie7.css',
                    'css/pulsar-ie8.min.css': 'css/pulsar-ie8.css',
                    'css/pulsar-ie9.min.css': 'css/pulsar-ie9.css',
                    'css/pulsar-ie7-theme-projector.min.css': 'css/pulsar-ie7-theme-projector.css',
                    'css/pulsar-ie8-theme-projector.min.css': 'css/pulsar-ie8-theme-projector.css',
                    'css/pulsar-ie9-theme-projector.min.css': 'css/pulsar-ie9-theme-projector.css'
                }
            }
        },

        compress: {
            dist: {
                options: {
                    archive: 'pulsar.zip'
                },
                files: [{
                    expand: true,
                    cwd: 'dist/',
                    src: ['**/*']
                }]
            }
        },

        browserSync: {
            files: [
                'css/*',
                'dist/**/*',
                'images/**/*',
                'views/**/*'
            ],
            options: {
                proxy: 'http://192.168.13.37/index.php',
                reloadOnRestart: true,
                watchTask: true
            }
	    },

        casperjs: {
            options: {
                async: {
                    parallel: false
                },
                silent: false
            },
            files: ['../pulsar/tests/js/casper.js']
        },

        validation: {
            options: {
                reset: grunt.option('reset') || false,
                stoponerror: false,
                maxTry: 3,
                relaxerror: ['Bad value X-UA-Compatible for attribute http-equiv on element meta.'], // ignores these errors
                generateReport: true,
                errorHTMLRootDir: "tests/validation/error_reports",
                useTimeStamp: true,
                errorTemplate: "tests/validation/w3c_validation_error_Template.html"
            },
            files: {
                src: ['../pulsar/tests/validation/html_output/*.html']
            }
        },

	    'gh-pages': {
            options: {
                base: 'docs/_site',
                repo: 'https://github.com/jadu/pulsar.git'
            },
            src: ['**']
        }

    });

    grunt.config.set('leadingIndent.indentation', 'spaces');

    grunt.config.set('leadingIndent.files', {
        src : [
            'docs/**/*.md',
            'docs/**/*.php',
            'css/**/*',
            'js/**/*',
            'lexicon/**/*',
            'src/**/*',
            'stylesheets/**/*',
            'tests/**/*',
            'views/**/*'
        ]
    });

    grunt.registerTask('default', [
        'copy',
        'scsslint',
        'replace',
        'sass:dev',
        'autoprefixer',
        'bless',
        'browserify:dev',
        'browserSync',
        'watch'
    ]);

    grunt.registerTask('post-merge', [
        'exec:fixProximaNova',
        'replace',
        'sass:dev',
        'browserify'
    ]);

    grunt.registerTask('build', [
        'scsslint',
        'replace',
        'sass:dist_modern',
        'sass:dist_ie',
        'autoprefixer',
        'browserify:dist',
        'copy:dist',
        'realFavicon',
        'compress'
    ]);

    grunt.registerTask('deploy', [
        'replace',
        'sass:dist_modern',
        'sass:dist_ie',
        'autoprefixer',
        'browserify:dist',
        'copy:dist',
        'compress'
    ]);

    grunt.registerTask('favicons', [
        'clean:favicons',
        'realFavicon'
    ]);

    grunt.registerTask('wraith', [
        'exec:wraithLatest'
    ]);

    grunt.registerTask('wraith-update', [
        'exec:wraithUpdate',
        'exec:wraithHistory'
    ]);

    grunt.registerTask('update', [
        'exec:updateComposer',
        'exec:updateBrew',
        'exec:updateBower',
        'exec:updateGems',
        'exec:updateNpm'
    ]);

    grunt.registerTask('validate', [
        'casperjs',
        'validation'
    ]);

    // load all grunt tasks
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

};
<commit_msg>Update Gruntfile to separate Lexicon from Pulsar<commit_after>module.exports = function(grunt) {

    'use strict';

    grunt.initConfig({

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

        browserify: {
            dev: {
                files: {
                    'dist/js/bundle.js': ['js/index.js'],
                    'dist/js/test.js': ['tests/js/web/index.js']
                },
                options: {
                    browserifyOptions: {
                        standalone: 'pulsar',
                        debug: true
                    },
                    transform: [
                        ['babelify', { presets: ['es2015'] } ],
                        ['aliasify', { global: true }]
                    ]
                }
            },
            dist: {
                files: {
                    'dist/js/bundle.js': ['js/index.js'],
                    'dist/js/test.js': ['tests/js/web/index.js']
                },
                options: {
                    browserifyOptions: {
                        standalone: 'pulsar'
                    },
                    transform: [
                        ['babelify', { presets: ['es2015'] } ],
                        ['aliasify', { global: true }],
                        'uglifyify'
                    ]
                }
            }
        },

        phpunit: {
            classes: {
                dir: 'tests/unit/'
            },
            options: {
                bin: 'vendor/bin/phpunit',
                bootstrap: 'tests/unit/bootstrap.php',
                colors: true
            }
        },

        sass: {
            dev: {
                options: {
                    outputStyle: 'nested',
                    sourceMap: true
                },
                files: [{
                    cwd:    'stylesheets/',
                    dest:   'css/',
                    expand: true,
                    ext:    '.css',
                    extDot: 'first',
                    src:    '*.scss'
                }]
            },
            dist_modern: {
                options: {
                    outputStyle: 'compressed'
                },
                files: [{
                    cwd:    'stylesheets/',
                    dest:   'dist/css/',
                    expand: true,
                    flatten: true,
                    ext:    '.css',
                    extDot: 'first',
                    src:    ['pulsar.scss']
                }]
            },
            dist_ie: {
                options: {
                    outputStyle: 'nested'
                },
                files: [{
                    cwd:    'stylesheets/',
                    dest:   'dist/css/',
                    expand: true,
                    flatten: true,
                    ext:    '.css',
                    extDot: 'first',
                    src:    'pulsar-ie*.scss'
                }]
            },
            lexicon: {
                options: {
                    outputStyle: 'nested',
                    sourceMap: true
                },
                files: [{
                    cwd: 'stylesheets/lexicon/',
                    dest:   'css/',
                    expand: true,
                    ext:    '.css',
                    extDot: 'first',
                    src:    '*.scss'
                }]
            }
        },

        replace: {
            projector: {
                src: ['stylesheets/pulsar.scss'],
                dest: 'stylesheets/pulsar-theme-projector.scss',
                replacements: [{
                    from: 'palette.base',
                    to: 'palette.projector'
                }]
            },
            projector_ie9: {
                src: ['stylesheets/pulsar-ie9.scss'],
                dest: 'stylesheets/pulsar-ie9-theme-projector.scss',
                replacements: [{
                    from: 'palette.base',
                    to: 'palette.projector'
                }]
            },
            projector_ie8: {
                src: ['stylesheets/pulsar-ie8.scss'],
                dest: 'stylesheets/pulsar-ie8-theme-projector.scss',
                replacements: [{
                    from: 'palette.base',
                    to: 'palette.projector'
                }]
            },
            projector_ie7: {
                src: ['stylesheets/pulsar-ie7.scss'],
                dest: 'stylesheets/pulsar-ie7-theme-projector.scss',
                replacements: [{
                    from: 'palette.base',
                    to: 'palette.projector'
                }]
            }
        },

        autoprefixer: {
            dev: {
                options: {
                    browsers: ['last 2 version', 'ie 7', 'ie 8', 'ie 9']
                },
                expand: true,
                src:    'css/*.css'
            }
        },

        scsslint: {
            allFiles: [
                'stylesheets/*.scss',
            ],
            options: {
                config: '.scss-lint.yml',
                colorizeOutput: true
            },
        },

        watch: {
            css: {
                files: ['stylesheets/**/*.scss'],
                tasks: ['sass:dev', 'autoprefixer', 'bless:css'],
                options: {
                    livereload: true,
                },
            },
            scsslint: {
                files: 'stylesheets/**/*.scss',
                tasks: ['scsslint']
            },
            js: {
                files: ['js/**/*.js', 'tests/js/**/*', 'package.json'],
                tasks: ['browserify:dev']
            }
        },

        jshint: {
            options: {
            jshintrc: '.jshintrc'
            },
            all: ['js/**/*.js']
        },

        mocha: {
            test: {
                src: ['tests/**/*.html'],
                options: {
                    reporter: 'Nyan',
                    run: true
                }
            },
        },

        uglify: {
            concat: {
                options: {
                    banner: '<%= pkg.banner %>',
                    beautify: true
                },
                files: {
                    'dist/js/<%= pkg.name %>.js': ['js/**/*.js']
                }
                },
                minify: {
                options: {
                    banner: '<%= pkg.banner %>',
                    compress: true,
                    report: 'min'
                },
                files: {
                    'dist/js/<%= pkg.name %>.min.js': ['js/**/*.js']
                }
            }
        },

        asciify: {
            banner:{
            text: '<%= pkg.name %>',
            options: {
                font: 'univers',
                log: true
            }
            },
        },

        copy: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '',
                    src: [
                        'fonts/**/*',
                        'images/**/*',
                        'libs/**/*',
                        'views/pulsar/**/*',
                        'src/**/*'
                    ],
                    dest: 'dist/'
                }]
            },
            docs: {
                files: [{
                    cwd: '',
                    expand: true,
                    flatten: true,
                    src: [
                        'dist/js/bundle.js'
                    ],
                    dest: 'docs/assets/'
                }]
            }
        },

        clean: {
            dist: ['dist'],
            favicons: ['views/pulsar/components/favicons-*.html'],
            smoketest: ['tmp/failures/*']
        },

        bump: {
            options: {
                updateConfigs: ['pkg'],
                files: ['pulsar.json', 'package.json', 'composer.json', 'bower.json', 'VERSION'],
                commit: true,
                commitMessage: 'Release v%VERSION%',
                commitFiles: ['-a'],
                createTag: true,
                tagName: '%VERSION%',
                push: true,
                pushTo: 'origin'
            }
        },

        exec: {
            phantomcss: {
                cmd: 'phantomjs tests/css/testsuite.js'
            },
            updateComposer: {
                cmd: 'sudo php composer.phar update'
            },
            updateBrew: {
                cmd: 'brew update && brew upgrade'
            },
            updateBower: {
                cmd: 'bower update'
            },
            updateGems: {
                cmd: 'sudo gem update'
            },
            updateNpm: {
                cmd: 'sudo npm install'
            },
            wraithUpdate: {
                cmd: 'php tests/css/updateWraith.php'
            },
            wraithHistory: {
                cmd: 'wraith history wraith.yml'
            },
            wraithLatest: {
                cmd: 'wraith latest wraith.yml'
            },
            fixProximaNova: {
                cmd: 'git update-index --skip-worktree fonts/_config.fonts.scss'
            }
        },

        realFavicon: {
            options: {
                settings: {
                    scalingAlgorithm: 'Mitchell',
                    errorOnImageTooSmall: false
                }
            },
            cms: {
                src: 'images/favicons/src/favicon-cms.svg',
                dest: 'images/favicons/cms',
                options: {
                    iconsPath: '/jadu/bundles/pulsar/images/favicons/cms/',
                    html: [ 'views/pulsar/components/favicons-cms.html' ],
                    design: {
                        ios: {
                            pictureAspect: 'backgroundAndMargin',
                            backgroundColor: '#ffffff',
                            margin: '14%'
                        },
                        desktopBrowser: {},
                        androidChrome: {
                            pictureAspect: 'backgroundAndMargin',
                            margin: '17%',
                            backgroundColor: '#ffffff',
                            themeColor: '#ffffff',
                            manifest: {
                                name: 'Continuum',
                                display: 'browser',
                                orientation: 'notSet',
                                onConflict: 'override'
                            }
                        },
                        windows: {
                            pictureAspect: 'whiteSilhouette',
                            backgroundColor: '#15a6d1',
                            onConflict: 'override'
                        }
                    }
                }
            },
            xfp: {
                src: 'images/favicons/src/favicon-xfp.svg',
                dest: 'images/favicons/xfp',
                options: {
                    iconsPath: '/images/favicons/xfp/',
                    html: [ 'views/pulsar/components/favicons-xfp.html' ],
                    design: {
                        ios: {
                            pictureAspect: 'backgroundAndMargin',
                            backgroundColor: '#ffffff',
                            margin: '14%'
                        },
                        desktopBrowser: {},
                        androidChrome: {
                            pictureAspect: 'backgroundAndMargin',
                            margin: '17%',
                            backgroundColor: '#ffffff',
                            themeColor: '#ffffff',
                            manifest: {
                                name: 'Continuum',
                                display: 'browser',
                                orientation: 'notSet',
                                onConflict: 'override'
                            }
                        },
                        windows: {
                            pictureAspect: 'whiteSilhouette',
                            backgroundColor: '#80BA27',
                            onConflict: 'override'
                        }
                    }
                }
            },
            cxm: {
                src: 'images/favicons/src/favicon-cxm.svg',
                dest: 'images/favicons/cxm',
                options: {
                    iconsPath: '/images/favicons/cxm/',
                    html: [ 'views/pulsar/components/favicons-cxm.html' ],
                    design: {
                        ios: {
                            pictureAspect: 'backgroundAndMargin',
                            backgroundColor: '#ffffff',
                            margin: '14%'
                        },
                        desktopBrowser: {},
                        androidChrome: {
                            pictureAspect: 'backgroundAndMargin',
                            margin: '17%',
                            backgroundColor: '#ffffff',
                            themeColor: '#ffffff',
                            manifest: {
                                name: 'Continuum',
                                display: 'browser',
                                orientation: 'notSet',
                                onConflict: 'override'
                            }
                        },
                        windows: {
                            pictureAspect: 'whiteSilhouette',
                            backgroundColor: '#54B9A9',
                            onConflict: 'override'
                        }
                    }
                }
            },
            cp: {
                src: 'images/favicons/src/favicon-cp.svg',
                dest: 'images/favicons/cp',
                options: {
                    iconsPath: '/images/favicons/cp/',
                    html: [ 'views/pulsar/components/favicons-cp.html' ],
                    design: {
                        ios: {
                            pictureAspect: 'backgroundAndMargin',
                            backgroundColor: '#ffffff',
                            margin: '14%'
                        },
                        desktopBrowser: {},
                        androidChrome: {
                            pictureAspect: 'backgroundAndMargin',
                            margin: '17%',
                            backgroundColor: '#ffffff',
                            themeColor: '#ffffff',
                            manifest: {
                                name: 'Continuum',
                                display: 'browser',
                                orientation: 'notSet',
                                onConflict: 'override'
                            }
                        },
                        windows: {
                            pictureAspect: 'whiteSilhouette',
                            backgroundColor: '#DC5172',
                            onConflict: 'override'
                        }
                    }
                }
            }
        },

        bless: {
            css: {
                options: {
                    cacheBuster: true,
                    compress: true,
                    logCount: true
                },
                files: {
                    'css/pulsar-ie7.min.css': 'css/pulsar-ie7.css',
                    'css/pulsar-ie8.min.css': 'css/pulsar-ie8.css',
                    'css/pulsar-ie9.min.css': 'css/pulsar-ie9.css',
                    'css/pulsar-ie7-theme-projector.min.css': 'css/pulsar-ie7-theme-projector.css',
                    'css/pulsar-ie8-theme-projector.min.css': 'css/pulsar-ie8-theme-projector.css',
                    'css/pulsar-ie9-theme-projector.min.css': 'css/pulsar-ie9-theme-projector.css'
                }
            }
        },

        compress: {
            dist: {
                options: {
                    archive: 'pulsar.zip'
                },
                files: [{
                    expand: true,
                    cwd: 'dist/',
                    src: ['**/*']
                }]
            }
        },

        browserSync: {
            files: [
                'css/*',
                'dist/**/*',
                'images/**/*',
                'views/**/*'
            ],
            options: {
                proxy: 'http://192.168.13.37/index.php',
                reloadOnRestart: true,
                watchTask: true
            }
	    },

        casperjs: {
            options: {
                async: {
                    parallel: false
                },
                silent: false
            },
            files: ['../pulsar/tests/js/casper.js']
        },

        validation: {
            options: {
                reset: grunt.option('reset') || false,
                stoponerror: false,
                maxTry: 3,
                relaxerror: ['Bad value X-UA-Compatible for attribute http-equiv on element meta.'], // ignores these errors
                generateReport: true,
                errorHTMLRootDir: "tests/validation/error_reports",
                useTimeStamp: true,
                errorTemplate: "tests/validation/w3c_validation_error_Template.html"
            },
            files: {
                src: ['../pulsar/tests/validation/html_output/*.html']
            }
        },

	    'gh-pages': {
            options: {
                base: 'docs/_site',
                repo: 'https://github.com/jadu/pulsar.git'
            },
            src: ['**']
        }

    });

    grunt.config.set('leadingIndent.indentation', 'spaces');

    grunt.config.set('leadingIndent.files', {
        src : [
            'docs/**/*.md',
            'docs/**/*.php',
            'css/**/*',
            'js/**/*',
            'src/**/*',
            'stylesheets/**/*',
            'tests/**/*',
            'views/**/*'
        ]
    });

    grunt.registerTask('default', [
        'copy',
        'scsslint',
        'replace',
        'sass:dev',
        'sass:lexicon',
        'autoprefixer',
        'bless',
        'browserify:dev',
        'browserSync',
        'watch'
    ]);

    grunt.registerTask('post-merge', [
        'exec:fixProximaNova',
        'replace',
        'sass:dev',
        'browserify'
    ]);

    grunt.registerTask('build', [
        'scsslint',
        'replace',
        'sass:dist_modern',
        'sass:dist_ie',
        'autoprefixer',
        'browserify:dist',
        'copy:dist',
        'realFavicon',
        'compress'
    ]);

    grunt.registerTask('deploy', [
        'replace',
        'sass:dist_modern',
        'sass:dist_ie',
        'autoprefixer',
        'browserify:dist',
        'copy:dist',
        'compress'
    ]);

    grunt.registerTask('favicons', [
        'clean:favicons',
        'realFavicon'
    ]);

    grunt.registerTask('wraith', [
        'exec:wraithLatest'
    ]);

    grunt.registerTask('wraith-update', [
        'exec:wraithUpdate',
        'exec:wraithHistory'
    ]);

    grunt.registerTask('update', [
        'exec:updateComposer',
        'exec:updateBrew',
        'exec:updateBower',
        'exec:updateGems',
        'exec:updateNpm'
    ]);

    grunt.registerTask('validate', [
        'casperjs',
        'validation'
    ]);

    // load all grunt tasks
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    sass: {
      dist: {
        options: {
          outputStyle: 'expanded'
        },
        files: {
          'public/css/app.css': 'scss/app.scss',
          'public/css/chat.css': 'scss/chat.scss'
        }
      }
    },

    copy: {
      scripts: {
        expand: true,
        cwd: 'bower_components/',
        src: '**/*.js',
        dest: 'public/js/libs'
      },
      maps: {
        expand: true,
        cwd: 'bower_components/',
        src: '**/*.map',
        dest: 'public/js/libs'
      },
      scss: {
        expand: true,
        cwd: 'bower_components/',
        src: '**/*.scss',
        dest: 'scss/libs'
      },
      fontawesome_fonts: {
        expand: true,
        cwd: 'bower_components/fontawesome/',
        src: [
          '**/*.eot',
          '**/*.svg',
          '**/*.ttf',
          '**/*.woff',
          '**/*.woff2'
        ],
        flatten: true,
        dest: 'public/fonts'
      }
    },

    watch: {
      grunt: {
        files: 'Gruntfile.js',
        options: {
          // Start a live reload server on the default port 35729
          livereload: true,
        }
      },
      sass: {
        files: ['scss/**/*.scss', 'scss/*.scss'],
        tasks: ['sass'],
        options: {
          // Start a live reload server on the default port 35729
          livereload: true,
        }
      },
      react: {
        files: ['jsx/**/*.jsx', 'jsx/*.jsx'],
        tasks: ['react'],
        options: {
          // Start a live reload server on the default port 35729
          livereload: true,
        }
      },
      js: {
        files: '**/*.js',
        tasks: ['test'],
        options: {
          // Start a live reload server on the default port 35729
          livereload: true,
        }
      },
      hmtl: {
        files: '**/*.html',
        options: {
          // Start a live reload server on the default port 35729
          livereload: true,
        }
      }
    },

    clean: {
      scss: ["scss/libs/"],
      javascripts: ["public/js/libs/", "public/js/components"],
      fonts: ["public/fonts/"],
      css: ["public/css"]
    },

    express: {
      options: {
        // Override the command used to start the server.
        // (do not use 'coffee' here, the server will not be able to restart
        //  see below at opts for coffee-script support)
        cmd: process.argv[0],

        // Will turn into: `node OPT1 OPT2 ... OPTN path/to/server.js ARG1 ARG2 ... ARGN`
        // (e.g. opts: ['node_modules/coffee-script/bin/coffee'] will correctly parse coffee-script)
        opts: [ ],
        args: [ ],

        // Setting to `false` will effectively just run `node path/to/server.js`
        background: true,

        // Called when the spawned server throws errors
        fallback: function() {},

        // Override node env's PORT
        port: 3000,

        // Override node env's NODE_ENV
        node_env: undefined,

        // Enable Node's --harmony flag
        harmony: false,

        // Consider the server to be "running" after an explicit delay (in milliseconds)
        // (e.g. when server has no initial output)
        delay: 0,

        // Regular expression that matches server output to indicate it is "running"
        output: ".+",

        // Set --debug (true | false | integer from 1024 to 65535, has precedence over breakOnFirstLine)
        debug: false,

        // Set --debug-brk (true | false | integer from 1024 to 65535)
        breakOnFirstLine: false,

        // Object with properties `out` and `err` both will take a path to a log file and
        // append the output of the server. Make sure the folders exist.
        logs: undefined

      },
      dev: {
        options: {
          script: 'app.js'
        }
      },
      test: {
        options: {
          script: 'test.js'
        }
      },
      prod: {
        options: {
          script: 'production.js',
          node_env: 'production'
        }
      }
    },

    react: {
      dynamic_mappings: {
        files: [
          {
            expand: true,
            cwd: 'jsx',
            src: ['**/*.jsx', '*.jsx'],
            dest: 'public/js/components',
            ext: '.js'
          }
        ]
      }
    },

    'mochaTest': {
      test: {
        options: {
          reporter: 'spec',
          // captureFile: 'results.txt', // Optionally capture the reporter output to a file
          quiet: false, // Optionally suppress output to standard out (defaults to false)
          clearRequireCache: false // Optionally clear the require cache before running tests (defaults to false)
        },
        src: ['test/**/*.js']
      }
    }
  });

  grunt.loadNpmTasks('grunt-sass');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-express-server');
  grunt.loadNpmTasks('grunt-react');
  grunt.loadNpmTasks('grunt-mocha-test');

  grunt.registerTask('build', ['copy', 'sass', 'react']);
  grunt.registerTask('rebuild', ['clean', 'build']);
  grunt.registerTask('dev', ['express:dev', 'watch']);
  grunt.registerTask('test', ['mochaTest']);
  grunt.registerTask('default', ['dev']);

};
<commit_msg>Gruntfile.js: atBegin feature activated for watch<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    sass: {
      dist: {
        options: {
          outputStyle: 'expanded'
        },
        files: {
          'public/css/app.css': 'scss/app.scss',
          'public/css/chat.css': 'scss/chat.scss'
        }
      }
    },

    copy: {
      scripts: {
        expand: true,
        cwd: 'bower_components/',
        src: '**/*.js',
        dest: 'public/js/libs'
      },
      maps: {
        expand: true,
        cwd: 'bower_components/',
        src: '**/*.map',
        dest: 'public/js/libs'
      },
      scss: {
        expand: true,
        cwd: 'bower_components/',
        src: '**/*.scss',
        dest: 'scss/libs'
      },
      fontawesome_fonts: {
        expand: true,
        cwd: 'bower_components/fontawesome/',
        src: [
          '**/*.eot',
          '**/*.svg',
          '**/*.ttf',
          '**/*.woff',
          '**/*.woff2'
        ],
        flatten: true,
        dest: 'public/fonts'
      }
    },

    watch: {
      grunt: {
        files: 'Gruntfile.js',
        options: {
          // Start a live reload server on the default port 35729
          livereload: true,
        }
      },
      sass: {
        files: ['scss/**/*.scss', 'scss/*.scss'],
        tasks: ['sass'],
        options: {
          // Start a live reload server on the default port 35729
          livereload: true,
          atBegin: true
        }
      },
      react: {
        files: ['jsx/**/*.jsx', 'jsx/*.jsx'],
        tasks: ['react'],
        options: {
          // Start a live reload server on the default port 35729
          livereload: true,
          atBegin: true
        }
      },
      js: {
        files: '**/*.js',
        tasks: ['test'],
        options: {
          // Start a live reload server on the default port 35729
          livereload: true,
          atBegin: true
        }
      },
      hmtl: {
        files: '**/*.html',
        options: {
          // Start a live reload server on the default port 35729
          livereload: true,
        }
      }
    },

    clean: {
      scss: ["scss/libs/"],
      javascripts: ["public/js/libs/", "public/js/components"],
      fonts: ["public/fonts/"],
      css: ["public/css"]
    },

    express: {
      options: {
        // Override the command used to start the server.
        // (do not use 'coffee' here, the server will not be able to restart
        //  see below at opts for coffee-script support)
        cmd: process.argv[0],

        // Will turn into: `node OPT1 OPT2 ... OPTN path/to/server.js ARG1 ARG2 ... ARGN`
        // (e.g. opts: ['node_modules/coffee-script/bin/coffee'] will correctly parse coffee-script)
        opts: [ ],
        args: [ ],

        // Setting to `false` will effectively just run `node path/to/server.js`
        background: true,

        // Called when the spawned server throws errors
        fallback: function() {},

        // Override node env's PORT
        port: 3000,

        // Override node env's NODE_ENV
        node_env: undefined,

        // Enable Node's --harmony flag
        harmony: false,

        // Consider the server to be "running" after an explicit delay (in milliseconds)
        // (e.g. when server has no initial output)
        delay: 0,

        // Regular expression that matches server output to indicate it is "running"
        output: ".+",

        // Set --debug (true | false | integer from 1024 to 65535, has precedence over breakOnFirstLine)
        debug: false,

        // Set --debug-brk (true | false | integer from 1024 to 65535)
        breakOnFirstLine: false,

        // Object with properties `out` and `err` both will take a path to a log file and
        // append the output of the server. Make sure the folders exist.
        logs: undefined

      },
      dev: {
        options: {
          script: 'app.js'
        }
      },
      test: {
        options: {
          script: 'test.js'
        }
      },
      prod: {
        options: {
          script: 'production.js',
          node_env: 'production'
        }
      }
    },

    react: {
      dynamic_mappings: {
        files: [
          {
            expand: true,
            cwd: 'jsx',
            src: ['**/*.jsx', '*.jsx'],
            dest: 'public/js/components',
            ext: '.js'
          }
        ]
      }
    },

    'mochaTest': {
      test: {
        options: {
          reporter: 'spec',
          // captureFile: 'results.txt', // Optionally capture the reporter output to a file
          quiet: false, // Optionally suppress output to standard out (defaults to false)
          clearRequireCache: false // Optionally clear the require cache before running tests (defaults to false)
        },
        src: ['test/**/*.js']
      }
    }
  });

  grunt.loadNpmTasks('grunt-sass');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-express-server');
  grunt.loadNpmTasks('grunt-react');
  grunt.loadNpmTasks('grunt-mocha-test');

  grunt.registerTask('build', ['copy', 'sass', 'react']);
  grunt.registerTask('rebuild', ['clean', 'build']);
  grunt.registerTask('dev', ['express:dev', 'watch']);
  grunt.registerTask('test', ['mochaTest']);
  grunt.registerTask('default', ['dev']);

};
<|endoftext|>


<commit_before>var files = require('./angularFiles').files;
var util = require('./lib/grunt/utils.js');

module.exports = function(grunt) {
  //grunt plugins
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-jasmine-node');
  grunt.loadNpmTasks('grunt-ddescribe-iit');
  grunt.loadNpmTasks('grunt-merge-conflict');
  grunt.loadNpmTasks('grunt-parallel');
  grunt.loadTasks('lib/grunt');

  var NG_VERSION = util.getVersion();
  var dist = 'angular-'+ NG_VERSION.full;

  //global beforeEach
  util.init();

  //config
  grunt.initConfig({
    NG_VERSION: NG_VERSION,

    parallel: {
      travis: {
        options: {
          stream: true
        },
        tasks: [
          util.parallelTask('tests:docs'),
          util.parallelTask('tests:modules'),
          util.parallelTask('tests:jquery'),
          util.parallelTask('tests:jqlite'),
          util.parallelTask('tests:end2end')
        ]
      }
    },

    connect: {
      devserver: {
        options: {
          port: 8000,
          hostname: '0.0.0.0',
          base: '.',
          keepalive: true,
          middleware: function(connect, options){
            return [
              //uncomment to enable CSP
              // util.csp(),
              util.rewrite(),
              connect.favicon('images/favicon.ico'),
              connect.static(options.base),
              connect.directory(options.base)
            ];
          }
        }
      },
      testserver: {
        options: {
          middleware: function(connect, options){
            return [
              function(req, resp, next) {
                // cache get requests to speed up tests on travis
                if (req.method === 'GET') {
                  resp.setHeader('Cache-control', 'public, max-age=3600');
                }

                next();
              },
              connect.favicon('images/favicon.ico'),
              connect.static(options.base)
            ];
          }
        }
      }
    },

    tests: {
      jqlite: 'karma-jqlite.conf.js',
      jquery: 'karma-jquery.conf.js',
      docs: 'karma-docs.conf.js',
      modules: 'karma-modules.conf.js',
      //NOTE run grunt test:e2e instead and it will start a webserver for you
      end2end: 'karma-e2e.conf.js'
    },

    autotest: {
      jqlite: 'karma-jqlite.conf.js',
      jquery: 'karma-jquery.conf.js',
      modules: 'karma-modules.conf.js',
      docs: 'karma-docs.conf.js'
    },

    clean: {build: ['build']},

    build: {
      scenario: {
        dest: 'build/angular-scenario.js',
        src: [
          'bower_components/jquery/jquery.js',
          util.wrap([files['angularSrc'], files['angularScenario']], 'ngScenario/angular')
        ],
        styles: {
          css: ['css/angular.css', 'css/angular-scenario.css']
        }
      },
      angular: {
        dest: 'build/angular.js',
        src: util.wrap([files['angularSrc']], 'angular'),
        styles: {
          css: ['css/angular.css'],
          minify: true
        }
      },
      loader: {
        dest: 'build/angular-loader.js',
        src: util.wrap(['src/loader.js'], 'loader')
      },
      touch: {
        dest: 'build/angular-touch.js',
        src: util.wrap([
          'src/ngTouch/touch.js',
          'src/ngTouch/swipe.js',
          'src/ngTouch/directive/ngClick.js',
          'src/ngTouch/directive/ngSwipe.js'
            ], 'module')
      },
      mocks: {
        dest: 'build/angular-mocks.js',
        src: ['src/ngMock/angular-mocks.js'],
        strict: false
      },
      sanitize: {
        dest: 'build/angular-sanitize.js',
        src: util.wrap([
          'src/ngSanitize/sanitize.js',
          'src/ngSanitize/filter/linky.js'
        ], 'module')
      },
      resource: {
        dest: 'build/angular-resource.js',
        src: util.wrap(['src/ngResource/resource.js'], 'module')
      },
      animate: {
        dest: 'build/angular-animate.js',
        src: util.wrap(['src/ngAnimate/animate.js'], 'module')
      },
      route: {
        dest: 'build/angular-route.js',
        src: util.wrap([
          'src/ngRoute/routeUtils.js',
          'src/ngRoute/route.js',
          'src/ngRoute/routeParams.js',
          'src/ngRoute/directive/ngView.js'
        ], 'module')
      },
      cookies: {
        dest: 'build/angular-cookies.js',
        src: util.wrap(['src/ngCookies/cookies.js'], 'module')
      }
    },

    min: {
      angular: 'build/angular.js',
      animate: 'build/angular-animate.js',
      cookies: 'build/angular-cookies.js',
      loader: 'build/angular-loader.js',
      touch: 'build/angular-touch.js',
      resource: 'build/angular-resource.js',
      route: 'build/angular-route.js',
      sanitize: 'build/angular-sanitize.js'
    },

    docs: {
      process: ['build/docs/*.html', 'build/docs/.htaccess']
    },

    "jasmine-node": {
      run: { spec: 'docs/spec' }
    },

    "ddescribe-iit": {
      files: [
        'test/**/*.js',
        '!test/ngScenario/DescribeSpec.js'
      ]
    },

    "merge-conflict": {
      files: [
        'src/**/*',
        'test/**/*',
        'docs/**/*',
        'css/**/*'
      ]
    },

    copy: {
      i18n: {
        files: [
          { src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true }
        ]
      }
    },

    compress: {
      build: {
        options: {archive: 'build/' + dist +'.zip'},
        src: ['**'], cwd: 'build', expand: true, dot: true, dest: dist + '/'
      }
    },

    write: {
      versionTXT: {file: 'build/version.txt', val: NG_VERSION.full},
      versionJSON: {file: 'build/version.json', val: JSON.stringify(NG_VERSION)}
    }
  });

  //alias tasks
  grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['package','test:unit', 'tests:docs', 'test:e2e']);
  grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
  grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
  grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']);
  grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
  grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']);
  grunt.registerTask('test:e2e', 'Run the end to end tests with Karma and keep a test server running in the background', ['connect:testserver', 'tests:end2end']);
  grunt.registerTask('test:docgen', ['jasmine-node']);

  grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
  grunt.registerTask('webserver', ['connect:devserver']);
  grunt.registerTask('package', ['bower','clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']);
  grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict']);
  grunt.registerTask('default', ['package']);
};
<commit_msg>chore(grunt): ensure that grunt uses zip for compression<commit_after>var files = require('./angularFiles').files;
var util = require('./lib/grunt/utils.js');

module.exports = function(grunt) {
  //grunt plugins
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-jasmine-node');
  grunt.loadNpmTasks('grunt-ddescribe-iit');
  grunt.loadNpmTasks('grunt-merge-conflict');
  grunt.loadNpmTasks('grunt-parallel');
  grunt.loadTasks('lib/grunt');

  var NG_VERSION = util.getVersion();
  var dist = 'angular-'+ NG_VERSION.full;

  //global beforeEach
  util.init();

  //config
  grunt.initConfig({
    NG_VERSION: NG_VERSION,

    parallel: {
      travis: {
        options: {
          stream: true
        },
        tasks: [
          util.parallelTask('tests:docs'),
          util.parallelTask('tests:modules'),
          util.parallelTask('tests:jquery'),
          util.parallelTask('tests:jqlite'),
          util.parallelTask('tests:end2end')
        ]
      }
    },

    connect: {
      devserver: {
        options: {
          port: 8000,
          hostname: '0.0.0.0',
          base: '.',
          keepalive: true,
          middleware: function(connect, options){
            return [
              //uncomment to enable CSP
              // util.csp(),
              util.rewrite(),
              connect.favicon('images/favicon.ico'),
              connect.static(options.base),
              connect.directory(options.base)
            ];
          }
        }
      },
      testserver: {
        options: {
          middleware: function(connect, options){
            return [
              function(req, resp, next) {
                // cache get requests to speed up tests on travis
                if (req.method === 'GET') {
                  resp.setHeader('Cache-control', 'public, max-age=3600');
                }

                next();
              },
              connect.favicon('images/favicon.ico'),
              connect.static(options.base)
            ];
          }
        }
      }
    },

    tests: {
      jqlite: 'karma-jqlite.conf.js',
      jquery: 'karma-jquery.conf.js',
      docs: 'karma-docs.conf.js',
      modules: 'karma-modules.conf.js',
      //NOTE run grunt test:e2e instead and it will start a webserver for you
      end2end: 'karma-e2e.conf.js'
    },

    autotest: {
      jqlite: 'karma-jqlite.conf.js',
      jquery: 'karma-jquery.conf.js',
      modules: 'karma-modules.conf.js',
      docs: 'karma-docs.conf.js'
    },

    clean: {build: ['build']},

    build: {
      scenario: {
        dest: 'build/angular-scenario.js',
        src: [
          'bower_components/jquery/jquery.js',
          util.wrap([files['angularSrc'], files['angularScenario']], 'ngScenario/angular')
        ],
        styles: {
          css: ['css/angular.css', 'css/angular-scenario.css']
        }
      },
      angular: {
        dest: 'build/angular.js',
        src: util.wrap([files['angularSrc']], 'angular'),
        styles: {
          css: ['css/angular.css'],
          minify: true
        }
      },
      loader: {
        dest: 'build/angular-loader.js',
        src: util.wrap(['src/loader.js'], 'loader')
      },
      touch: {
        dest: 'build/angular-touch.js',
        src: util.wrap([
          'src/ngTouch/touch.js',
          'src/ngTouch/swipe.js',
          'src/ngTouch/directive/ngClick.js',
          'src/ngTouch/directive/ngSwipe.js'
            ], 'module')
      },
      mocks: {
        dest: 'build/angular-mocks.js',
        src: ['src/ngMock/angular-mocks.js'],
        strict: false
      },
      sanitize: {
        dest: 'build/angular-sanitize.js',
        src: util.wrap([
          'src/ngSanitize/sanitize.js',
          'src/ngSanitize/filter/linky.js'
        ], 'module')
      },
      resource: {
        dest: 'build/angular-resource.js',
        src: util.wrap(['src/ngResource/resource.js'], 'module')
      },
      animate: {
        dest: 'build/angular-animate.js',
        src: util.wrap(['src/ngAnimate/animate.js'], 'module')
      },
      route: {
        dest: 'build/angular-route.js',
        src: util.wrap([
          'src/ngRoute/routeUtils.js',
          'src/ngRoute/route.js',
          'src/ngRoute/routeParams.js',
          'src/ngRoute/directive/ngView.js'
        ], 'module')
      },
      cookies: {
        dest: 'build/angular-cookies.js',
        src: util.wrap(['src/ngCookies/cookies.js'], 'module')
      }
    },

    min: {
      angular: 'build/angular.js',
      animate: 'build/angular-animate.js',
      cookies: 'build/angular-cookies.js',
      loader: 'build/angular-loader.js',
      touch: 'build/angular-touch.js',
      resource: 'build/angular-resource.js',
      route: 'build/angular-route.js',
      sanitize: 'build/angular-sanitize.js'
    },

    docs: {
      process: ['build/docs/*.html', 'build/docs/.htaccess']
    },

    "jasmine-node": {
      run: { spec: 'docs/spec' }
    },

    "ddescribe-iit": {
      files: [
        'test/**/*.js',
        '!test/ngScenario/DescribeSpec.js'
      ]
    },

    "merge-conflict": {
      files: [
        'src/**/*',
        'test/**/*',
        'docs/**/*',
        'css/**/*'
      ]
    },

    copy: {
      i18n: {
        files: [
          { src: 'src/ngLocale/**', dest: 'build/i18n/', expand: true, flatten: true }
        ]
      }
    },

    compress: {
      build: {
        options: {archive: 'build/' + dist +'.zip', mode: 'zip'},
        src: ['**'], cwd: 'build', expand: true, dot: true, dest: dist + '/'
      }
    },

    write: {
      versionTXT: {file: 'build/version.txt', val: NG_VERSION.full},
      versionJSON: {file: 'build/version.json', val: JSON.stringify(NG_VERSION)}
    }
  });

  //alias tasks
  grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['package','test:unit', 'tests:docs', 'test:e2e']);
  grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
  grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
  grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']);
  grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
  grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']);
  grunt.registerTask('test:e2e', 'Run the end to end tests with Karma and keep a test server running in the background', ['connect:testserver', 'tests:end2end']);
  grunt.registerTask('test:docgen', ['jasmine-node']);

  grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
  grunt.registerTask('webserver', ['connect:devserver']);
  grunt.registerTask('package', ['bower','clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']);
  grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict']);
  grunt.registerTask('default', ['package']);
};
<|endoftext|>


<commit_before>'use strict';
var redis = require('redis');

//using multiline comments so scss preserves them in the css
var copyrightBanner =
`/*!
@license
Copyright 2016 Jonathan Yonker

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/`;

module.exports = function (grunt) {
  // load all grunt tasks
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    mochaTest: {
      integration: {
        options: {
          reporter: 'spec'
        },
        src: ['app.js', 'routes/**/*(!spec).js', 'services/**/*(!spec).js', 'integration.spec.js']
      },
      unit: {
        options: {
          reporter: 'spec'
        },
        src: ['app.js', 'routes/**/*.js', 'services/**/*.js']
      }
    },
    shell: {
      herokuLocal: {
        command: 'heroku local'
      },
      failBuildOnGitDiff: {
        command: 'git status --porcelain',
        options: {
          stdout: false,
          stderr: false,
          stdin: false,
          callback: function (err, stdout, stderr, cb) {
            var changesDetected = !!stdout.length;
            if (changesDetected) {
              grunt.warn('Git changes detected. Did you forget to build and commit dist?');
            } else {
              cb();
            }
          }
        }
      }
    },
    filerev: {
      js: {
        src: 'dist/**/*.js'
      },
      css :{
        src: 'dist/**/*.css'
      }
    },
    copy: {
      index: {
        src: 'public/index.html',
        dest: 'dist/index.html'
      }
    },
    useminPrepare: {
      html: 'public/index.html',
      options: {
        dest: 'dist'
      }
    },
    usemin: {
      html: 'dist/index.html',
      options: {
        assetsDirs: ['dist']
      }
    },
    clean: {
      dist: ['dist/**/*.*']
    },
    sass: {
      dist: {
        src: 'public/styles/*.scss',
        dest: 'public/generated/compiled.css'
      }
    },
    env : {
      prod : {
        PRODUCTION_MODE: 'true'
      },
      local : {
        NEW_RELIC_ENABLED: 'false',
        REDISCLOUD_URL: 'redis://localhost:6379'
      },
      ci: {
        NEW_RELIC_ENABLED: 'false'
      }
    },
    uglify: {
      options: {
        preserveComments: 'some'
      }
    },
    usebanner: {
      copyright: {
        options: {
          position: 'top',
          banner: copyrightBanner,
          replace: true
        },
        files: {
          src: [
            'public/scripts/**/*.js',
            'public/styles/**/*.scss',
            'routes/**/*.js',
            'services/**/!(url-validation-regex).js',
            'app.js',
            'integration.spec.js'
          ]
        }
      }
    }
  });

  grunt.registerTask('clearData', function() {
    var done = this.async();

    //TODO: grunt-services doesn't wait for redis to start completely, so 100ms delay
    //good opportunity to PR grunt-services to add better wait logic
    setTimeout(function () {
      var redisClient = redis.createClient(process.env.REDIS_URL);

      redisClient.on("ready", function () {
        redisClient.flushall(function () {
          done();
        });
      });
    }, 100);
  });

  //TODO: set a different server port for integration testing to allow testing while serving
  grunt.registerTask('integration', ['env:local', 'startRedis', 'clearData', 'force:mochaTest:integration', 'stopRedis']);
  grunt.registerTask('unit', ['mochaTest:unit']);

  grunt.registerTask('ci', ['env:ci', 'build', 'shell:failBuildOnGitDiff', 'clearData', 'mochaTest']);

  grunt.registerTask('build', ['clean', 'usebanner', 'copy:index', 'useminPrepare', 'sass', 'concat', 'cssmin', 'uglify', 'filerev', 'usemin']);

  grunt.task.registerTask('serve', '', function(environment) {
    var tasks = ['env:local', 'startRedis', 'shell:herokuLocal', 'stopRedis'];

    if (environment === 'prod') {
      tasks.unshift('env:prod');
    }

    grunt.task.run(tasks);
  });
};<commit_msg>Looks like the redis client no longer defaults to the default redis url.<commit_after>'use strict';
var redis = require('redis');

//using multiline comments so scss preserves them in the css
var copyrightBanner =
`/*!
@license
Copyright 2016 Jonathan Yonker

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/`;

module.exports = function (grunt) {
  // load all grunt tasks
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    mochaTest: {
      integration: {
        options: {
          reporter: 'spec'
        },
        src: ['app.js', 'routes/**/*(!spec).js', 'services/**/*(!spec).js', 'integration.spec.js']
      },
      unit: {
        options: {
          reporter: 'spec'
        },
        src: ['app.js', 'routes/**/*.js', 'services/**/*.js']
      }
    },
    shell: {
      herokuLocal: {
        command: 'heroku local'
      },
      failBuildOnGitDiff: {
        command: 'git status --porcelain',
        options: {
          stdout: false,
          stderr: false,
          stdin: false,
          callback: function (err, stdout, stderr, cb) {
            var changesDetected = !!stdout.length;
            if (changesDetected) {
              grunt.warn('Git changes detected. Did you forget to build and commit dist?');
            } else {
              cb();
            }
          }
        }
      }
    },
    filerev: {
      js: {
        src: 'dist/**/*.js'
      },
      css :{
        src: 'dist/**/*.css'
      }
    },
    copy: {
      index: {
        src: 'public/index.html',
        dest: 'dist/index.html'
      }
    },
    useminPrepare: {
      html: 'public/index.html',
      options: {
        dest: 'dist'
      }
    },
    usemin: {
      html: 'dist/index.html',
      options: {
        assetsDirs: ['dist']
      }
    },
    clean: {
      dist: ['dist/**/*.*']
    },
    sass: {
      dist: {
        src: 'public/styles/*.scss',
        dest: 'public/generated/compiled.css'
      }
    },
    env : {
      prod : {
        PRODUCTION_MODE: 'true'
      },
      local : {
        NEW_RELIC_ENABLED: 'false',
        REDISCLOUD_URL: 'redis://localhost:6379'
      }
    },
    uglify: {
      options: {
        preserveComments: 'some'
      }
    },
    usebanner: {
      copyright: {
        options: {
          position: 'top',
          banner: copyrightBanner,
          replace: true
        },
        files: {
          src: [
            'public/scripts/**/*.js',
            'public/styles/**/*.scss',
            'routes/**/*.js',
            'services/**/!(url-validation-regex).js',
            'app.js',
            'integration.spec.js'
          ]
        }
      }
    }
  });

  grunt.registerTask('clearData', function() {
    var done = this.async();

    //TODO: grunt-services doesn't wait for redis to start completely, so 100ms delay
    //good opportunity to PR grunt-services to add better wait logic
    setTimeout(function () {
      var redisClient = redis.createClient(process.env.REDIS_URL);

      redisClient.on("ready", function () {
        redisClient.flushall(function () {
          done();
        });
      });
    }, 100);
  });

  //TODO: set a different server port for integration testing to allow testing while serving
  grunt.registerTask('integration', ['env:local', 'startRedis', 'clearData', 'force:mochaTest:integration', 'stopRedis']);
  grunt.registerTask('unit', ['mochaTest:unit']);

  grunt.registerTask('ci', ['env:local', 'build', 'shell:failBuildOnGitDiff', 'clearData', 'mochaTest']);

  grunt.registerTask('build', ['clean', 'usebanner', 'copy:index', 'useminPrepare', 'sass', 'concat', 'cssmin', 'uglify', 'filerev', 'usemin']);

  grunt.task.registerTask('serve', '', function(environment) {
    var tasks = ['env:local', 'startRedis', 'shell:herokuLocal', 'stopRedis'];

    if (environment === 'prod') {
      tasks.unshift('env:prod');
    }

    grunt.task.run(tasks);
  });
};<|endoftext|>


<commit_before>module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            files: ['Gruntfile.js', '*.js'],
            options: {
                ignores: ['test*']
            }
        },
        jscs: {
            src: '*.js',
            options: {
                config: '.jscsrc',
                excludeFiles: ['test*']
            }
        },
        jsbeautifier: {
            files: ['*.js'],
            options: {}
        },
        nodemon: {
            dev: {
                script: 'app.js',
                options: {
                    nodeArgs: ['--debug']
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-jscs'); // js code style
    grunt.loadNpmTasks('grunt-jsbeautifier');
    grunt.loadNpmTasks('grunt-nodemon');

    grunt.registerTask('default', ['jsbeautifier', 'jshint', 'nodemon']);
    grunt.registerTask('style', ['jscs']);
    grunt.registerTask('start', ['nodemon']);
};
<commit_msg>Edited Gruntfile<commit_after>module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            files: ['Gruntfile.js', '*.js'],
            options: {
                ignores: ['test*']
            }
        },
        jscs: {
            src: '*.js',
            options: {
                config: '.jscsrc',
                excludeFiles: ['test*']
            }
        },
        jsbeautifier: {
            files: ['*.js'],
            options: {}
        },
        nodemon: {
            dev: {
                script: 'index.js',
                options: {
                    nodeArgs: ['--debug']
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-jscs'); // js code style
    grunt.loadNpmTasks('grunt-jsbeautifier');
    grunt.loadNpmTasks('grunt-nodemon');

    grunt.registerTask('default', ['jsbeautifier', 'jshint', 'nodemon']);
    grunt.registerTask('style', ['jscs']);
    grunt.registerTask('start', ['nodemon']);
};
<|endoftext|>


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

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    clean: {
      tmp: ["tmp"],
      dist: ["dist"]
    },
    concat: {
      options: {
        stripBanners: false,
        banner: '/*!\n' +
          ' * <%= pkg.name %> - v<%= pkg.version %> - \n' +
          ' * build: <%= grunt.template.today("yyyy-mm-dd") %>\n' +
          ' */\n\n',
      },
      dist: {
        src: [
          'src/<%= pkg.name %>.js'
        ],
        dest: 'tmp/<%= pkg.name %>.js',
      },
    },
    // Lint definitions
    jshint: {
      all: ["src/**.js"],
      options: {
        jshintrc: ".jshintrc"
      }
    },
    uglify: {
      options: {
        stripBanners: false
      },
      dist: {
        files: {
          'tmp/<%= pkg.name %>.min.js': [ 'src/<%= pkg.name %>.js']
        }
      }
    },
    copy: {
      build: {
        expand: true,
        cwd: 'tmp',
        src: ['<%= pkg.name %>.js', '<%= pkg.name %>.js'],
        dest: 'dist',
        flatten: true,
        filter: 'isFile'
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks("grunt-contrib-jshint");
  grunt.loadNpmTasks('grunt-contrib-uglify');

  grunt.registerTask('default', ['clean:dist', 'jshint', 'concat', 'uglify', 'copy', 'clean:tmp']);

};<commit_msg>Fixed old build settings<commit_after>module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    clean: {
      tmp: ["tmp"],
      dist: ["dist"]
    },
    concat: {
      options: {
        stripBanners: false,
        banner: '/*!\n' +
          ' * <%= pkg.name %> - v<%= pkg.version %> - \n' +
          ' * build: <%= grunt.template.today("yyyy-mm-dd") %>\n' +
          ' */\n\n',
      },
      dist: {
        src: [
          'src/<%= pkg.name %>.js'
        ],
        dest: 'tmp/<%= pkg.name %>.js',
      },
    },
    // Lint definitions
    jshint: {
      all: ["src/**.js"],
      options: {
        jshintrc: ".jshintrc"
      }
    },
    uglify: {
      options: {
        stripBanners: false
      },
      dist: {
        files: {
          'dist/<%= pkg.name %>.min.js': [ 'dist/<%= pkg.name %>.js']
        }
      }
    },
    copy: {
      build: {
        expand: true,
        cwd: 'tmp',
        src: ['<%= pkg.name %>.js', '<%= pkg.name %>.js'],
        dest: 'dist',
        flatten: true,
        filter: 'isFile'
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks("grunt-contrib-jshint");
  grunt.loadNpmTasks('grunt-contrib-uglify');

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

};<|endoftext|>