<commit_before>/*global module:false*/
"use strict";
module.exports = function(grunt) {

    grunt.initConfig({
        pkg      : grunt.file.readJSON('package.json'),
        jshint   : {
            all     : [ '**/*.js', '!node_modules/**/*'],
            options : {
                jshintrc : '.jshintrc'
            }
        },
        jscs     : {
            main    : [ '**/*.js', '!node_modules/**/*'],
            options : {
                config : '.jscs.json',
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks("grunt-jscs-checker");

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

};
<commit_msg>jscs fixes<commit_after>/*global module:false*/
"use strict";
module.exports = function(grunt) {

    grunt.initConfig({
        pkg    : grunt.file.readJSON('package.json'),
        jshint : {
            all     : [ '**/*.js', '!node_modules/**/*'],
            options : {
                jshintrc : '.jshintrc'
            }
        },
        jscs   : {
            main    : [ '**/*.js', '!node_modules/**/*'],
            options : {
                config : '.jscs.json',
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks("grunt-jscs-checker");

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

};
<|endoftext|>


<commit_before>const commonjs = require('rollup-plugin-commonjs');
const resolve = require('rollup-plugin-node-resolve');

module.exports = function (grunt) {

  grunt.initConfig({

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

    sass: {
      options: {
        style: 'compressed',
        sourcemap: 'file'
      },
      all: {
        files: [{
          expand: true,
          cwd: 'src/styles',
          src: '*.scss',
          dest: 'dist/styles',
          ext: '.css'
        }]
      }
    },

    rollup: {
      options: {
        format: 'iife',
        moduleName: 'yvs',
        plugins: [
          resolve(),
          commonjs()
        ]
      },
      all: {
        files: {
          'dist/scripts/popup.js': ['src/scripts/popup.js']
        }
      }
    },

    watch: {
      pages: {
        files: ['src/*.html'],
        tasks: ['copy']
      },
      scripts: {
        files: ['src/scripts/*.js'],
        tasks: ['rollup']
      },
      styles: {
        files: ['src/styles/*.scss'],
        tasks: ['sass']
      }
    },

    copy: {
      all: {
        files: [{
            expand: true,
            cwd: 'src',
            src: [
              '*.html',
              'manifest.json',
              'icon.png',
              'bible'
            ],
            dest: 'dist'
        }]
      }
    }

  });

  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-rollup');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-copy');

  grunt.registerTask('build', [
    'copy',
    'sass',
    'rollup'
  ]);

  grunt.registerTask('serve', [
    'build',
    'watch'
  ]);

};
<commit_msg>Recompile scripts when components are changed<commit_after>const commonjs = require('rollup-plugin-commonjs');
const resolve = require('rollup-plugin-node-resolve');

module.exports = function (grunt) {

  grunt.initConfig({

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

    sass: {
      options: {
        style: 'compressed',
        sourcemap: 'file'
      },
      all: {
        files: [{
          expand: true,
          cwd: 'src/styles',
          src: '*.scss',
          dest: 'dist/styles',
          ext: '.css'
        }]
      }
    },

    rollup: {
      options: {
        format: 'iife',
        moduleName: 'yvs',
        plugins: [
          resolve(),
          commonjs()
        ]
      },
      all: {
        files: {
          'dist/scripts/popup.js': ['src/scripts/popup.js']
        }
      }
    },

    watch: {
      pages: {
        files: ['src/*.html'],
        tasks: ['copy']
      },
      scripts: {
        files: ['src/scripts/**/*.js'],
        tasks: ['rollup']
      },
      styles: {
        files: ['src/styles/*.scss'],
        tasks: ['sass']
      }
    },

    copy: {
      all: {
        files: [{
            expand: true,
            cwd: 'src',
            src: [
              '*.html',
              'manifest.json',
              'icon.png',
              'bible'
            ],
            dest: 'dist'
        }]
      }
    }

  });

  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-rollup');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-copy');

  grunt.registerTask('build', [
    'copy',
    'sass',
    'rollup'
  ]);

  grunt.registerTask('serve', [
    'build',
    'watch'
  ]);

};
<|endoftext|>


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

    var fs = require('fs');
    var _ = require('lodash');

    var awsConfig = {
        accessKey: false,
        secretKey: false,
        region: false,
        s3Bucket: false
    };

    // Breaks out the keys and also gives us a nice reference of what
    // needs to be in here without being able to be changed.
    var awsConfigKeys = _.keys(awsConfig);

    // Take inputs for the awsConfig, prefixed with 'aws.'.
    // For example accessKey can be inputted with '--aws.accessKey=accessKey'
    _.each(awsConfigKeys, function(awsConfigKey){
        var optionKey = 'aws.' + awsConfigKey;
        var optionValue = grunt.option(optionKey);
        if (optionValue) {
            // Use the original key to update it.
            awsConfig[awsConfigKey] = optionValue;
        }
    });

    grunt.file.move = function(from,to) {
        grunt.log.writeln('Moved '+from.cyan+' to '+to.cyan);
        grunt.file.copy(from,to);
        grunt.file.delete(from);
    };

    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-version');
    grunt.loadNpmTasks('grunt-aws');
    grunt.loadNpmTasks('grunt-fastly');
    grunt.loadNpmTasks('grunt-git');

    grunt.initConfig({
        aws: awsConfig,
        version: {
            options: {
                pkg: grunt.file.readJSON('package.json')
            },
            eloqua: {
                options: {
                    prefix: '@version *'
                },
                src: ['dist/plugins/**/*.js']
            }
        },
        watch: {
            js : {
                files: ['./src/*.js'],
                tasks: ['compileJS'],
                options: {
                    spawn: false,
                    debounceDelay: 250,
                    interrupt: true
                }
            }
        },
        requirejs: {
            compile_eloqua_plugin: {
                options: {
                    baseUrl: './src',
                    include: ['eloqua'],
                    optimize: 'none',
                    out: './dist/plugins/eloqua/main.js',
                    skipSemiColonInsertion: true
                }

            }
        },
        compress: {
            release: {
                options: {
                    mode: 'gzip'
                },
                files: [
                    {src: ['dist/plugins/eloqua/main.js'], dest: 'dist/plugins/eloqua/main.js', filter: 'isFile'}
                ]
            }
        },
        md5: {
            release: {
                src:['dist/plugins/**/*.*']
            }
        },
        s3: {
            releaseNonGzip: {
                options: {
                    accessKeyId: "<%= aws.accessKey %>",
                    secretAccessKey: "<%= aws.secretKey %>",
                    region: "<%= aws.region %>",
                    bucket: "<%= aws.s3Bucket %>",
                    access: 'public-read',
                    // This flag auto gzips all files it uploads,
                    // since we handle it ourselves we disable it.
                    gzip: false,
                    cache: false, // Always upload, even if it's the same etag
                    headers: {
                        CacheControl: 86400 * 30 // 1 month
                    }
                },
                cwd: "./dist/plugins/",
                src: ["**/*.*", "!**.js.gz"]
            },
            // Gzip files need to have the content encoding header.
            releaseGzip: {
                options: {
                    accessKeyId: "<%= aws.accessKey %>",
                    secretAccessKey: "<%= aws.secretKey %>",
                    region: "<%= aws.region %>",
                    bucket: "<%= aws.s3Bucket %>",
                    access: 'public-read',
                    // This flag auto gzips all files it uploads,
                    // since we handle it ourselves we disable it.
                    gzip: false,
                    cache: false, // Always upload, even if it's the same etag
                    headers: {
                        ContentEncoding: 'gzip',
                        CacheControl: 86400 * 30 // 1 month
                    }
                },
                cwd: "./dist/plugins/",
                src: ['**/*.js.gz']
            }
        },
        gittag: {
            tagRelease: {
                options: {
                    cwd: './',
                    verbose: true,
                    tag: String(grunt.file.readJSON('package.json').version)
                }
            }
        },
        gitpush: {
            pushReleaseTag: {
                options: {
                    cwd: './',
                    verbose: true,
                    tags: true
                }
            }
        },
        fastly: {
            options: {
                key: grunt.option('fastly.key')
            },
            plugins: {
                options: {
                    urls: [],
                    host: grunt.option('fastly.host')
                }
            }
        }

    });

    /**
     * This is kind of a hack, because we want to dynamically invalidate fastly based on the files we
     * have created in a directory, we have to set them AFTER they are created.  This updates the config
     * in order to invalidate the correct files.
     */
    grunt.registerTask('updateFastlyOptions', 'Update the Fastly Inputs', function() {
        var fastly = grunt.config.get('fastly');

        /**
         * This reads all the files we are releasing (both major and specific versions)
         * We technically only need to invalidate the major version since there was a file there before
         * but since this is easy to do and may help if someone ever mistags, we invalidate all.
         */
        fastly.plugins.options.urls = fs.readdirSync('./dist/').map(function(value, key, array) {
            return '/' + value;
        });

        grunt.log.writeln('Purging cache for host ' + fastly.plugins.options.host);
        grunt.log.writeln('Purging cache for urls ' + fastly.plugins.options.urls);

        // Set the config back.
        grunt.config.set('fastly', fastly);
    });

    grunt.registerTask('clean','Cleans build artifacts',function(){
        grunt.file.delete('dist/');
        grunt.log.writeln('Removed '+'dist/'.green);
    });

    grunt.registerTask('rename','Renames build artifacts to include version number',function(){
        // If pushing to develop or a feature branch, codeship sends in the branch name so that builds can
        // be pushed to S3 with the branch name included to assist multi-branch development
        var branchFileModifier = '';
        if(grunt.option('branch')) {
            branchFileModifier = '-' + grunt.option('branch').replace('/', '-');
        }

        var version = String(grunt.file.readJSON('package.json').version);
        var versionArray = version.split('.');
        if (versionArray.length < 3) {
            grunt.fail.warn('Version should be specified in Major.Minor.Patch (1.0.0)');
        }
        var majorVersion = versionArray[0];

        var plugins = ['eloqua'];
        _.each(plugins, function(type){
            /**
             * Output files for specific Version (when version = 1.3.0)
             * These should never overwrite files in our s3 bucket, always should be unique.
             * Code changes require update to version.
             *
             * plugins/eloqua/main-1.0.0.js
             * plugins/eloqua/main-1.0.0.gz.js
             */
            grunt.file.move('dist/plugins/' + type + '/main.js', 'dist/plugins/' + type + '/' + branchFileModifier + '-' + version + '.js');
            grunt.file.move('dist/plugins/' + type + '/main.js.gz', 'dist/plugins' + type + '/' + branchFileModifier + '-' + version + '.js.gz');

            /**
             * Output files for Major Version (when version = 1.3.0 -- majorVersion = 1)
             * These replace the existing major release version.  The concept is that customers
             * can use v1 and we can update it with non-breaking changes without them having to update their
             * source.
             *
             * plugins/eloqua/main-v1.js
             * plugins/eloqua/main-v1.gz.js
             */
            grunt.file.copy('dist/plugins/' + type + '/' + branchFileModifier + '-' + version + '.js', 'dist/plugins/' + type + '/' + branchFileModifier + '-v' + majorVersion + '.js');
            grunt.file.copy('dist/plugins/' + type + '/' + branchFileModifier + '-' + version + '.js.gz', 'dist/plugins/' + type + '/' + branchFileModifier + '-v' + majorVersion + '.js.gz');

        });
    });

    grunt.registerMultiTask('md5', 'Generates MD5 for build artifacts', function() {
        _.each(this.files, function(file) {
            if (typeof file.src === 'undefined') {
                grunt.fail.warn('Files object doesn\'t exist');
            }

            var srcFiles = grunt.file.expand(file.src);

            _.each(srcFiles, function(srcFile) {
                try {
                    var srcCode = grunt.file.read(srcFile);
                    var md5 = require('crypto').createHash('md5').update(srcCode).digest('hex');
                    grunt.log.writeln(srcFile+' '+md5.green);
                } catch(err) {
                    grunt.log.error(err);
                    grunt.fail.warn('Fail to generate an MD5 file name');
                }
            });
        });
    });

    /**
     * Checks to make sure the AWS Credentials have been passed in.
     * This allows us to check right away to make sure we can complete this task.
     */
    grunt.registerTask('awsInputCheck', 'Checks to make sure we have the correct AWS Inputs', function() {
        var aws = grunt.config.get('aws');

        var hasAllKeys = true;
        // Loop through the array of values here and make sure they are all set.
        _.each(awsConfigKeys, function(key) {

            if (!awsConfig[key]) {
                grunt.log.error('Missing input [' + key + '] Please use --aws.' + key + '=<value>');
                hasAllKeys = false;
            }
        });

        if (!hasAllKeys) {
            grunt.fail.warn('Missing required AWS Inputs');
        }

    });

    grunt.registerTask('compileJS',
        "Resolves all requirejs dependencies and compiles javascript into file for the embedded and standalone SDKs",
        [
            'requirejs',
            'version'
        ]
    );

    grunt.registerTask('dev', ['watch:js']);

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

    grunt.registerTask('test',[
        'clean',
        'compileJS'
    ]);

    // Should only be run via CodeShip.
    // Does everything the regular 'release' task does EXCEPT tagging the repo
    // Codeship should be setup to push this to a dev bucket
    grunt.registerTask('dev-release',[
        // Make sure we have the s3 credentials needed to release this.
        'awsInputCheck',
        // Remove working files and created files.
        'clean',
        // Version and create the files in the /dist folder
        'compileJS',
        'compress',
        'rename',
        // Show the md5 of the files
        'md5',
        // Push to S3
        's3:releaseNonGzip',
        's3:releaseGzip',
        // Invalidate the Files on Fastly
        'updateFastlyOptions',
        'fastly'
    ]);

    // Should only be run via CodeShip.
    grunt.registerTask('release',[
        // Make sure we have the s3 credentials needed to release this.
        'awsInputCheck',
        // Remove working files and created files.
        'clean',
        // Version and create the files in the /dist folder
        'compileJS',
        'compress',
        'rename',
        // Show the md5 of the files
        'md5',
        // Create the tag from the version.  Will fail if already exists.
        'gittag:tagRelease',
        // Push the tag to github
        'gitpush:pushReleaseTag',
        // Push to S3
        's3:releaseNonGzip',
        's3:releaseGzip',
        // Invalidate the Files on Fastly
        'updateFastlyOptions',
        'fastly'
    ]);

};
<commit_msg>missing slash<commit_after>module.exports = function(grunt) {

    var fs = require('fs');
    var _ = require('lodash');

    var awsConfig = {
        accessKey: false,
        secretKey: false,
        region: false,
        s3Bucket: false
    };

    // Breaks out the keys and also gives us a nice reference of what
    // needs to be in here without being able to be changed.
    var awsConfigKeys = _.keys(awsConfig);

    // Take inputs for the awsConfig, prefixed with 'aws.'.
    // For example accessKey can be inputted with '--aws.accessKey=accessKey'
    _.each(awsConfigKeys, function(awsConfigKey){
        var optionKey = 'aws.' + awsConfigKey;
        var optionValue = grunt.option(optionKey);
        if (optionValue) {
            // Use the original key to update it.
            awsConfig[awsConfigKey] = optionValue;
        }
    });

    grunt.file.move = function(from,to) {
        grunt.log.writeln('Moved '+from.cyan+' to '+to.cyan);
        grunt.file.copy(from,to);
        grunt.file.delete(from);
    };

    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-version');
    grunt.loadNpmTasks('grunt-aws');
    grunt.loadNpmTasks('grunt-fastly');
    grunt.loadNpmTasks('grunt-git');

    grunt.initConfig({
        aws: awsConfig,
        version: {
            options: {
                pkg: grunt.file.readJSON('package.json')
            },
            eloqua: {
                options: {
                    prefix: '@version *'
                },
                src: ['dist/plugins/**/*.js']
            }
        },
        watch: {
            js : {
                files: ['./src/*.js'],
                tasks: ['compileJS'],
                options: {
                    spawn: false,
                    debounceDelay: 250,
                    interrupt: true
                }
            }
        },
        requirejs: {
            compile_eloqua_plugin: {
                options: {
                    baseUrl: './src',
                    include: ['eloqua'],
                    optimize: 'none',
                    out: './dist/plugins/eloqua/main.js',
                    skipSemiColonInsertion: true
                }

            }
        },
        compress: {
            release: {
                options: {
                    mode: 'gzip'
                },
                files: [
                    {src: ['dist/plugins/eloqua/main.js'], dest: 'dist/plugins/eloqua/main.js', filter: 'isFile'}
                ]
            }
        },
        md5: {
            release: {
                src:['dist/plugins/**/*.*']
            }
        },
        s3: {
            releaseNonGzip: {
                options: {
                    accessKeyId: "<%= aws.accessKey %>",
                    secretAccessKey: "<%= aws.secretKey %>",
                    region: "<%= aws.region %>",
                    bucket: "<%= aws.s3Bucket %>",
                    access: 'public-read',
                    // This flag auto gzips all files it uploads,
                    // since we handle it ourselves we disable it.
                    gzip: false,
                    cache: false, // Always upload, even if it's the same etag
                    headers: {
                        CacheControl: 86400 * 30 // 1 month
                    }
                },
                cwd: "./dist/plugins/",
                src: ["**/*.*", "!**.js.gz"]
            },
            // Gzip files need to have the content encoding header.
            releaseGzip: {
                options: {
                    accessKeyId: "<%= aws.accessKey %>",
                    secretAccessKey: "<%= aws.secretKey %>",
                    region: "<%= aws.region %>",
                    bucket: "<%= aws.s3Bucket %>",
                    access: 'public-read',
                    // This flag auto gzips all files it uploads,
                    // since we handle it ourselves we disable it.
                    gzip: false,
                    cache: false, // Always upload, even if it's the same etag
                    headers: {
                        ContentEncoding: 'gzip',
                        CacheControl: 86400 * 30 // 1 month
                    }
                },
                cwd: "./dist/plugins/",
                src: ['**/*.js.gz']
            }
        },
        gittag: {
            tagRelease: {
                options: {
                    cwd: './',
                    verbose: true,
                    tag: String(grunt.file.readJSON('package.json').version)
                }
            }
        },
        gitpush: {
            pushReleaseTag: {
                options: {
                    cwd: './',
                    verbose: true,
                    tags: true
                }
            }
        },
        fastly: {
            options: {
                key: grunt.option('fastly.key')
            },
            plugins: {
                options: {
                    urls: [],
                    host: grunt.option('fastly.host')
                }
            }
        }

    });

    /**
     * This is kind of a hack, because we want to dynamically invalidate fastly based on the files we
     * have created in a directory, we have to set them AFTER they are created.  This updates the config
     * in order to invalidate the correct files.
     */
    grunt.registerTask('updateFastlyOptions', 'Update the Fastly Inputs', function() {
        var fastly = grunt.config.get('fastly');

        /**
         * This reads all the files we are releasing (both major and specific versions)
         * We technically only need to invalidate the major version since there was a file there before
         * but since this is easy to do and may help if someone ever mistags, we invalidate all.
         */
        fastly.plugins.options.urls = fs.readdirSync('./dist/').map(function(value, key, array) {
            return '/' + value;
        });

        grunt.log.writeln('Purging cache for host ' + fastly.plugins.options.host);
        grunt.log.writeln('Purging cache for urls ' + fastly.plugins.options.urls);

        // Set the config back.
        grunt.config.set('fastly', fastly);
    });

    grunt.registerTask('clean','Cleans build artifacts',function(){
        grunt.file.delete('dist/');
        grunt.log.writeln('Removed '+'dist/'.green);
    });

    grunt.registerTask('rename','Renames build artifacts to include version number',function(){
        // If pushing to develop or a feature branch, codeship sends in the branch name so that builds can
        // be pushed to S3 with the branch name included to assist multi-branch development
        var branchFileModifier = '';
        if(grunt.option('branch')) {
            branchFileModifier = '-' + grunt.option('branch').replace('/', '-');
        }

        var version = String(grunt.file.readJSON('package.json').version);
        var versionArray = version.split('.');
        if (versionArray.length < 3) {
            grunt.fail.warn('Version should be specified in Major.Minor.Patch (1.0.0)');
        }
        var majorVersion = versionArray[0];

        var plugins = ['eloqua'];
        _.each(plugins, function(type){
            /**
             * Output files for specific Version (when version = 1.3.0)
             * These should never overwrite files in our s3 bucket, always should be unique.
             * Code changes require update to version.
             *
             * plugins/eloqua/main-1.0.0.js
             * plugins/eloqua/main-1.0.0.gz.js
             */
            grunt.file.move('dist/plugins/' + type + '/main.js', 'dist/plugins/' + type + '/' + branchFileModifier + '-' + version + '.js');
            grunt.file.move('dist/plugins/' + type + '/main.js.gz', 'dist/plugins/' + type + '/' + branchFileModifier + '-' + version + '.js.gz');

            /**
             * Output files for Major Version (when version = 1.3.0 -- majorVersion = 1)
             * These replace the existing major release version.  The concept is that customers
             * can use v1 and we can update it with non-breaking changes without them having to update their
             * source.
             *
             * plugins/eloqua/main-v1.js
             * plugins/eloqua/main-v1.gz.js
             */
            grunt.file.copy('dist/plugins/' + type + '/' + branchFileModifier + '-' + version + '.js', 'dist/plugins/' + type + '/' + branchFileModifier + '-v' + majorVersion + '.js');
            grunt.file.copy('dist/plugins/' + type + '/' + branchFileModifier + '-' + version + '.js.gz', 'dist/plugins/' + type + '/' + branchFileModifier + '-v' + majorVersion + '.js.gz');

        });
    });

    grunt.registerMultiTask('md5', 'Generates MD5 for build artifacts', function() {
        _.each(this.files, function(file) {
            if (typeof file.src === 'undefined') {
                grunt.fail.warn('Files object doesn\'t exist');
            }

            var srcFiles = grunt.file.expand(file.src);

            _.each(srcFiles, function(srcFile) {
                try {
                    var srcCode = grunt.file.read(srcFile);
                    var md5 = require('crypto').createHash('md5').update(srcCode).digest('hex');
                    grunt.log.writeln(srcFile+' '+md5.green);
                } catch(err) {
                    grunt.log.error(err);
                    grunt.fail.warn('Fail to generate an MD5 file name');
                }
            });
        });
    });

    /**
     * Checks to make sure the AWS Credentials have been passed in.
     * This allows us to check right away to make sure we can complete this task.
     */
    grunt.registerTask('awsInputCheck', 'Checks to make sure we have the correct AWS Inputs', function() {
        var aws = grunt.config.get('aws');

        var hasAllKeys = true;
        // Loop through the array of values here and make sure they are all set.
        _.each(awsConfigKeys, function(key) {

            if (!awsConfig[key]) {
                grunt.log.error('Missing input [' + key + '] Please use --aws.' + key + '=<value>');
                hasAllKeys = false;
            }
        });

        if (!hasAllKeys) {
            grunt.fail.warn('Missing required AWS Inputs');
        }

    });

    grunt.registerTask('compileJS',
        "Resolves all requirejs dependencies and compiles javascript into file for the embedded and standalone SDKs",
        [
            'requirejs',
            'version'
        ]
    );

    grunt.registerTask('dev', ['watch:js']);

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

    grunt.registerTask('test',[
        'clean',
        'compileJS'
    ]);

    // Should only be run via CodeShip.
    // Does everything the regular 'release' task does EXCEPT tagging the repo
    // Codeship should be setup to push this to a dev bucket
    grunt.registerTask('dev-release',[
        // Make sure we have the s3 credentials needed to release this.
        'awsInputCheck',
        // Remove working files and created files.
        'clean',
        // Version and create the files in the /dist folder
        'compileJS',
        'compress',
        'rename',
        // Show the md5 of the files
        'md5',
        // Push to S3
        's3:releaseNonGzip',
        's3:releaseGzip',
        // Invalidate the Files on Fastly
        'updateFastlyOptions',
        'fastly'
    ]);

    // Should only be run via CodeShip.
    grunt.registerTask('release',[
        // Make sure we have the s3 credentials needed to release this.
        'awsInputCheck',
        // Remove working files and created files.
        'clean',
        // Version and create the files in the /dist folder
        'compileJS',
        'compress',
        'rename',
        // Show the md5 of the files
        'md5',
        // Create the tag from the version.  Will fail if already exists.
        'gittag:tagRelease',
        // Push the tag to github
        'gitpush:pushReleaseTag',
        // Push to S3
        's3:releaseNonGzip',
        's3:releaseGzip',
        // Invalidate the Files on Fastly
        'updateFastlyOptions',
        'fastly'
    ]);

};
<|endoftext|>


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

    "use strict";

    // this saves us having to load each plugin individually
    require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);

    grunt.initConfig({

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

        less: {
            development: {
                options: {
                    strictMath: true,
                    strictUnits: true,
                    cleancss: true
                },
                files: {
                    "style.css": "styles/style.less"
                }
            }
        },

        autoprefixer: {
            single_file: {
                options: {
                    browsers: ["last 2 version"]
                },
                src: "style.css",
                dest: "style.css"
            },
        },

        csslint: {
            options: {
                csslintrc: ".csslintrc"
            },
            strict: {
                src: ["style.css"]
            }
        },

        cssmin: {
            minify: {
                src: "style.css",
                dest: "style.css"
            }
        },

        jshint: {
            options: {
                jshintrc: ".jshintrc"
            },
            all: [
                ".jshintrc",
                "Gruntfile.js",
                "js/project.js"
            ]
        },

        concat: {
            dist: {
                src: [
                    "js/bower/jquery/jquery.js",
                    "js/bower/modernizr/modernizr.js",
                    "js/bower/jquery-smartresize/debouncedresize.js",
                    "js/project.js"
                ],
                dest: "js/production.js"
            }
        },

        uglify: {
            my_target: {
                files: {
                    "js/production.js": ["js/production.js"]
                }
            }
        },

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

        watch: {
            css: {
                files: "styles/*.less",
                tasks: "buildcss"
            },
            scripts: {
                files: "js/project.js",
                tasks: "buildjs"
            }
        },

        notify: {
            notify_hooks: {
                options: {
                    enabled: true,
                    max_jshint_notifications: 5,
                }
            },
            js: {
                options: {
                    title: "Back of the net!",
                    message: "Javascript build successful!"
                }
            },
            less: {
                options: {
                    title: "Cashback!",
                    message: "LESS build successful!"
                }
            }
        }

    });

    // List of available tasks
    grunt.registerTask("default", []);
    grunt.registerTask("buildcss", ["less", "autoprefixer", "csslint", "cssmin", "imagemin", "notify:less"]);
    grunt.registerTask("buildjs", ["jshint", "concat", "uglify", "notify:js"]);

};
<commit_msg>fix typo<commit_after>module.exports = function (grunt) {

    "use strict";

    // this saves us having to load each plugin individually
    require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);

    grunt.initConfig({

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

        less: {
            development: {
                options: {
                    strictMath: true,
                    strictUnits: true,
                    cleancss: true
                },
                files: {
                    "style.css": "styles/style.less"
                }
            }
        },

        autoprefixer: {
            single_file: {
                options: {
                    browsers: ["last 2 version"]
                },
                src: "style.css",
                dest: "style.css"
            },
        },

        csslint: {
            options: {
                csslintrc: ".csslintrc"
            },
            strict: {
                src: ["style.css"]
            }
        },

        cssmin: {
            minify: {
                src: "style.css",
                dest: "style.css"
            }
        },

        jshint: {
            options: {
                jshintrc: ".jshintrc"
            },
            all: [
                ".jshintrc",
                "Gruntfile.js",
                "js/project.js"
            ]
        },

        concat: {
            dist: {
                src: [
                    "js/bower/jquery/jquery.js",
                    "js/bower/modernizr/modernizr.js",
                    "js/bower/jquery-smartresize/jquery.debouncedresize.js",
                    "js/project.js"
                ],
                dest: "js/production.js"
            }
        },

        uglify: {
            my_target: {
                files: {
                    "js/production.js": ["js/production.js"]
                }
            }
        },

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

        watch: {
            css: {
                files: "styles/*.less",
                tasks: "buildcss"
            },
            scripts: {
                files: "js/project.js",
                tasks: "buildjs"
            }
        },

        notify: {
            notify_hooks: {
                options: {
                    enabled: true,
                    max_jshint_notifications: 5,
                }
            },
            js: {
                options: {
                    title: "Back of the net!",
                    message: "Javascript build successful!"
                }
            },
            less: {
                options: {
                    title: "Cashback!",
                    message: "LESS build successful!"
                }
            }
        }

    });

    // List of available tasks
    grunt.registerTask("default", []);
    grunt.registerTask("buildcss", ["less", "autoprefixer", "csslint", "cssmin", "imagemin", "notify:less"]);
    grunt.registerTask("buildjs", ["jshint", "concat", "uglify", "notify:js"]);

};
<|endoftext|>


<commit_before>module.exports = function (grunt) {
    'use strict';
    // Project configuration.
    var saucekey = process.env.saucekey;

    if (!saucekey) {
        console.warn('Unable to load saucelabs key');
    }

    grunt.initConfig({
        jade: {
            release: {
                files: {
                    'tests/index.html': ['tests/views/index.jade']
                }
            }
        },

        clean: ['tests/index.html'],

        connect: {
            server: {
                options: {
                    base: '.',
                    port: 9999
                }
            }
        },

        'saucelabs-mocha': {
            all: {
                options: {
                    username: process.env.sauceuser,
                    key: saucekey,
                    testname: 'db.js',
                    tags: ['master'],
                    urls: ['http://127.0.0.1:9999/tests/index.html'],
                    public: !!process.env.TRAVIS_JOB_ID,
                    build: process.env.TRAVIS_JOB_ID,
                    browsers: [/* {
                        browserName: 'firefox',
                        platform: 'Windows 2012',
                        version: '17'
                    }, {
                        browserName: 'internet explorer',
                        platform: 'Windows 2012',
                        version: '10'
                    }, */
                        {
                            browserName: 'chrome',
                            platform: 'Windows 2008'
                        }]
                },
                onTestComplete: function (result, callback) {
                    console.dir(result);
                }
            }
        },

        'babel': {
            options: {
                sourceMap: true
            },
            dist: {
                files: {
                    'dist/db.js': 'src/db.js'
                }
            }
        },

        'eslint': {
            target: ['src/db.js']
        },

        uglify: {
            options: {
                sourceMap: true,
                sourceMapIncludeSources: true,
                sourceMapIn: 'dist/db.js.map' // input sourcemap from a previous compilation
            },
            dist: {
                files: {
                    'dist/db.min.js': ['dist/db.js']
                }
            }
        }
    });

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

    grunt.registerTask('forever', function () {
        this.async();
    });

    var devJobs = ['eslint', 'babel', 'uglify', 'clean', 'jade'];
    var testJobs = devJobs.concat('connect');
    if (saucekey !== null) {
        testJobs.push('saucelabs-mocha');
    }

    grunt.registerTask('dev', devJobs);
    grunt.registerTask('test', testJobs);
    grunt.registerTask('default', 'test');
    grunt.registerTask('test:local', function () {
        grunt.task.run(devJobs);
        grunt.task.run('connect:server:keepalive');
    });
};
<commit_msg>prevent PR's from trying to hit saucelabs<commit_after>module.exports = function (grunt) {
    'use strict';
    // Project configuration.
    var saucekey = process.env.saucekey;

    if (!saucekey) {
        console.warn('Unable to load saucelabs key');
    }

    grunt.initConfig({
        jade: {
            release: {
                files: {
                    'tests/index.html': ['tests/views/index.jade']
                }
            }
        },

        clean: ['tests/index.html'],

        connect: {
            server: {
                options: {
                    base: '.',
                    port: 9999
                }
            }
        },

        'saucelabs-mocha': {
            all: {
                options: {
                    username: process.env.sauceuser,
                    key: saucekey,
                    testname: 'db.js',
                    tags: ['master'],
                    urls: ['http://127.0.0.1:9999/tests/index.html'],
                    public: !!process.env.TRAVIS_JOB_ID,
                    build: process.env.TRAVIS_JOB_ID,
                    browsers: [/* {
                        browserName: 'firefox',
                        platform: 'Windows 2012',
                        version: '17'
                    }, {
                        browserName: 'internet explorer',
                        platform: 'Windows 2012',
                        version: '10'
                    }, */
                        {
                            browserName: 'chrome',
                            platform: 'Windows 2008'
                        }]
                },
                onTestComplete: function (result, callback) {
                    console.dir(result);
                }
            }
        },

        'babel': {
            options: {
                sourceMap: true
            },
            dist: {
                files: {
                    'dist/db.js': 'src/db.js'
                }
            }
        },

        'eslint': {
            target: ['src/db.js']
        },

        uglify: {
            options: {
                sourceMap: true,
                sourceMapIncludeSources: true,
                sourceMapIn: 'dist/db.js.map' // input sourcemap from a previous compilation
            },
            dist: {
                files: {
                    'dist/db.min.js': ['dist/db.js']
                }
            }
        }
    });

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

    grunt.registerTask('forever', function () {
        this.async();
    });

    var devJobs = ['eslint', 'babel', 'uglify', 'clean', 'jade'];
    var testJobs = devJobs.concat('connect');
    if (saucekey !== null && !process.env.TRAVIS_PULL_REQUEST) {
        testJobs.push('saucelabs-mocha');
    }

    grunt.registerTask('dev', devJobs);
    grunt.registerTask('test', testJobs);
    grunt.registerTask('default', 'test');
    grunt.registerTask('test:local', function () {
        grunt.task.run(devJobs);
        grunt.task.run('connect:server:keepalive');
    });
};
<|endoftext|>


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

    var buildId = "";
    if(grunt.option('release-id')) {
        buildId = "_" + grunt.option('release-id');
    }
    grunt.initConfig({
        copyto: {
            jsrfToPackage: {
                files: [
                    {cwd: 'jsrf/build/package/', src: ['**/*'], dest: 'build/package/javascript/'},
                ]
            },
            phprfToPackage: {
                files: [
                    {cwd: 'phprf/build/package/', src: ['**/*'], dest: 'build/package/php/'},
                ]
            }
        },
        clean: {
            packageBuild: ["package/**", "build/**"]
        },
        compress: {
            release: {
                options: {
                    archive: "package/razorflow_dashboard_framework" + buildId + ".zip"
                },
                files: [
                    {cwd: 'build/package/', src: ['**'], dest: 'razorflow_dashboard_framework', expand: true},
                ]
            }
        },
        extGrunt: {
            jsPackage: {
                options: {
                    cwd: "jsrf",
                    task: "package"
                }
            },
            phpPackage: {
                options: {
                    cwd: "phprf",
                    task: "package"
                }
            },
            exampleBuild: {
                options: {
                    cwd: "examples/internal",
                    task: "build"
                }
            }
        }
    });

    grunt.registerMultiTask ("extGrunt", "Call an external grunt", function () {
        var options = this.options({
        });
        var done = this.async ();

        grunt.util.spawn({
            grunt: true,
            opts: {
                cwd: options.cwd,
                stdio: 'inherit'
            },
            args: [options.task]
        }, done)
    })

    grunt.loadNpmTasks('grunt-copy-to');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-compress');

    grunt.registerTask('cleanAll', ["extGrunt:jsClean", "extGrunt:phpClean"]);

    grunt.registerTask('buildAll', ["extGrunt:jsPackage", "extGrunt:phpPackage", "extGrunt:exampleBuild"]);
    grunt.registerTask('release', ["buildAll", "clean:packageBuild", "copyto:jsrfToPackage", "copyto:phprfToPackage", "compress:release"])
}<commit_msg>updates to gruntfile<commit_after>module.exports = function (grunt) {

    var buildId = "";
    if(grunt.option('release-id')) {
        buildId = "_" + grunt.option('release-id');
    }
    grunt.initConfig({
        copyto: {
            jsrfToPackage: {
                files: [
                    {cwd: 'jsrf/build/package/', src: ['**/*'], dest: 'build/package/razorflow_js/'},
                ]
            },
            phprfToPackage: {
                files: [
                    {cwd: 'phprf/build/package/', src: ['**/*'], dest: 'build/package/razorflow_php/'},
                ]
            }
        },
        clean: {
            packageBuild: ["package/**", "build/**"]
        },
        compress: {
            release: {
                options: {
                    archive: "package/razorflow_dashboard_framework" + buildId + ".zip"
                },
                files: [
                    {cwd: 'build/package/', src: ['**'], dest: 'razorflow_dashboard_framework', expand: true},
                ]
            }
        },
        extGrunt: {
            jsPackage: {
                options: {
                    cwd: "jsrf",
                    task: "package"
                }
            },
            phpPackage: {
                options: {
                    cwd: "phprf",
                    task: "package"
                }
            },
            exampleBuild: {
                options: {
                    cwd: "examples/internal",
                    task: "build"
                }
            }
        }
    });

    grunt.registerMultiTask ("extGrunt", "Call an external grunt", function () {
        var options = this.options({
        });
        var done = this.async ();

        grunt.util.spawn({
            grunt: true,
            opts: {
                cwd: options.cwd,
                stdio: 'inherit'
            },
            args: [options.task]
        }, done)
    })

    grunt.loadNpmTasks('grunt-copy-to');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-compress');

    grunt.registerTask('cleanAll', ["extGrunt:jsClean", "extGrunt:phpClean"]);

    grunt.registerTask('buildAll', ["extGrunt:jsPackage", "extGrunt:phpPackage", "extGrunt:exampleBuild"]);
    grunt.registerTask('package', ["buildAll", "clean:packageBuild", "copyto:jsrfToPackage", "copyto:phprfToPackage"])
    grunt.registerTask('simplePackage', ["clean:packageBuild", "copyto:jsrfToPackage", "copyto:phprfToPackage"])
    grunt.registerTask('release', ['package', "compress:release"])
}<|endoftext|>


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

    // require it at the top and pass in the grunt instance
    require('time-grunt')(grunt);

    var matchdep = require('matchdep'),
        path = require('path'),
        meta = grunt.file.readJSON('./bower.json')
    ;

    var asimoveCorePath = path.resolve(meta.name === 'asimov-core' ?
        '.' :
        './bower_components/asimov-core');

    // Create an array of asimov deps
    //
    // Since bower installs dep flat rather than nested (npm style) we can use
    // simple globbing. Alternative we could use bower.commands.list.
    var bowerDeps = grunt.file.glob.sync('bower_components/asimov-*');

    // Create a array of paths to be passed to sass' --load-path
    //
    // This allows us to use @import bowered in components' sass files as if
    // they were part of your local component/theme.
    var sassLoadPaths = ['src/scss'].concat(bowerDeps.map(function(depPath) {
        return path.join(depPath, 'src', 'scss');
    }));

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

        // Sass compilation

        sass: {
            options: {
                style: 'expanded',
                lineNumbers: false,
                loadPath: sassLoadPaths,
                cacheLocation: '.build/.sass-cache'
            },
            test: {
                files: [{
                    expand: true,
                    cwd: 'tests/scss',
                    src: ['*.scss', '!_*.scss'],
                    dest: '.build/sasstest',
                    ext: '.css'
                }]
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: 'src/scss',
                    src: ['*.scss', '!_*.scss'],
                    dest: 'dist',
                    ext: '.css'
                }]
            }
        },

        // Run our sass tests

        sasstest: {
            test: {}
        },

        // Creating new releases

        bump: {
            options: {
                files: ['bower.json'],
                updateConfigs: ['pkg'],
                commit: true,
                commitMessage: 'chore(relase): release v%VERSION%',
                commitFiles: ['bower.json', '<%= changelog.options.dest %>'],
                createTag: true,
                tagName: '%VERSION%',
                tagMessage: 'tagging version %VERSION%',
                push: true,
                pushTo: 'origin'
            }
        },

        // Automatic changelogs

        changelog: {
            options: {
                dest: 'CHANGELOG.md',
                prepend: true,
                github: grunt.file.readJSON('./bower.json').version,
                editor: 'subl -w'
            }
        },

        // Creating new releases

        release: {
            dryRun: false
        }
    });

    // Load tasks defined in asimov-core's package.json

    var base = process.cwd();
    matchdep.filterAll('grunt-!(cli)', path.join(asimoveCorePath, 'package.json'))
        .forEach(function(task) {
            // need to temporarily change base for grunt.loadNpmTasks to work
            grunt.file.setBase(asimoveCorePath);
            grunt.loadNpmTasks(task);
            grunt.file.setBase(base);
        });

    // Load our custom tasks

    grunt.loadTasks(path.join(asimoveCorePath, 'build', 'tasks'));

    // Public tasks

    grunt.registerTask('test', [
        'sass:test',
        'sasstest:test'
    ]);

    grunt.registerTask('compile', [
        'sass:dist'
    ]);

    grunt.registerTask('default', [
        'test',
        'compile'
    ]);
};
<commit_msg>fix(release): fix typo in release commit message<commit_after>
module.exports = function(grunt) {
    "use strict";

    // require it at the top and pass in the grunt instance
    require('time-grunt')(grunt);

    var matchdep = require('matchdep'),
        path = require('path'),
        meta = grunt.file.readJSON('./bower.json')
    ;

    var asimoveCorePath = path.resolve(meta.name === 'asimov-core' ?
        '.' :
        './bower_components/asimov-core');

    // Create an array of asimov deps
    //
    // Since bower installs dep flat rather than nested (npm style) we can use
    // simple globbing. Alternative we could use bower.commands.list.
    var bowerDeps = grunt.file.glob.sync('bower_components/asimov-*');

    // Create a array of paths to be passed to sass' --load-path
    //
    // This allows us to use @import bowered in components' sass files as if
    // they were part of your local component/theme.
    var sassLoadPaths = ['src/scss'].concat(bowerDeps.map(function(depPath) {
        return path.join(depPath, 'src', 'scss');
    }));

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

        // Sass compilation

        sass: {
            options: {
                style: 'expanded',
                lineNumbers: false,
                loadPath: sassLoadPaths,
                cacheLocation: '.build/.sass-cache'
            },
            test: {
                files: [{
                    expand: true,
                    cwd: 'tests/scss',
                    src: ['*.scss', '!_*.scss'],
                    dest: '.build/sasstest',
                    ext: '.css'
                }]
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: 'src/scss',
                    src: ['*.scss', '!_*.scss'],
                    dest: 'dist',
                    ext: '.css'
                }]
            }
        },

        // Run our sass tests

        sasstest: {
            test: {}
        },

        // Creating new releases

        bump: {
            options: {
                files: ['bower.json'],
                updateConfigs: ['pkg'],
                commit: true,
                commitMessage: 'chore(release): release v%VERSION%',
                commitFiles: ['bower.json', '<%= changelog.options.dest %>'],
                createTag: true,
                tagName: '%VERSION%',
                tagMessage: 'tagging version %VERSION%',
                push: true,
                pushTo: 'origin'
            }
        },

        // Automatic changelogs

        changelog: {
            options: {
                dest: 'CHANGELOG.md',
                prepend: true,
                github: grunt.file.readJSON('./bower.json').version,
                editor: 'subl -w'
            }
        },

        // Creating new releases

        release: {
            dryRun: false
        }
    });

    // Load tasks defined in asimov-core's package.json

    var base = process.cwd();
    matchdep.filterAll('grunt-!(cli)', path.join(asimoveCorePath, 'package.json'))
        .forEach(function(task) {
            // need to temporarily change base for grunt.loadNpmTasks to work
            grunt.file.setBase(asimoveCorePath);
            grunt.loadNpmTasks(task);
            grunt.file.setBase(base);
        });

    // Load our custom tasks

    grunt.loadTasks(path.join(asimoveCorePath, 'build', 'tasks'));

    // Public tasks

    grunt.registerTask('test', [
        'sass:test',
        'sasstest:test'
    ]);

    grunt.registerTask('compile', [
        'sass:dist'
    ]);

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


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

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

            copy: {
              html: {
                src: 'demo/client/autocomplete/views/profile.html',
                dest: 'autocomplete/views/profile.html',
              },
              css:{
                src: 'demo/client/css/autocomplete.css',
                dest:'autocomplete/css/autocomplete.css'
              },
              js:{
                  src:'demo/client/dist/autocomplete.concat.js',
                  dest:'autocomplete/autocomplete.js'
              }
            },
            cssmin:{
              options: {
                shorthandCompacting: false,
                roundingPrecision: -1
              },
              target: {
                files: {
                  'autocomplete/css/autocomplete.min.css': ['Demo/client/css/*.css']
                }
              }
            },
            // Tasks
            jshint: {
              files: [
                'Gruntfile.js',
                'Demo/client/*.js'
              ],
              options: {
                jshintrc: true
              }
            },

            uglify: {
                options: {
                  sourceMap: true,
                  sourceMapName: 'autocomplete/aautocomplete.min.map'
                },
                js: {
                src: ['Demo/client/dist/*.js'],
                dest: 'autocomplete/autocomplete.min.js'
              },

            },
            watch: { // Compile everything into one task with Watch Plugin
              css: {
                files: 'Demo/client/scss/*.scss',

                tasks: ['sass']
              },
              js: {
                files: 'Demo/client/**/*.js',
                tasks: ['uglify']
              },

              cssmin:{
                files :['Demo/client/css/*.css'],
                tasks:['cssmin']
              },
              compass: {
                files: [
                  'Demo/client/scss/*.scss',
                ],
                tasks: ['compass']
              },
              jshint: {
                files: [
                  'Gruntfile.js',
                  'client/*.js',
                ],
                tasks: ['jshint'],
                options: {
                  reload: true
                }
              }
            }
  });
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-copy');

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

<commit_msg>update grunt<commit_after>module.exports = function (grunt) {

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

            copy: {
              html: {
                src: 'demo/client/autocomplete/views/profile.html',
                dest: 'autocomplete/views/profile.html',
              },
              css:{
                src: 'demo/client/css/profileautocomplete.css',
                dest:'autocomplete/css/profileautocomplete.css'
              },
              js:{
                  src:'demo/client/dist/autocomplete.concat.js',
                  dest:'autocomplete/autocomplete.js'
              }
            },
            cssmin:{
              options: {
                shorthandCompacting: false,
                roundingPrecision: -1
              },
              target: {
                files: {
                  'autocomplete/css/autocomplete.min.css': ['Demo/client/css/*.css']
                }
              }
            },
            // Tasks
            jshint: {
              files: [
                'Gruntfile.js',
                'Demo/client/*.js'
              ],
              options: {
                jshintrc: true
              }
            },

            uglify: {
                options: {
                  sourceMap: true,
                  sourceMapName: 'autocomplete/aautocomplete.min.map'
                },
                js: {
                src: ['Demo/client/dist/*.js'],
                dest: 'autocomplete/autocomplete.min.js'
              },

            },
            watch: { // Compile everything into one task with Watch Plugin
              css: {
                files: 'Demo/client/scss/*.scss',

                tasks: ['sass']
              },
              js: {
                files: 'Demo/client/**/*.js',
                tasks: ['uglify']
              },

              cssmin:{
                files :['Demo/client/css/*.css'],
                tasks:['cssmin']
              },
              compass: {
                files: [
                  'Demo/client/scss/*.scss',
                ],
                tasks: ['compass']
              },
              jshint: {
                files: [
                  'Gruntfile.js',
                  'client/*.js',
                ],
                tasks: ['jshint'],
                options: {
                  reload: true
                }
              }
            }
  });
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-copy');

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

<|endoftext|>


<commit_before>const
  _URL__GRUNT_CONFIG_FILE = './config/grunt.json',
  _URL__NPM_MANIFEST_FILE = './package.json',
  _URL__SRC_DIRECTORY = './src';

var
  gruntRegisterTasks = require('grunt-register-tasks'),
  loadGruntTasks = require('load-grunt-tasks'),
  timeGrunt = require('time-grunt');

module.exports = function ( $grunt ) {

    var

      _$grunt__file = $grunt.file,
      _$grunt__file__readJSON = _$grunt__file.readJSON,

      _plugins = [
          'grunt-bump',
          'grunt-contrib-*',
          'grunt-jsonlint',
          'grunt-modify-json'
        ],

      _config = {
          'alias': {
              'src': [
                  '<%= cfg.PATH__SRC %>/<%= cfg.GLOB__JS__RECURSIVE %>'
                ],
              'options': {
                  'levels': 1
                }
            },
          'bump': {
              'options': {
                  'commit': true,
                  'commitFiles': [
                      _URL__NPM_MANIFEST_FILE
                    ],
                  'commitMessage': 'bump(version): %VERSION%',
                  'createTag': false,
                  'files': _URL__NPM_MANIFEST_FILE,
                  'push': true,
                  'pushTo': 'origin',
                  'updateConfigs': [
                      null,
                      'pkg'
                    ]
                }
            },
          'cfg': _$grunt__file__readJSON( _URL__GRUNT_CONFIG_FILE ),
          'jshint': {
              'options': {
                  'jshintrc': true
                },
              'src': '<%= cfg.PATH__SRC %>/<%= cfg.GLOB__JS__RECURSIVE %>'
            },
          'jsonlint': {
              'config': [
                  '<%= cfg.PATH__CONFIG %>/<%= cfg.GLOB__JSON__RECURSIVE %>',
                  '<%= cfg.PATH__ROOT %>/<%= cfg.GLOB__JSHINTRC %>'
                ],
              'manifest': _URL__NPM_MANIFEST_FILE
            },
          'modify_json': {
              'manifest': {
                  'files': {
                      '<%= cfg.PATH__ROOT %>': _URL__NPM_MANIFEST_FILE
                    },
                  'options': {
                      'add': true,
                      'fields': {
                          'private': false
                        }
                    }
                }
            },
          'pkg': _$grunt__file__readJSON( _URL__NPM_MANIFEST_FILE )
        },

      _tasks = {
          'build': [],
          'default': [
              'jsonlint',
              'jshint'
            ],
          'test': [
              'default',
              'alias'
            ]
        };

    timeGrunt( $grunt ),

    $grunt.initConfig( _config ),

    loadGruntTasks(
      $grunt,
      {
        pattern: _plugins,
        scope: 'devDependencies'
      }
    ),

    $grunt.loadTasks( _URL__SRC_DIRECTORY ),

    gruntRegisterTasks(
      $grunt,
      _tasks
    );

  };<commit_msg>chore(grunt): update test task<commit_after>const
  _URL__GRUNT_CONFIG_FILE = './config/grunt.json',
  _URL__NPM_MANIFEST_FILE = './package.json',
  _URL__SRC_DIRECTORY = './src';

var
  gruntRegisterTasks = require('grunt-register-tasks'),
  loadGruntTasks = require('load-grunt-tasks'),
  timeGrunt = require('time-grunt');

module.exports = function ( $grunt ) {

    var

      _$grunt__file = $grunt.file,
      _$grunt__file__readJSON = _$grunt__file.readJSON,

      _plugins = [
          'grunt-bump',
          'grunt-contrib-*',
          'grunt-jsonlint',
          'grunt-modify-json'
        ],

      _config = {
          'alias': {
              'src': '<%= cfg.PATH__SRC %>/<%= cfg.GLOB__JS__RECURSIVE %>',
              'options': {
                  'levels': 1
                }
            },
          'bump': {
              'options': {
                  'commit': true,
                  'commitFiles': [
                      _URL__NPM_MANIFEST_FILE
                    ],
                  'commitMessage': 'bump(version): %VERSION%',
                  'createTag': false,
                  'files': _URL__NPM_MANIFEST_FILE,
                  'push': true,
                  'pushTo': 'origin',
                  'updateConfigs': [
                      null,
                      'pkg'
                    ]
                }
            },
          'cfg': _$grunt__file__readJSON( _URL__GRUNT_CONFIG_FILE ),
          'clean': {
              'alias': '<%= cfg.PATH__ROOT %>/<%= cfg.GLOB__GRUNT_ALIAS_NPM_SUBMODULES_JS %>'
            },
          'jshint': {
              'options': {
                  'jshintrc': true
                },
              'src': '<%= cfg.PATH__SRC %>/<%= cfg.GLOB__JS__RECURSIVE %>'
            },
          'jsonlint': {
              'config': [
                  '<%= cfg.PATH__CONFIG %>/<%= cfg.GLOB__JSON__RECURSIVE %>',
                  '<%= cfg.PATH__ROOT %>/<%= cfg.GLOB__JSHINTRC %>'
                ],
              'manifest': _URL__NPM_MANIFEST_FILE
            },
          'modify_json': {
              'manifest': {
                  'files': {
                      '<%= cfg.PATH__ROOT %>': _URL__NPM_MANIFEST_FILE
                    },
                  'options': {
                      'add': true,
                      'fields': {
                          'private': false
                        }
                    }
                }
            },
          'pkg': _$grunt__file__readJSON( _URL__NPM_MANIFEST_FILE )
        },

      _tasks = {
          'build': [],
          'default': [
              'jsonlint',
              'jshint'
            ],
          'test': [
              'default',
              'alias',
              'clean:alias'
            ]
        };

    timeGrunt( $grunt ),

    $grunt.initConfig( _config ),

    loadGruntTasks(
      $grunt,
      {
        pattern: _plugins,
        scope: 'devDependencies'
      }
    ),

    $grunt.loadTasks( _URL__SRC_DIRECTORY ),

    gruntRegisterTasks(
      $grunt,
      _tasks
    );

  };<|endoftext|>


<commit_before>'use strict';

if (process.env.NODE_ENV == 'production'){
    console.log("\n****** PRODUCTION ENVIRONMENT ******\n");
}

//eslint directive to ignore "undefined" global variables
/* global __dirname process */

module.exports = function(grunt) {
    var path = require('path');

    function compressPath(p) {
        var src = 'src/clincoded/static/';
        p = path.relative(__dirname, p);
        if (p.slice(0, src.length) == src) {
            return '../' + p.slice(src.length);
        }
        return '../../' + p;
    }

    grunt.config('env', grunt.option('env') || process.env.GRUNT_ENV || 'production');
    var minifyEnabled = grunt.config('minifyEnabled', grunt.config('env') === 'production');

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        browserify: {
            brace: {
                dest: './src/clincoded/static/build/brace.js',
                require: [
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light'
                ],
                plugin: [
                    ['minifyify', {
                        minify: minifyEnabled,
                        map: 'brace.js.map',
                        output: './src/clincoded/static/build/brace.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'}
                    }]
                ]
            },
            inline: {
                dest: './src/clincoded/static/build/inline.js',
                src: [
                    './src/clincoded/static/inline.js'
                ],
                require: [
                    'scriptjs',
                    'google-analytics'
                ],
                transform: [
                    ['babelify', {sourceMaps: true, babelrc: true}],
                    'brfs',
                    'envify'
                ],
                plugin: [
                    ['minifyify', {
                        minify: minifyEnabled,
                        map: '/static/build/inline.js.map',
                        output: './src/clincoded/static/build/inline.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'}
                    }]
                ]
            },
            browser: {
                dest: './src/clincoded/static/build/bundle.js',
                src: [
                    'es5-shims',
                    'es5-shim/es5-sham',
                    'babel-polyfill',
                    'html5shiv/dist/html5shiv',
                    './src/clincoded/static/libs/compat.js', // The shims should execute first
                    './src/clincoded/static/libs/sticky_header.js',
                    './src/clincoded/static/libs/respond.js',
                    './src/clincoded/static/browser.js'
                ],
                external: [
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light',
                    'scriptjs',
                    'google-analytics'
                ],
                transform: [
                    ['babelify', {sourceMaps: true, babelrc: true}],
                    'brfs',
                    'envify'
                ],
                plugin: [
                    ['minifyify', {
                        minify: minifyEnabled,
                        map: 'bundle.js.map',
                        output: './src/clincoded/static/build/bundle.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'}
                    }]
                ]
            },
            server: {
                dest: './src/clincoded/static/build/renderer.js',
                src: ['./src/clincoded/static/server.js'],
                options: {
                    builtins: false,
                    detectGlobals: false
                },
                transform: [
                    ['babelify', {sourceMaps: true, babelrc: true}],
                    'brfs',
                    'envify'
                ],
                plugin: [
                    ['minifyify', {
                        minify: minifyEnabled,
                        map:'renderer.js.map',
                        output: './src/clincoded/static/build/renderer.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'}
                    }]
                ],
                external: [
                    'assert',
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light',
                    'source-map-support'
                ],
                ignore: [
                    'jquery',
                    'scriptjs',
                    'google-analytics',
                    'ckeditor'
                ]
            }
        },
        copy: {
            ckeditor: {
                expand: true,
                cwd: 'node_modules/node-ckeditor',
                src: 'ckeditor/**',
                dest: 'src/clincoded/static/build/'
            }
        },
        filerev: {
            options: {
                algorithm: 'md5',
                length: 8
            },
            css: {
                src: ['./src/clincoded/static/css/style.css'],
                dest: './src/clincoded/static/css'
            },
            js: {
                src: ['./src/clincoded/static/build/bundle.js'],
                dest: './src/clincoded/static/build/'
            }
        },
        replace: {
            dist: {
                options: {
                    patterns: [
                        {
                            match: 'bundleJsFile',
                            replacement: function () {
                                return grunt.filerev.summary["src/clincoded/static/build/bundle.js"].replace(new RegExp('src/clincoded'), '');
                            }
                        },
                        {
                            match: 'cssFile',
                            replacement: function () {
                                return grunt.filerev.summary["src/clincoded/static/css/style.css"].replace(new RegExp('src/clincoded'), '');
                            }
                        }
                    ]
                },
                files: [
                    {expand: true, flatten: true, src: ['src/clincoded/static/build/*.js'], dest: 'src/clincoded/static/build/'}
                ]
            },
            dev: {
                options: {
                    patterns: [
                        {
                            match: 'bundleJsFile',
                            replacement: "/static/build/bundle.js"
                        },
                        {
                            match: 'cssFile',
                            replacement: "/static/css/style.css"
                        }
                    ]
                },
                files: [
                    {expand: true, flatten: true, src: ['src/clincoded/static/build/*.js'], dest: 'src/clincoded/static/build/'}
                ]
            }
        },
        compass: {
            dev: {}
        },
        watch: {
            scripts: {
                files: 'src/clincoded/static/components/**/*.js',
                tasks: ['browserify:browser', 'browserify:server', 'replace:dev']
            },
            css: {
                files: 'src/clincoded/static/scss/**/*.scss',
                tasks: ['compass']
            }
        }
    });

    grunt.registerMultiTask('browserify', function () {
        var browserify = require('browserify');
        var _ = grunt.util._;
        var path = require('path');
        var fs = require('fs');
        var exorcist   = require('exorcist');
        var data = this.data;
        var options = _.extend({
            debug: true,
            cache: {},
            packageCache: {}
        }, data.options);

        var b = browserify(options);
        var i;
        var reqs = [];
        (data.src || []).forEach(function (src) {
            reqs.push.apply(reqs, grunt.file.expand({filter: 'isFile'}, src).map(function (f) {
                return [path.resolve(f), {entry: true}];
            }));
        });
        (data.require || []).forEach(function (req) {
            if (typeof req === 'string') req = [req];
            reqs.push(req);
        });

        for (i = 0; i < reqs.length; i++) {
            b.require.apply(b, reqs[i]);
        }

        var external = data.external || [];
        for (i = 0; i < external.length; i++) {
            b.external(external[i]);
        }

        options.filter = function (id) {
            return external.indexOf(id) < 0;
        };

        var ignore = data.ignore || [];
        for (i = 0; i < ignore.length; i++) {
            b.ignore(ignore[i]);
        }

        (data.transform || []).forEach(function (args) {
            if (typeof args === 'string') args = [args];
            b.transform.apply(b, args);
        });

        (data.plugin || []).forEach(function (args) {
            if (typeof args === 'string') args = [args];
            b.plugin.apply(b, args);
        });

        var dest = data.dest;
        grunt.file.mkdir(path.dirname(dest));
        var mapFilePath = dest + '.map';

        var bundle = function(done) {
            var out = fs.createWriteStream(dest);
            if (!minifyEnabled) {
                console.log("write map files in dev " + mapFilePath );
                b.bundle({ debug: true })
                    .pipe(exorcist(mapFilePath))
                    .pipe(out);
            } else {
                b.bundle().pipe(out);
            }
            out.on('close', function() {
                grunt.log.write('Wrote ' + dest + '\n');
                if (done !== undefined) done();
            });
        };
        b.on('update', function() { bundle(); });
        var done = this.async();
        bundle(done);
    });

    grunt.registerTask('wait', function() {
        grunt.log.write('Waiting for changes...\n');
        this.async();
    });

    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-filerev');
    grunt.loadNpmTasks('grunt-replace');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.registerTask('default', ['browserify', 'copy', 'filerev', 'replace:dist']);
    grunt.registerTask('dev', ['browserify','replace:dev', 'watch']);

};

<commit_msg>:hammer: Added global transform in 'envify' config<commit_after>'use strict';

if (process.env.NODE_ENV == 'production'){
    console.log("\n****** PRODUCTION ENVIRONMENT ******\n");
}

//eslint directive to ignore "undefined" global variables
/* global __dirname process */

module.exports = function(grunt) {
    var path = require('path');

    function compressPath(p) {
        var src = 'src/clincoded/static/';
        p = path.relative(__dirname, p);
        if (p.slice(0, src.length) == src) {
            return '../' + p.slice(src.length);
        }
        return '../../' + p;
    }

    grunt.config('env', grunt.option('env') || process.env.GRUNT_ENV || 'production');
    var minifyEnabled = grunt.config('minifyEnabled', grunt.config('env') === 'production');

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        browserify: {
            brace: {
                dest: './src/clincoded/static/build/brace.js',
                require: [
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light'
                ],
                plugin: [
                    ['minifyify', {
                        minify: minifyEnabled,
                        map: 'brace.js.map',
                        output: './src/clincoded/static/build/brace.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'}
                    }]
                ]
            },
            inline: {
                dest: './src/clincoded/static/build/inline.js',
                src: [
                    './src/clincoded/static/inline.js'
                ],
                require: [
                    'scriptjs',
                    'google-analytics'
                ],
                transform: [
                    ['babelify', {sourceMaps: true, babelrc: true}],
                    'brfs',
                    ['envify', {global: true}]
                ],
                plugin: [
                    ['minifyify', {
                        minify: minifyEnabled,
                        map: '/static/build/inline.js.map',
                        output: './src/clincoded/static/build/inline.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'}
                    }]
                ]
            },
            browser: {
                dest: './src/clincoded/static/build/bundle.js',
                src: [
                    'es5-shims',
                    'es5-shim/es5-sham',
                    'babel-polyfill',
                    'html5shiv/dist/html5shiv',
                    './src/clincoded/static/libs/compat.js', // The shims should execute first
                    './src/clincoded/static/libs/sticky_header.js',
                    './src/clincoded/static/libs/respond.js',
                    './src/clincoded/static/browser.js'
                ],
                external: [
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light',
                    'scriptjs',
                    'google-analytics'
                ],
                transform: [
                    ['babelify', {sourceMaps: true, babelrc: true}],
                    'brfs',
                    ['envify', {global: true}]
                ],
                plugin: [
                    ['minifyify', {
                        minify: minifyEnabled,
                        map: 'bundle.js.map',
                        output: './src/clincoded/static/build/bundle.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'}
                    }]
                ]
            },
            server: {
                dest: './src/clincoded/static/build/renderer.js',
                src: ['./src/clincoded/static/server.js'],
                options: {
                    builtins: false,
                    detectGlobals: false
                },
                transform: [
                    ['babelify', {sourceMaps: true, babelrc: true}],
                    'brfs',
                    ['envify', {global: true}]
                ],
                plugin: [
                    ['minifyify', {
                        minify: minifyEnabled,
                        map:'renderer.js.map',
                        output: './src/clincoded/static/build/renderer.js.map',
                        compressPath: compressPath,
                        uglify: {mangle: process.env.NODE_ENV == 'production'}
                    }]
                ],
                external: [
                    'assert',
                    'brace',
                    'brace/mode/json',
                    'brace/theme/solarized_light',
                    'source-map-support'
                ],
                ignore: [
                    'jquery',
                    'scriptjs',
                    'google-analytics',
                    'ckeditor'
                ]
            }
        },
        copy: {
            ckeditor: {
                expand: true,
                cwd: 'node_modules/node-ckeditor',
                src: 'ckeditor/**',
                dest: 'src/clincoded/static/build/'
            }
        },
        filerev: {
            options: {
                algorithm: 'md5',
                length: 8
            },
            css: {
                src: ['./src/clincoded/static/css/style.css'],
                dest: './src/clincoded/static/css'
            },
            js: {
                src: ['./src/clincoded/static/build/bundle.js'],
                dest: './src/clincoded/static/build/'
            }
        },
        replace: {
            dist: {
                options: {
                    patterns: [
                        {
                            match: 'bundleJsFile',
                            replacement: function () {
                                return grunt.filerev.summary["src/clincoded/static/build/bundle.js"].replace(new RegExp('src/clincoded'), '');
                            }
                        },
                        {
                            match: 'cssFile',
                            replacement: function () {
                                return grunt.filerev.summary["src/clincoded/static/css/style.css"].replace(new RegExp('src/clincoded'), '');
                            }
                        }
                    ]
                },
                files: [
                    {expand: true, flatten: true, src: ['src/clincoded/static/build/*.js'], dest: 'src/clincoded/static/build/'}
                ]
            },
            dev: {
                options: {
                    patterns: [
                        {
                            match: 'bundleJsFile',
                            replacement: "/static/build/bundle.js"
                        },
                        {
                            match: 'cssFile',
                            replacement: "/static/css/style.css"
                        }
                    ]
                },
                files: [
                    {expand: true, flatten: true, src: ['src/clincoded/static/build/*.js'], dest: 'src/clincoded/static/build/'}
                ]
            }
        },
        compass: {
            dev: {}
        },
        watch: {
            scripts: {
                files: 'src/clincoded/static/components/**/*.js',
                tasks: ['browserify:browser', 'browserify:server', 'replace:dev']
            },
            css: {
                files: 'src/clincoded/static/scss/**/*.scss',
                tasks: ['compass']
            }
        }
    });

    grunt.registerMultiTask('browserify', function () {
        var browserify = require('browserify');
        var _ = grunt.util._;
        var path = require('path');
        var fs = require('fs');
        var exorcist   = require('exorcist');
        var data = this.data;
        var options = _.extend({
            debug: true,
            cache: {},
            packageCache: {}
        }, data.options);

        var b = browserify(options);
        var i;
        var reqs = [];
        (data.src || []).forEach(function (src) {
            reqs.push.apply(reqs, grunt.file.expand({filter: 'isFile'}, src).map(function (f) {
                return [path.resolve(f), {entry: true}];
            }));
        });
        (data.require || []).forEach(function (req) {
            if (typeof req === 'string') req = [req];
            reqs.push(req);
        });

        for (i = 0; i < reqs.length; i++) {
            b.require.apply(b, reqs[i]);
        }

        var external = data.external || [];
        for (i = 0; i < external.length; i++) {
            b.external(external[i]);
        }

        options.filter = function (id) {
            return external.indexOf(id) < 0;
        };

        var ignore = data.ignore || [];
        for (i = 0; i < ignore.length; i++) {
            b.ignore(ignore[i]);
        }

        (data.transform || []).forEach(function (args) {
            if (typeof args === 'string') args = [args];
            b.transform.apply(b, args);
        });

        (data.plugin || []).forEach(function (args) {
            if (typeof args === 'string') args = [args];
            b.plugin.apply(b, args);
        });

        var dest = data.dest;
        grunt.file.mkdir(path.dirname(dest));
        var mapFilePath = dest + '.map';

        var bundle = function(done) {
            var out = fs.createWriteStream(dest);
            if (!minifyEnabled) {
                console.log("write map files in dev " + mapFilePath );
                b.bundle({ debug: true })
                    .pipe(exorcist(mapFilePath))
                    .pipe(out);
            } else {
                b.bundle().pipe(out);
            }
            out.on('close', function() {
                grunt.log.write('Wrote ' + dest + '\n');
                if (done !== undefined) done();
            });
        };
        b.on('update', function() { bundle(); });
        var done = this.async();
        bundle(done);
    });

    grunt.registerTask('wait', function() {
        grunt.log.write('Waiting for changes...\n');
        this.async();
    });

    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-filerev');
    grunt.loadNpmTasks('grunt-replace');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.registerTask('default', ['browserify', 'copy', 'filerev', 'replace:dist']);
    grunt.registerTask('dev', ['browserify','replace:dev', 'watch']);

};

<|endoftext|>


<commit_before>var path = require('path');

var files = {
  js: {
    lib: 'lib/**/*.js',
    dev: 'dev/**/*.js',
    www: 'www/app/**/*.js'
  },
  html: {
    index: 'www/index.html',
    partials: 'www/partials/**/*.html'
  }
};

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

    //Step 1
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      //Target - "all"
      all: ['Gruntfile.js', 'collectionProcessor.js', files.js.lib, files.js.dev, files.js.www]
    },
    jsbeautifier: {
      files: ['Gruntfile.js', 'collectionProcessor.js', files.js.lib, files.js.dev, files.js.www],
      options: {
        config: '.jsbeautifyrc'
      }
    },
    watch: {
      express: {
        files: [files.js.www, files.html.index, files.html.partials],
        tasks: ['jshint'],
        options: {
          livereload: 35730
        }
      }
    },
    express: {
      local: {
        options: {
          script: 'server.js'
        }
      }
    },
    shell: {
      collectionProcessor: {
        command: 'node collectionProcessor.js'
      },
      kickoffCollection: {
        command: 'node dev/kickoff-collection.js'
      },
      pack: {
        command: 'tar -czf ' + path.join(__dirname, 'deploy.tar.gz') + ' lib node_modules controllers www config.json package.json server.js collectionProcessor.js'
      },
      provision: {
        command: 'vagrant provision'
      },
      localVm: {
        command: 'vagrant up'
      },
      destroyLocalVm: {
        command: 'vagrant destroy -f'
      },
      dockerRabbit: {
        command: 'docker run -d -p 5672:5672 -p 15672:15672 rabbitmq'
      },
      /* This task is only used by the owner of https://github.com/thealah/bgg to deploy to the dev environment */
      provisionToAwsDev: {
        command: 'ansible-playbook --become-user root --user ubuntu -i aws_inventory --private-key /amazonkeys/IISWeb.pem playbook.yml',
        options: {
          execOptions: {
            cwd: './provision/'
          }
        }
      },
      mongodb: {
        command: 'mkdir -m a=rwx -p /data/bgg && mongod --dbpath /data/bgg',
        options: {
            async: true,
            stdout: true,
            stderr: true,
            failOnError: true,
            execOptions: {
                cwd: '.'
              }
          }
      },
      rabbitmq: {
        command: 'rabbitmq-server',
        options: {
          async: true,
          stdout: true,
          stderr: true,
          failOnError: true,
          execOptions: {
            cwd: '.'
          }
        }
      },
      stopRabbitMQ: {
        command: 'rabbitmqctl -q stop',
        options: {
          stderr: true,
          failOnError: false
        }
      },
      stopMongoDB: {
        command: 'mongo --eval "db.getSiblingDB(\'admin\').shutdownServer()"',
        options: {
          stderr: true,
          failOnError: false
        }
      }
    },
    availabletasks: {
      tasks: {
        options: {
          filter: 'exclude',
          tasks: ['availabletasks']
        }
      }
    },
    parallel: {
      server: {
        options: {
          grunt: true,
          stream: true
        },
        tasks: ['website', 'collectionProcessor']
      }
    }
  });

  require('load-grunt-tasks')(grunt);
  grunt.loadNpmTasks('grunt-available-tasks'); //For some reason, load-grunt-tasks doesn't like this NpmTask.
  grunt.loadNpmTasks('grunt-shell-spawn'); // Enables grunt tasks to be run in the background.

  grunt.registerTask('default', ['jshint:all', 'jsbeautifier', 'server']);
  grunt.registerTask('kickoffCollection', 'Run a test message for the processor to pick up on', ['shell:kickoffCollection']);
  grunt.registerTask('collectionProcessor', 'Run the processor responsible for handling BGG integration', ['shell:collectionProcessor']);
  grunt.registerTask('website', 'Run the website', ['express:local', 'watch:express']);
  grunt.registerTask('server', 'Run the website and processor side-by-side', ['parallel:server']);
  grunt.registerTask('mongodb', 'Start the mongodb server', ['shell:mongodb']);
  grunt.registerTask('rabbitmq', 'Start the rabbitmq-server', ['shell:rabbitmq']);
  grunt.registerTask('create-vm', 'Create a local vm using Vagrant and Ansible', ['shell:pack', 'shell:localVm']);
  grunt.registerTask('recreate-vm', 'Remake your local vm using Vagrant and Ansible', ['shell:destroyLocalVm', 'create-vm']);
  grunt.registerTask('deploy-vm', 'Delete your local vm you created using create-vm', ['shell:pack', 'shell:provision']);
  grunt.registerTask('cleanup', 'Stop the running processes', ['shell:stopMongoDB', 'shell:stopRabbitMQ']);

  grunt.registerTask('test', 'This command is what gets run by the Travis CI build to test the app.', ['jshint:all']);
};
<commit_msg>Fixed issue with Rabbitmq not starting correctly<commit_after>var path = require('path');

var files = {
  js: {
    lib: 'lib/**/*.js',
    dev: 'dev/**/*.js',
    www: 'www/app/**/*.js'
  },
  html: {
    index: 'www/index.html',
    partials: 'www/partials/**/*.html'
  }
};

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

    //Step 1
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      //Target - "all"
      all: ['Gruntfile.js', 'collectionProcessor.js', files.js.lib, files.js.dev, files.js.www]
    },
    jsbeautifier: {
      files: ['Gruntfile.js', 'collectionProcessor.js', files.js.lib, files.js.dev, files.js.www],
      options: {
        config: '.jsbeautifyrc'
      }
    },
    watch: {
      express: {
        files: [files.js.www, files.html.index, files.html.partials],
        tasks: ['jshint'],
        options: {
          livereload: 35730
        }
      }
    },
    express: {
      local: {
        options: {
          script: 'server.js'
        }
      }
    },
    shell: {
      collectionProcessor: {
        command: 'node collectionProcessor.js'
      },
      kickoffCollection: {
        command: 'node dev/kickoff-collection.js'
      },
      pack: {
        command: 'tar -czf ' + path.join(__dirname, 'deploy.tar.gz') + ' lib node_modules controllers www config.json package.json server.js collectionProcessor.js'
      },
      provision: {
        command: 'vagrant provision'
      },
      localVm: {
        command: 'vagrant up'
      },
      destroyLocalVm: {
        command: 'vagrant destroy -f'
      },
      dockerRabbit: {
        command: 'docker run -d -p 5672:5672 -p 15672:15672 rabbitmq'
      },
      /* This task is only used by the owner of https://github.com/thealah/bgg to deploy to the dev environment */
      provisionToAwsDev: {
        command: 'ansible-playbook --become-user root --user ubuntu -i aws_inventory --private-key /amazonkeys/IISWeb.pem playbook.yml',
        options: {
          execOptions: {
            cwd: './provision/'
          }
        }
      },
      mongodb: {
        command: 'mkdir -m a=rwx -p /data/bgg && mongod --dbpath /data/bgg',
        options: {
            async: true,
            stdout: true,
            stderr: true,
            failOnError: true,
            execOptions: {
                cwd: '.'
              }
          }
      },
      rabbitmq: {
        command: 'rabbitmq-server -detached',
        options: {
          async: false,
          stdout: true,
          stderr: true,
          failOnError: true,
          execOptions: {
            cwd: '.'
          }
        }
      },
      stopRabbitMQ: {
        command: 'rabbitmqctl -q stop',
        options: {
          stderr: false,
          stdout: false,
          failOnError: false
        }
      },
      stopMongoDB: {
        command: 'mongo --eval "db.getSiblingDB(\'admin\').shutdownServer()"',
        options: {
          stderr: false,
          stdout: false,
          failOnError: false
        }
      }
    },
    availabletasks: {
      tasks: {
        options: {
          filter: 'exclude',
          tasks: ['availabletasks']
        }
      }
    },
    parallel: {
      server: {
        options: {
          grunt: true,
          stream: true
        },
        tasks: ['website', 'collectionProcessor']
      }
    }
  });

  require('load-grunt-tasks')(grunt);
  grunt.loadNpmTasks('grunt-available-tasks'); //For some reason, load-grunt-tasks doesn't like this NpmTask.
  grunt.loadNpmTasks('grunt-shell-spawn'); // Enables grunt tasks to be run in the background.

  grunt.registerTask('default', ['jshint:all', 'jsbeautifier', 'server']);
  grunt.registerTask('kickoffCollection', 'Run a test message for the processor to pick up on', ['shell:kickoffCollection']);
  grunt.registerTask('collectionProcessor', 'Run the processor responsible for handling BGG integration', ['shell:collectionProcessor']);
  grunt.registerTask('website', 'Run the website', ['express:local', 'watch:express']);
  grunt.registerTask('server', 'Run the website and processor side-by-side', ['parallel:server']);
  grunt.registerTask('mongodb', 'Start the mongodb server', ['shell:mongodb']);
  grunt.registerTask('rabbitmq', 'Start the rabbitmq-server', ['shell:rabbitmq']);
  grunt.registerTask('create-vm', 'Create a local vm using Vagrant and Ansible', ['shell:pack', 'shell:localVm']);
  grunt.registerTask('recreate-vm', 'Remake your local vm using Vagrant and Ansible', ['shell:destroyLocalVm', 'create-vm']);
  grunt.registerTask('deploy-vm', 'Delete your local vm you created using create-vm', ['shell:pack', 'shell:provision']);
  grunt.registerTask('cleanup', 'Stop the running processes', ['shell:stopMongoDB', 'shell:stopRabbitMQ']);

  grunt.registerTask('test', 'This command is what gets run by the Travis CI build to test the app.', ['jshint:all']);
};
<|endoftext|>