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

    var _ = require('lodash');
    var path = require('path');
    var through = require('through2');

    var excludedPlugins = [
        'react-native'
    ];

    var plugins = grunt.option('plugins');
    // Create plugin paths and verify they exist
    plugins = _.map(plugins ? plugins.split(',') : [], function (plugin) {
        var path = 'plugins/' + plugin + '.js';

        if(!grunt.file.exists(path))
            throw new Error("Plugin '" + plugin + "' not found in plugins directory.");

        return path;
    });

    // custom browserify transformer to re-write plugins to
    // self-register with Raven via addPlugin
    function AddPluginBrowserifyTransformer() {
        return function (file, options) {
            return through(function (buf, enc, next) {
                buf = buf.toString('utf8');
                if (/plugins/.test(file)) {
                    buf += "\nRaven.addPlugin(module.exports);";
                }
                this.push(buf);
                next();
            });
        };
    }

    // Taken from http://dzone.com/snippets/calculate-all-combinations
    var combine = function (a) {
        var fn = function (n, src, got, all) {
            if (n === 0) {
                all.push(got);
                return;
            }

            for (var j = 0; j < src.length; j++) {
                fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all);
            }
        };

        var excluded = _.map(excludedPlugins, function(plugin) {
            return 'plugins/' + plugin + '.js';
        });

        // Remove the plugins that we don't want to build
        a = _.filter(a, function(n) {
            return excluded.indexOf(n) === -1;
        });

        var all = [a];

        for (var i = 0; i < a.length; i++) {
            fn(i, a, [], all);
        }

        return all;
    };

    var pluginCombinations = combine(grunt.file.expand('plugins/*.js'));
    var pluginConcatFiles = _.reduce(pluginCombinations, function (dict, comb) {
        var key = _.map(comb, function (plugin) {
            return path.basename(plugin, '.js');
        });
        key.sort();

        var dest = path.join('build/', key.join(','), '/raven.js');
        dict[dest] = ['src/raven.js'].concat(comb);

        return dict;
    }, {});

    var gruntConfig = {
        pkg: grunt.file.readJSON('package.json'),
        aws: grunt.file.exists('aws.json') ? grunt.file.readJSON('aws.json'): {},

        clean: ['build'],

        browserify: {
            options: {
                browserifyOptions: {
                    banner: grunt.file.read('template/_copyright.js'),
                    standalone: 'Raven' // umd
                }
            },
            core: {
                src: 'src/raven.js',
                dest: 'build/raven.js'
            },
            plugins: {
                files: pluginConcatFiles,
                transform: [
                    [ new AddPluginBrowserifyTransformer() ]
                ]
            },
            test: {
                src: 'test/**/*.test.js',
                dest: 'build/raven.test.js',
                options: {
                    browserifyOptions: {
                        debug: true // source maps
                    }
                }
            }
        },

        uglify: {
            options: {
                sourceMap: function (dest) {
                    return path.join(path.dirname(dest),
                                     path.basename(dest, '.js')) +
                           '.map';
                },
                sourceMappingURL: function (dest) {
                    return path.basename(dest, '.js') + '.map';
                },
                preserveComments: 'some'
            },
            dist: {
                src: ['build/**/*.js'],
                ext: '.min.js',
                expand: true
            }
        },

        fixSourceMaps: {
            all: ['build/**/*.map']
        },

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

        mocha: {
            all: {
                options: {
                    mocha: {
                        ignoreLeaks: true,
                        grep:        grunt.option('grep')
                    },
                    log:      true,
                    reporter: 'Dot',
                    run:      true
                },
                src: ['test/index.html'],
                nonull: true
            }
        },

        release: {
            options: {
                npm:           false,
                commitMessage: 'Release <%= version %>'
            }
        },

        s3: {
            options: {
                key: '<%= aws.key %>',
                secret: '<%= aws.secret %>',
                bucket: '<%= aws.bucket %>',
                access: 'public-read',
                // Limit concurrency
                maxOperations: 20,
                headers: {
                    // Surrogate-Key header for Fastly to purge by release
                    'x-amz-meta-surrogate-key': '<%= pkg.release %>'
                }
            },
            all: {
                upload: [{
                    src: 'build/**/*',
                    dest: '<%= pkg.release %>/',
                    rel: 'build/'
                }]
            }
        },

        connect: {
            test: {
                options: {
                    port: 8000,
                    debug: true,
                    keepalive: true
                }
            },

            docs: {
                options: {
                    port: 8000,
                    debug: true,
                    base: 'docs/_build/html',
                    keepalive: true
                }
            }
        },

        copy: {
            dist: {
                expand: true,
                flatten: true,
                cwd: 'build/',
                src: '**',
                dest: 'dist/'
            }
        },

        sri: {
            dist: {
                src: ['dist/*.js'],
                options: {
                    dest: 'dist/sri.json',
                    pretty: true
                }
            },
            build: {
                src: ['build/**/*.js'],
                options: {
                    dest: 'build/sri.json',
                    pretty: true
                }
            }
        }
    };

    grunt.initConfig(gruntConfig);

    // Custom Grunt tasks
    grunt.registerTask('version', function() {
        var pkg = grunt.config.get('pkg');
        if (grunt.option('dev')) {
            pkg.release = 'dev';
            pkg.version = grunt.config.get('gitinfo').local.branch.current.shortSHA;
        } else {
            pkg.release = pkg.version;
        }
        grunt.config.set('pkg', pkg);
    });

    grunt.registerMultiTask('fixSourceMaps', function () {
        this.files.forEach(function (f) {
            var result;
            var sources = f.src.filter(function (filepath) {
                if (!grunt.file.exists(filepath)) {
                    grunt.log.warn('Source file "' + filepath + '" not found.');
                    return false;
                } else {
                    return true;
                }
            }).forEach(function (filepath) {
                var base = path.dirname(filepath);
                var sMap = grunt.file.readJSON(filepath);
                sMap.file = path.relative(base, sMap.file);
                sMap.sources = _.map(sMap.sources, path.relative.bind(path, base));

                grunt.file.write(filepath, JSON.stringify(sMap));
                // Print a success message.
                grunt.log.writeln('File "' + filepath + '" fixed.');
            });
        });
    });

    // Grunt contrib tasks
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-copy');

    // 3rd party Grunt tasks
    grunt.loadNpmTasks('grunt-browserify');
    grunt.loadNpmTasks('grunt-mocha');
    grunt.loadNpmTasks('grunt-release');
    grunt.loadNpmTasks('grunt-s3');
    grunt.loadNpmTasks('grunt-gitinfo');
    grunt.loadNpmTasks('grunt-sri');

    // Build tasks
    grunt.registerTask('_prep', ['clean', 'gitinfo', 'version']);
    grunt.registerTask('browserify.core', ['_prep', 'browserify:core']);
    grunt.registerTask('browserify.plugins', ['_prep', 'browserify:plugins']);
    grunt.registerTask('build.test', ['_prep', 'browserify:test']);
    grunt.registerTask('build.core', ['browserify.core', 'uglify', 'fixSourceMaps', 'sri:dist']);
    grunt.registerTask('build.all', ['browserify.plugins', 'uglify', 'fixSourceMaps', 'sri:dist', 'sri:build']);
    grunt.registerTask('build', ['build.all']);
    grunt.registerTask('dist', ['build.core', 'copy:dist']);

    // Test task
    grunt.registerTask('test', ['jshint', 'mocha', 'browserify.core', 'browserify:test']);

    // Webserver tasks
    grunt.registerTask('run:test', ['connect:test']);
    grunt.registerTask('run:docs', ['connect:docs']);

    grunt.registerTask('publish', ['test', 'build.all', 's3']);
    grunt.registerTask('default', ['test']);
};
<commit_msg>Strip TEST code from minified dist build<commit_after>
module.exports = function(grunt) {
    "use strict";

    var _ = require('lodash');
    var path = require('path');
    var through = require('through2');

    var excludedPlugins = [
        'react-native'
    ];

    var plugins = grunt.option('plugins');
    // Create plugin paths and verify they exist
    plugins = _.map(plugins ? plugins.split(',') : [], function (plugin) {
        var path = 'plugins/' + plugin + '.js';

        if(!grunt.file.exists(path))
            throw new Error("Plugin '" + plugin + "' not found in plugins directory.");

        return path;
    });

    // custom browserify transformer to re-write plugins to
    // self-register with Raven via addPlugin
    function AddPluginBrowserifyTransformer() {
        return function (file, options) {
            return through(function (buf, enc, next) {
                buf = buf.toString('utf8');
                if (/plugins/.test(file)) {
                    buf += "\nRaven.addPlugin(module.exports);";
                }
                this.push(buf);
                next();
            });
        };
    }

    // Taken from http://dzone.com/snippets/calculate-all-combinations
    var combine = function (a) {
        var fn = function (n, src, got, all) {
            if (n === 0) {
                all.push(got);
                return;
            }

            for (var j = 0; j < src.length; j++) {
                fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all);
            }
        };

        var excluded = _.map(excludedPlugins, function(plugin) {
            return 'plugins/' + plugin + '.js';
        });

        // Remove the plugins that we don't want to build
        a = _.filter(a, function(n) {
            return excluded.indexOf(n) === -1;
        });

        var all = [a];

        for (var i = 0; i < a.length; i++) {
            fn(i, a, [], all);
        }

        return all;
    };

    var pluginCombinations = combine(grunt.file.expand('plugins/*.js'));
    var pluginConcatFiles = _.reduce(pluginCombinations, function (dict, comb) {
        var key = _.map(comb, function (plugin) {
            return path.basename(plugin, '.js');
        });
        key.sort();

        var dest = path.join('build/', key.join(','), '/raven.js');
        dict[dest] = ['src/raven.js'].concat(comb);

        return dict;
    }, {});

    var gruntConfig = {
        pkg: grunt.file.readJSON('package.json'),
        aws: grunt.file.exists('aws.json') ? grunt.file.readJSON('aws.json'): {},

        clean: ['build'],

        browserify: {
            options: {
                browserifyOptions: {
                    banner: grunt.file.read('template/_copyright.js'),
                    standalone: 'Raven' // umd
                }
            },
            core: {
                src: 'src/raven.js',
                dest: 'build/raven.js'
            },
            plugins: {
                files: pluginConcatFiles,
                transform: [
                    [ new AddPluginBrowserifyTransformer() ]
                ]
            },
            test: {
                src: 'test/**/*.test.js',
                dest: 'build/raven.test.js',
                options: {
                    browserifyOptions: {
                        debug: true // source maps
                    }
                }
            }
        },

        uglify: {
            options: {
                sourceMap: function (dest) {
                    return path.join(path.dirname(dest),
                                     path.basename(dest, '.js')) +
                           '.map';
                },
                sourceMappingURL: function (dest) {
                    return path.basename(dest, '.js') + '.map';
                },
                preserveComments: 'some',
                compress: {
                    dead_code: true,
                    global_defs: {
                        "TEST": false
                    }
                }
            },
            dist: {
                src: ['build/**/*.js'],
                ext: '.min.js',
                expand: true
            }
        },

        fixSourceMaps: {
            all: ['build/**/*.map']
        },

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

        mocha: {
            all: {
                options: {
                    mocha: {
                        ignoreLeaks: true,
                        grep:        grunt.option('grep')
                    },
                    log:      true,
                    reporter: 'Dot',
                    run:      true
                },
                src: ['test/index.html'],
                nonull: true
            }
        },

        release: {
            options: {
                npm:           false,
                commitMessage: 'Release <%= version %>'
            }
        },

        s3: {
            options: {
                key: '<%= aws.key %>',
                secret: '<%= aws.secret %>',
                bucket: '<%= aws.bucket %>',
                access: 'public-read',
                // Limit concurrency
                maxOperations: 20,
                headers: {
                    // Surrogate-Key header for Fastly to purge by release
                    'x-amz-meta-surrogate-key': '<%= pkg.release %>'
                }
            },
            all: {
                upload: [{
                    src: 'build/**/*',
                    dest: '<%= pkg.release %>/',
                    rel: 'build/'
                }]
            }
        },

        connect: {
            test: {
                options: {
                    port: 8000,
                    debug: true,
                    keepalive: true
                }
            },

            docs: {
                options: {
                    port: 8000,
                    debug: true,
                    base: 'docs/_build/html',
                    keepalive: true
                }
            }
        },

        copy: {
            dist: {
                expand: true,
                flatten: true,
                cwd: 'build/',
                src: '**',
                dest: 'dist/'
            }
        },

        sri: {
            dist: {
                src: ['dist/*.js'],
                options: {
                    dest: 'dist/sri.json',
                    pretty: true
                }
            },
            build: {
                src: ['build/**/*.js'],
                options: {
                    dest: 'build/sri.json',
                    pretty: true
                }
            }
        }
    };

    grunt.initConfig(gruntConfig);

    // Custom Grunt tasks
    grunt.registerTask('version', function() {
        var pkg = grunt.config.get('pkg');
        if (grunt.option('dev')) {
            pkg.release = 'dev';
            pkg.version = grunt.config.get('gitinfo').local.branch.current.shortSHA;
        } else {
            pkg.release = pkg.version;
        }
        grunt.config.set('pkg', pkg);
    });

    grunt.registerMultiTask('fixSourceMaps', function () {
        this.files.forEach(function (f) {
            var result;
            var sources = f.src.filter(function (filepath) {
                if (!grunt.file.exists(filepath)) {
                    grunt.log.warn('Source file "' + filepath + '" not found.');
                    return false;
                } else {
                    return true;
                }
            }).forEach(function (filepath) {
                var base = path.dirname(filepath);
                var sMap = grunt.file.readJSON(filepath);
                sMap.file = path.relative(base, sMap.file);
                sMap.sources = _.map(sMap.sources, path.relative.bind(path, base));

                grunt.file.write(filepath, JSON.stringify(sMap));
                // Print a success message.
                grunt.log.writeln('File "' + filepath + '" fixed.');
            });
        });
    });

    // Grunt contrib tasks
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-copy');

    // 3rd party Grunt tasks
    grunt.loadNpmTasks('grunt-browserify');
    grunt.loadNpmTasks('grunt-mocha');
    grunt.loadNpmTasks('grunt-release');
    grunt.loadNpmTasks('grunt-s3');
    grunt.loadNpmTasks('grunt-gitinfo');
    grunt.loadNpmTasks('grunt-sri');

    // Build tasks
    grunt.registerTask('_prep', ['clean', 'gitinfo', 'version']);
    grunt.registerTask('browserify.core', ['_prep', 'browserify:core']);
    grunt.registerTask('browserify.plugins', ['_prep', 'browserify:plugins']);
    grunt.registerTask('build.test', ['_prep', 'browserify:test']);
    grunt.registerTask('build.core', ['browserify.core', 'uglify', 'fixSourceMaps', 'sri:dist']);
    grunt.registerTask('build.all', ['browserify.plugins', 'uglify', 'fixSourceMaps', 'sri:dist', 'sri:build']);
    grunt.registerTask('build', ['build.all']);
    grunt.registerTask('dist', ['build.core', 'copy:dist']);

    // Test task
    grunt.registerTask('test', ['jshint', 'mocha', 'browserify.core', 'browserify:test']);

    // Webserver tasks
    grunt.registerTask('run:test', ['connect:test']);
    grunt.registerTask('run:docs', ['connect:docs']);

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


<commit_before>module.exports = function(grunt) {
  //--------------------------------------------------
  //------------Project config------------------------
  //--------------------------------------------------
  var pkg = grunt.file.readJSON('package.json');
  grunt.initConfig({
    // Metadata.
    pkg: pkg,
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Released under the <%= pkg.license %> License */\n',
    // Task configuration.
    peg: {
      parser: {
        src: 'src/dust.pegjs',
        dest: 'lib/parser.js',
        options: {
          wrapper: function(src, parser) {
            var buildMsg = 'Do not edit this file directly. It is automatically generated from src/dust.pegjs';
            var wrapper = grunt.file.read("src/umdParserWrapper.js").replace('@@build', buildMsg).split('@@parser');
            return wrapper[0] + parser + wrapper[1];
          }
        }
      }
    },
    execute: {
      testRhino: {
        src: 'node_modules/.bin/rhino*',
        options: {
          args: ['-f', 'test/rhino.spec.js']
        }
      },
      buildParser: {
        src: 'src/build.js'
      }
    },
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      core: {
        src: ['lib/dust.js', 'src/amd-core.js'],
        dest: 'tmp/dust-core.js'
      },
      full: {
        src: ['lib/dust.js', 'lib/parser.js', 'lib/compiler.js', 'src/amd-full.js'],
        dest: 'tmp/dust-full.js'
      }
    },
    copy: {
      core: {
        src: 'tmp/dust-core.js',
        dest: 'dist/dust-core.js'
      },
      coreMin: {
        src: 'tmp/dust-core.min.js',
        dest: 'dist/dust-core.min.js'
      },
      full: {
        src: 'tmp/dust-full.js',
        dest: 'dist/dust-full.js'
      },
      fullMin: {
        src: 'tmp/dust-full.min.js',
        dest: 'dist/dust-full.min.js'
      },
      license: {
        src: 'LICENSE',
        dest: 'dist/'
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>',
        mangle: {
          except: ['require', 'define', 'module', 'dust']
        }
      },
      core: {
        src: '<%= concat.core.dest %>',
        dest: 'tmp/dust-core.min.js'
      },
      full: {
        src: '<%= concat.full.dest %>',
        dest: 'tmp/dust-full.min.js'
      }
    },
    clean: {
      build: ['tmp/*'],
      dist: ['dist/*']
    },
    jshint: {
      options: {
        jshintrc: true
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      libs: {
        src: ['lib/**/*.js', '!lib/parser.js'] // don't hint the parser which is autogenerated from pegjs
      }
    },
    connect: {
     testServer: {
       options: {
         port: 3000,
         keepalive: false
       }
     }
    },
    'saucelabs-jasmine': {
      all: {
        options: {
          urls: ["http://localhost:3000/"],
          build: process.env.TRAVIS_JOB_ID,
          throttled: 3,
          testname: 'core',
          browsers: [
            {browserName: 'chrome'},
            {browserName: 'firefox'},
            {browserName: 'safari', version: 7, platform: 'OS X 10.9'},
            {browserName: 'safari', version: 6, platform: 'OS X 10.8'},
            {browserName: 'internet explorer', version: 11, platform: 'Windows 8.1'},
            {browserName: 'internet explorer', version: 10, platform: 'Windows 8'},
            {browserName: 'internet explorer', version: 9, platform: 'Windows 7'},
            {browserName: 'internet explorer', version: 8, platform: 'Windows 7'}
          ],
          sauceConfig: {
            'video-upload-on-pass': false
          }
        }
      }
    },
    jasmine: {
      options: {
        outfile: 'index.html',
        display: 'short',
        specs: ['test/templates/all.js', 'test/helpers/template.helper.js', 'test/templates.spec.js'],
        vendor: ['node_modules/ayepromise/ayepromise.js', 'test/lib/highland.js', 'test/lib/jsreporter.js']
      },
      /*tests production (minified) code*/
      testProd: {
        src: 'tmp/dust-full.min.js'
      },
      /*tests unminified code, mostly used for debugging by `grunt dev` task*/
      testDev : {
        src: 'tmp/dust-full.js'
      },
      /*runs unit tests with jasmine and collects test coverage info via istanbul template
      * tests unminified version of dust to make sure test coverage starts are correctly calculated
      * istanbul jumbles source code in order to record coverage, so this task is not suited for
      * debugging while developing. Use jasmine:testClient instead, which runs on unminified code
      * and can be easily debugged*/
      coverage : {
        src: 'tmp/dust-full.js',
        options: {
          display: 'none',
          template: require('grunt-template-jasmine-istanbul'),
          templateOptions: {
            coverage: 'tmp/coverage/coverage.json',
            report: 'tmp/coverage',
            thresholds: {
              lines: 82,
              statements: 82,
              branches: 70,
              functions: 85
            }
          }
        }
      }
    },
    jasmine_nodejs: {
      options: {
        useHelpers: true,
        reporters: {
          console: {
            colors: false,
            verbosity: 0
          }
        }
      },
      core: {
        specs: ['test/core.spec.js']
      },
      cjs: {
        specs: ['test/commonJS.spec.js']
      },
      dustc: {
        helpers: ['test/cli/matchers.helper.js'],
        specs: ['test/cli/*']
      },
      templates: {
        specs: ['test/templates.spec.js']
      }
    },
    watch: {
      lib: {
        files: ['<%= jshint.libs.src %>'],
        tasks: ['clean:build', 'buildLib']
      },
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      lib_test: {
        files: ['<%= jshint.libs.src %>', '<%= jasmine.options.specs %>'],
        tasks: ['testPhantom']
      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json', 'lib/dust.js'],
        updateConfigs: ['pkg'],
        push: false,
        commitFiles: ['-a']
      }
    },
    log: {
      coverage: {
        options: {
          message: 'Open <%=jasmine.coverage.options.templateOptions.report%>/index.html in a browser to view the coverage.'
        }
      },
      copyForRelease: {
        options: {
          message: 'OK. Done copying version <%= pkg.version %> build from tmp to dist'
        }
      },
      release: {
        options: {
          message: ['OK. Done bumping, adding, committing, tagging and pushing the new version',
                    '',
                    'You still need to manually do the following:',
                    '  * git push upstream && git push upstream --tags',
                    '  * npm publish'].join('\n')
        }
      }
    },
    githubChanges: {
      dist: {
        options: {
          owner: "linkedin",
          repository: "dustjs",
          tagName: "v<%= pkg.version %>",
          onlyPulls: true,
          useCommitBody: true,
          auth: true
        }
      }
    }
  });

  //--------------------------------------------------
  //------------Custom tasks -------------------------
  //--------------------------------------------------
  grunt.registerMultiTask('log', 'Print some messages', function() {
    grunt.log.ok(this.data.options.message);
  });

  //--------------------------------------------------
  //------------External tasks -----------------------
  //--------------------------------------------------
  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jasmine');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-execute');
  grunt.loadNpmTasks('grunt-peg');
  grunt.loadNpmTasks('grunt-jasmine-nodejs');
  grunt.loadNpmTasks('grunt-github-changes');
  grunt.loadNpmTasks('grunt-saucelabs');

  //--------------------------------------------------
  //------------Grunt task aliases -------------------
  //--------------------------------------------------
  grunt.registerTask('buildLib',       ['jshint:libs', 'concat']);
  grunt.registerTask('build',          ['clean:build', 'peg', 'buildLib', 'uglify']);

  //test tasks
  grunt.registerTask('testNode',       ['jasmine_nodejs:templates', 'jasmine_nodejs:core', 'jasmine_nodejs:cjs']);
  grunt.registerTask('testRhino',      ['build', 'execute:testRhino']);
  grunt.registerTask('testPhantom',    ['build', 'jasmine:testProd']);
  grunt.registerTask('testCli',        ['jasmine_nodejs:dustc']);
  grunt.registerTask('test',           ['build', 'jasmine:testProd', 'testCli', 'testNode', 'execute:testRhino', 'jasmine:coverage']);

  //sauce labs integration (browser testing)
  grunt.registerTask('sauce',          process.env.SAUCE_ACCESS_KEY ? ['jasmine:testProd:build', 'connect:testServer', 'saucelabs-jasmine'] : []);

  //decide whether to run all tests or just the Node tests for Travis CI
  grunt.registerTask('travis',         (process.env.TEST === 'all') ? ['test', 'sauce'] : ['testNode', 'testCli']);

  //task for debugging in browser
  grunt.registerTask('dev',            ['build', 'jasmine:testDev:build', 'connect:testServer', 'watch:lib']);

  //task to run unit tests on client against prod version of code
  grunt.registerTask('testClient',     ['build', 'jasmine:testProd:build', 'connect:testServer', 'watch:lib_test']);

  //coverage report
  grunt.registerTask('coverage',       ['build', 'jasmine:coverage', 'log:coverage']);

  //release tasks
  grunt.registerTask('copyForRelease', ['clean:dist', 'copy', 'log:copyForRelease']);
  grunt.registerTask('buildRelease',   ['test', 'githubChanges', 'copyForRelease']);
  grunt.registerTask('releasePatch',   ['bump-only:patch', 'buildRelease', 'bump-commit', 'log:release']);
  grunt.registerTask('releaseMinor',   ['bump-only:minor', 'buildRelease', 'bump-commit', 'log:release']);
  // major release should probably be done with care
  //grunt.registerTask('releaseMajor',   ['bump-only:major', 'buildRelease', 'bump-commit:major', 'log:release']);

  //default task - full test
  grunt.registerTask('default',        ['test']);
};
<commit_msg>Update Sauce browsers<commit_after>module.exports = function(grunt) {
  //--------------------------------------------------
  //------------Project config------------------------
  //--------------------------------------------------
  var pkg = grunt.file.readJSON('package.json');
  grunt.initConfig({
    // Metadata.
    pkg: pkg,
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Released under the <%= pkg.license %> License */\n',
    // Task configuration.
    peg: {
      parser: {
        src: 'src/dust.pegjs',
        dest: 'lib/parser.js',
        options: {
          wrapper: function(src, parser) {
            var buildMsg = 'Do not edit this file directly. It is automatically generated from src/dust.pegjs';
            var wrapper = grunt.file.read("src/umdParserWrapper.js").replace('@@build', buildMsg).split('@@parser');
            return wrapper[0] + parser + wrapper[1];
          }
        }
      }
    },
    execute: {
      testRhino: {
        src: 'node_modules/.bin/rhino*',
        options: {
          args: ['-f', 'test/rhino.spec.js']
        }
      },
      buildParser: {
        src: 'src/build.js'
      }
    },
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      core: {
        src: ['lib/dust.js', 'src/amd-core.js'],
        dest: 'tmp/dust-core.js'
      },
      full: {
        src: ['lib/dust.js', 'lib/parser.js', 'lib/compiler.js', 'src/amd-full.js'],
        dest: 'tmp/dust-full.js'
      }
    },
    copy: {
      core: {
        src: 'tmp/dust-core.js',
        dest: 'dist/dust-core.js'
      },
      coreMin: {
        src: 'tmp/dust-core.min.js',
        dest: 'dist/dust-core.min.js'
      },
      full: {
        src: 'tmp/dust-full.js',
        dest: 'dist/dust-full.js'
      },
      fullMin: {
        src: 'tmp/dust-full.min.js',
        dest: 'dist/dust-full.min.js'
      },
      license: {
        src: 'LICENSE',
        dest: 'dist/'
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>',
        mangle: {
          except: ['require', 'define', 'module', 'dust']
        }
      },
      core: {
        src: '<%= concat.core.dest %>',
        dest: 'tmp/dust-core.min.js'
      },
      full: {
        src: '<%= concat.full.dest %>',
        dest: 'tmp/dust-full.min.js'
      }
    },
    clean: {
      build: ['tmp/*'],
      dist: ['dist/*']
    },
    jshint: {
      options: {
        jshintrc: true
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      libs: {
        src: ['lib/**/*.js', '!lib/parser.js'] // don't hint the parser which is autogenerated from pegjs
      }
    },
    connect: {
     testServer: {
       options: {
         port: 3000,
         keepalive: false
       }
     }
    },
    'saucelabs-jasmine': {
      all: {
        options: {
          urls: ["http://localhost:3000/"],
          build: process.env.TRAVIS_JOB_ID,
          throttled: 3,
          testname: 'core',
          browsers: [
            {browserName: 'chrome'},
            {browserName: 'firefox', platform: 'Windows 10'},
            {browserName: 'safari', version: 7, platform: 'OS X 10.9'},
            {browserName: 'safari', version: 6, platform: 'OS X 10.8'},
            {browserName: 'internet explorer', version: 11, platform: 'Windows 10'},
            {browserName: 'internet explorer', version: 10, platform: 'Windows 8'},
            {browserName: 'internet explorer', version: 9, platform: 'Windows 7'},
            {browserName: 'internet explorer', version: 8, platform: 'Windows 7'}
          ],
          sauceConfig: {
            'video-upload-on-pass': false
          }
        }
      }
    },
    jasmine: {
      options: {
        outfile: 'index.html',
        display: 'short',
        specs: ['test/templates/all.js', 'test/helpers/template.helper.js', 'test/templates.spec.js'],
        vendor: ['node_modules/ayepromise/ayepromise.js', 'test/lib/highland.js', 'test/lib/jsreporter.js']
      },
      /*tests production (minified) code*/
      testProd: {
        src: 'tmp/dust-full.min.js'
      },
      /*tests unminified code, mostly used for debugging by `grunt dev` task*/
      testDev : {
        src: 'tmp/dust-full.js'
      },
      /*runs unit tests with jasmine and collects test coverage info via istanbul template
      * tests unminified version of dust to make sure test coverage starts are correctly calculated
      * istanbul jumbles source code in order to record coverage, so this task is not suited for
      * debugging while developing. Use jasmine:testClient instead, which runs on unminified code
      * and can be easily debugged*/
      coverage : {
        src: 'tmp/dust-full.js',
        options: {
          display: 'none',
          template: require('grunt-template-jasmine-istanbul'),
          templateOptions: {
            coverage: 'tmp/coverage/coverage.json',
            report: 'tmp/coverage',
            thresholds: {
              lines: 82,
              statements: 82,
              branches: 70,
              functions: 85
            }
          }
        }
      }
    },
    jasmine_nodejs: {
      options: {
        useHelpers: true,
        reporters: {
          console: {
            colors: false,
            verbosity: 0
          }
        }
      },
      core: {
        specs: ['test/core.spec.js']
      },
      cjs: {
        specs: ['test/commonJS.spec.js']
      },
      dustc: {
        helpers: ['test/cli/matchers.helper.js'],
        specs: ['test/cli/*']
      },
      templates: {
        specs: ['test/templates.spec.js']
      }
    },
    watch: {
      lib: {
        files: ['<%= jshint.libs.src %>'],
        tasks: ['clean:build', 'buildLib']
      },
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      lib_test: {
        files: ['<%= jshint.libs.src %>', '<%= jasmine.options.specs %>'],
        tasks: ['testPhantom']
      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json', 'lib/dust.js'],
        updateConfigs: ['pkg'],
        push: false,
        commitFiles: ['-a']
      }
    },
    log: {
      coverage: {
        options: {
          message: 'Open <%=jasmine.coverage.options.templateOptions.report%>/index.html in a browser to view the coverage.'
        }
      },
      copyForRelease: {
        options: {
          message: 'OK. Done copying version <%= pkg.version %> build from tmp to dist'
        }
      },
      release: {
        options: {
          message: ['OK. Done bumping, adding, committing, tagging and pushing the new version',
                    '',
                    'You still need to manually do the following:',
                    '  * git push upstream && git push upstream --tags',
                    '  * npm publish'].join('\n')
        }
      }
    },
    githubChanges: {
      dist: {
        options: {
          owner: "linkedin",
          repository: "dustjs",
          tagName: "v<%= pkg.version %>",
          onlyPulls: true,
          useCommitBody: true,
          auth: true
        }
      }
    }
  });

  //--------------------------------------------------
  //------------Custom tasks -------------------------
  //--------------------------------------------------
  grunt.registerMultiTask('log', 'Print some messages', function() {
    grunt.log.ok(this.data.options.message);
  });

  //--------------------------------------------------
  //------------External tasks -----------------------
  //--------------------------------------------------
  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jasmine');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-execute');
  grunt.loadNpmTasks('grunt-peg');
  grunt.loadNpmTasks('grunt-jasmine-nodejs');
  grunt.loadNpmTasks('grunt-github-changes');
  grunt.loadNpmTasks('grunt-saucelabs');

  //--------------------------------------------------
  //------------Grunt task aliases -------------------
  //--------------------------------------------------
  grunt.registerTask('buildLib',       ['jshint:libs', 'concat']);
  grunt.registerTask('build',          ['clean:build', 'peg', 'buildLib', 'uglify']);

  //test tasks
  grunt.registerTask('testNode',       ['jasmine_nodejs:templates', 'jasmine_nodejs:core', 'jasmine_nodejs:cjs']);
  grunt.registerTask('testRhino',      ['build', 'execute:testRhino']);
  grunt.registerTask('testPhantom',    ['build', 'jasmine:testProd']);
  grunt.registerTask('testCli',        ['jasmine_nodejs:dustc']);
  grunt.registerTask('test',           ['build', 'jasmine:testProd', 'testCli', 'testNode', 'execute:testRhino', 'jasmine:coverage']);

  //sauce labs integration (browser testing)
  grunt.registerTask('sauce',          process.env.SAUCE_ACCESS_KEY ? ['jasmine:testProd:build', 'connect:testServer', 'saucelabs-jasmine'] : []);

  //decide whether to run all tests or just the Node tests for Travis CI
  grunt.registerTask('travis',         (process.env.TEST === 'all') ? ['test', 'sauce'] : ['testNode', 'testCli']);

  //task for debugging in browser
  grunt.registerTask('dev',            ['build', 'jasmine:testDev:build', 'connect:testServer', 'watch:lib']);

  //task to run unit tests on client against prod version of code
  grunt.registerTask('testClient',     ['build', 'jasmine:testProd:build', 'connect:testServer', 'watch:lib_test']);

  //coverage report
  grunt.registerTask('coverage',       ['build', 'jasmine:coverage', 'log:coverage']);

  //release tasks
  grunt.registerTask('copyForRelease', ['clean:dist', 'copy', 'log:copyForRelease']);
  grunt.registerTask('buildRelease',   ['test', 'githubChanges', 'copyForRelease']);
  grunt.registerTask('releasePatch',   ['bump-only:patch', 'buildRelease', 'bump-commit', 'log:release']);
  grunt.registerTask('releaseMinor',   ['bump-only:minor', 'buildRelease', 'bump-commit', 'log:release']);
  // major release should probably be done with care
  //grunt.registerTask('releaseMajor',   ['bump-only:major', 'buildRelease', 'bump-commit:major', 'log:release']);

  //default task - full test
  grunt.registerTask('default',        ['test']);
};
<|endoftext|>


<commit_before>/*
 * @author: jldupont
 *
 */
'use strict';

module.exports = function (grunt) {

    grunt.loadNpmTasks('grunt-mocha-test');

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

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

    uglify: {
        my_target: {
          files: {
            'prolog.min.js': ['prolog.js']
          }
        }
      },
    	concat: {
    		options: {
    		      stripBanners: true,
    		      banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
    		        '<%= grunt.template.today("yyyy-mm-dd") %> */\n\n',
    		    },
    		dist: {
    			src: 'src/**/*.js',
    			dest: 'prolog.js'
    		}
    	},

    	mochaTest : {
        	test: {
        		options: {
        			//clearRequireCache: true,
        			reporter: 'min'
        			,bail: true
        			//,quiet: true

        		},
        		src: ['tests/**/*.js']

        	} //test

    	}//mochaTest

    ,watch: {
    	js: {
          options: {
            spawn: true,
            interrupt: true,
            debounceDelay: 100,
          },
          files: ['Gruntfile.js', 'src/**/*.js', 'tests/**/*.js'],
          tasks: ['concat', 'test']
    	}
      }

    });//initConfig

    /*
    grunt.event.on('watch', function(action, filepath, target) {
    	  grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
    	});
    */

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

    grunt.registerTask("test", ["mochaTest"]);
    grunt.registerTask('default', ['concat', 'uglify', 'test']);
};
<commit_msg>fix grunt test<commit_after>/*
 * @author: jldupont
 *
 */
'use strict';

module.exports = function (grunt) {

    grunt.loadNpmTasks('grunt-mocha-test');

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

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

    uglify: {
        my_target: {
          files: {
            'prolog.min.js': ['prolog.js']
          }
        }
      },
    	concat: {
    		options: {
    		      stripBanners: true,
    		      banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
    		        '<%= grunt.template.today("yyyy-mm-dd") %> */\n\n',
    		    },
    		dist: {
    			src: 'src/**/*.js',
    			dest: 'prolog.js'
    		}
    	},

    	mochaTest : {
        	test: {
        		options: {
        			//clearRequireCache: true,
        			reporter: 'min'
        			,bail: true
        			//,quiet: true

        		},
        		src: ['tests/**/*.js']

        	} //test

    	}//mochaTest

    ,watch: {
    	js: {
          options: {
            spawn: true,
            interrupt: true,
            debounceDelay: 100,
          },
          files: ['Gruntfile.js', 'src/**/*.js', 'tests/**/*.js'],
          tasks: ['concat', 'test']
    	}
      }

    });//initConfig

    /*
    grunt.event.on('watch', function(action, filepath, target) {
    	  grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
    	});
    */

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

    grunt.registerTask("test", ["concat", "mochaTest"]);
    grunt.registerTask('default', ['concat', 'uglify', 'test']);
};
<|endoftext|>


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

  // Project configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      files: ['Gruntfile.js', 'tasks/**/*.js', 'test/**/*.js'],
      options: {
        strict: true,
        immed: true,
        latedef: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        trailing: true,
        boss: true,
        eqnull: true,
        es5: true,
        scripturl: true,
        validthis: true,
        lastsemic: true,
        node: true
      }
    },
    nodeunit: {
      files: ['test/**/*.js']
    }
  });

  // Load "jshint" plugin
  grunt.loadNpmTasks('grunt-contrib-jshint');

  // Load "nodeunit" plugin
  grunt.loadNpmTasks('grunt-contrib-nodeunit');

  // Load local tasks
  grunt.loadTasks('tasks');

  // Default task
  grunt.registerTask('default', ['jshint', 'nodeunit']);

};
<commit_msg>Gruntfile.js: jshint- remove "es5: true," (es5 is now default)<commit_after>'use strict';
module.exports = function(grunt) {

  // Project configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      files: ['Gruntfile.js', 'tasks/**/*.js', 'test/**/*.js'],
      options: {
        strict: true,
        immed: true,
        latedef: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        trailing: true,
        boss: true,
        eqnull: true,
        scripturl: true,
        validthis: true,
        lastsemic: true,
        node: true
      }
    },
    nodeunit: {
      files: ['test/**/*.js']
    }
  });

  // Load "jshint" plugin
  grunt.loadNpmTasks('grunt-contrib-jshint');

  // Load "nodeunit" plugin
  grunt.loadNpmTasks('grunt-contrib-nodeunit');

  // Load local tasks
  grunt.loadTasks('tasks');

  // Default task
  grunt.registerTask('default', ['jshint', 'nodeunit']);

};
<|endoftext|>


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

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

    concat: {
      options: {
        stripBanners: true,
        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */',
      },
      dist: {
        src: [
          'app/js/app.js',
          'app/js/course_ctrl.js',
          'app/js/people_ctrl.js',
          'app/js/directives.js',
          'app/js/service.js'
        ],
        dest: 'build/cedek.js',
      }
    },

    jshint: {
      src: ['app/js/*.js'],
      concat: ['build/cedek.js'],
      options: {
        "node": true,
        "esnext": true,
        "bitwise": false,
        "curly": false,
        "eqeqeq": true,
        "eqnull": true,
        "immed": true,
        "latedef": true,
        "newcap": true,
        "noarg": true,
        "undef": true,
        "strict": true,
        "trailing": true,
        "smarttabs": true,
        globals: {
          'angular': true,
          '$': true,
          'document': true,
          'gnMenu': true
        }
      }
    },

    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        files: {
          'target/js/cedek.min.js': ['build/cedek.js']
        }
      }
    },

    cssmin: {
      minify: {
        files: {
          'target/css/cedek.min.css': ['app/css/app.css']
        }
      }
    },

    html2js: {
      options: {
        base: 'app/pages/',
        module: 'templates',
        singleModule: true,
        htmlmin: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: true,
          removeComments: true,
          removeEmptyAttributes: true,
          removeRedundantAttributes: true,
          removeScriptTypeAttributes: true,
          removeStyleLinkTypeAttributes: true
        }
      },
      main: {
        src: ['app/pages/**/*.html'],
        dest: 'target/js/templates.js'
      },
    },

    copy: {
      statics: {
        files: [
          {
            expand: true, cwd: 'app/',
            src: [
              'img/**',
            ],
            dest: 'target/'
          },
          {
            expand: true, cwd: 'bower_components/bootstrap/',
            src: [
              'fonts/*'
            ],
            dest: 'target/',
          },
          {
            expand: true, cwd: 'bower_components/',
            src: [
              'jquery/dist/jquery.min.js',
              'jquery/dist/jquery.min.map',
              'angular/angular.min.js',
              'angular/angular.min.js.map',
              'angular-route/angular-route.min.js',
              'angular-route/angular-route.min.js.map',
              'angular-resource/angular-resource.min.js',
              'angular-resource/angular-resource.min.js.map',
              'bootstrap/dist/js/bootstrap.min.js',
              'bootstrap/dist/css/bootstrap.min.css',
            ],
            dest: 'target/lib',
            flatten: true
          }
        ],
      },
      dynamics: {
        files: [
          {
            expand: true, cwd: 'app/',
            src: ['*.html'],
            dest: 'target/',
          }
        ],

        options: {
          process: function(content, srcpath){
            if(srcpath.match("index.html$")){
              grunt.log.writeln("Modificando los imports de js en " + srcpath);
              var retVal = content;
              // eliminamos los imports de nuestros js
              retVal = retVal.replace(/<script type="text\/javascript" src="js\/([\w\/]+?).js"><\/script>/g, "");
              // eliminamos los imports de nuestros css
              retVal = retVal.replace(/<link rel="stylesheet" type="text\/css" href="css\/([\w]+?).css"\/>/g, "");
              // sustituimos los comentarios por imports
              retVal = retVal.replace(/<!-- cedek.min.js -->/g, "<script type=\"text/javascript\" src=\"js/cedek.min.js\"></script>");
              retVal = retVal.replace(/<!-- templates.js -->/g, "<script type=\"text/javascript\" src=\"js/templates.js\"></script>");
              retVal = retVal.replace(/<!-- cedek.min.css -->/g, "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/cedek.min.css\"/>");

              // cambiamos a las versiones minimizadas de las librerias de tercero
              retVal = retVal.replace(/..\/bower_components\/bootstrap\/dist\/css\/bootstrap.min.css/g, "lib\/bootstrap.min.css");

              retVal = retVal.replace(/lib\/(([\w-_ ]+)\/)+/g, "lib\/"); // movemos el path de las librerias de tercero desde app a lib

              retVal = retVal.replace(/..\/bower_components\/angular\/angular.min.js/g, "lib\/angular.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-route\/angular-route.min.js/g, "lib\/angular-route.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-resource\/angular-resource.min.js/g, "lib\/angular-resource.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-sanitize\/angular-sanitize.min.js/g, "lib\/angular-sanitize.min.js");
              retVal = retVal.replace(/..\/bower_components\/jquery\/dist\/jquery.min.js/g, "lib\/jquery.min.js");
              retVal = retVal.replace(/..\/bower_components\/bootstrap\/dist\/js\/bootstrap.min.js/g, "lib\/bootstrap.min.js");

              return retVal;
            } else {
              return content;
            }
          }
        }
      },

      substitutePaths: {
        src: 'build/cedek.js',
        dest: 'build/cedek.js',
        options: {
          process: function(content, srcpath){
            return content.replace(/\/\/,'templates'/, ",'templates'").replace(/pages\//g, "");
          }
        }
      }
    },

    clean: {
      all: {
        src: ["build", "target"]
      }
    }

  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-html2js');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');

  // Tasks
  grunt.registerTask('resources', ['copy:statics', 'copy:dynamics', 'concat', 'copy:substitutePaths', 'cssmin', 'uglify']);
  grunt.registerTask('default', ['clean:all', 'jshint:src', 'resources', 'jshint:concat', 'html2js:main']);

};
<commit_msg>Update grunt taskts to send static resources<commit_after>module.exports = function(grunt) {

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

    concat: {
      options: {
        stripBanners: true,
        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */',
      },
      dist: {
        src: [
          'app/js/app.js',
          'app/js/course_ctrl.js',
          'app/js/people_ctrl.js',
          'app/js/directives.js',
          'app/js/service.js'
        ],
        dest: 'build/cedek.js',
      }
    },

    jshint: {
      src: ['app/js/*.js'],
      concat: ['build/cedek.js'],
      options: {
        "node": true,
        "esnext": true,
        "bitwise": false,
        "curly": false,
        "eqeqeq": true,
        "eqnull": true,
        "immed": true,
        "latedef": true,
        "newcap": true,
        "noarg": true,
        "undef": true,
        "strict": true,
        "trailing": true,
        "smarttabs": true,
        globals: {
          'angular': true,
          '$': true,
          'document': true,
          'gnMenu': true
        }
      }
    },

    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        files: {
          'public/js/cedek.min.js': ['build/cedek.js']
        }
      }
    },

    cssmin: {
      minify: {
        files: {
          'public/css/cedek.min.css': ['app/css/app.css']
        }
      }
    },

    html2js: {
      options: {
        base: 'app/pages/',
        module: 'templates',
        singleModule: true,
        htmlmin: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: true,
          removeComments: true,
          removeEmptyAttributes: true,
          removeRedundantAttributes: true,
          removeScriptTypeAttributes: true,
          removeStyleLinkTypeAttributes: true
        }
      },
      main: {
        src: ['app/pages/**/*.html'],
        dest: 'public/js/templates.js'
      },
    },

    copy: {
      statics: {
        files: [
          {
            expand: true, cwd: 'app/',
            src: [
              'img/**',
            ],
            dest: 'public/'
          },
          {
            expand: true, cwd: 'bower_components/bootstrap/',
            src: [
              'fonts/*'
            ],
            dest: 'public/',
          },
          {
            expand: true, cwd: 'bower_components/',
            src: [
              'jquery/dist/jquery.min.js',
              'jquery/dist/jquery.min.map',
              'angular/angular.min.js',
              'angular/angular.min.js.map',
              'angular-route/angular-route.min.js',
              'angular-route/angular-route.min.js.map',
              'angular-resource/angular-resource.min.js',
              'angular-resource/angular-resource.min.js.map',
              'bootstrap/dist/js/bootstrap.min.js',
              'bootstrap/dist/css/bootstrap.min.css',
            ],
            dest: 'public/lib',
            flatten: true
          }
        ],
      },
      dynamics: {
        files: [
          {
            expand: true, cwd: 'app/',
            src: ['*.html'],
            dest: 'public/',
          }
        ],

        options: {
          process: function(content, srcpath){
            if(srcpath.match("index.html$")){
              grunt.log.writeln("Modificando los imports de js en " + srcpath);
              var retVal = content;
              // eliminamos los imports de nuestros js
              retVal = retVal.replace(/<script type="text\/javascript" src="js\/([\w\/]+?).js"><\/script>/g, "");
              // eliminamos los imports de nuestros css
              retVal = retVal.replace(/<link rel="stylesheet" type="text\/css" href="css\/([\w]+?).css"\/>/g, "");
              // sustituimos los comentarios por imports
              retVal = retVal.replace(/<!-- cedek.min.js -->/g, "<script type=\"text/javascript\" src=\"js/cedek.min.js\"></script>");
              retVal = retVal.replace(/<!-- templates.js -->/g, "<script type=\"text/javascript\" src=\"js/templates.js\"></script>");
              retVal = retVal.replace(/<!-- cedek.min.css -->/g, "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/cedek.min.css\"/>");

              // cambiamos a las versiones minimizadas de las librerias de tercero
              retVal = retVal.replace(/..\/bower_components\/bootstrap\/dist\/css\/bootstrap.min.css/g, "lib\/bootstrap.min.css");

              retVal = retVal.replace(/lib\/(([\w-_ ]+)\/)+/g, "lib\/"); // movemos el path de las librerias de tercero desde app a lib

              retVal = retVal.replace(/..\/bower_components\/angular\/angular.min.js/g, "lib\/angular.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-route\/angular-route.min.js/g, "lib\/angular-route.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-resource\/angular-resource.min.js/g, "lib\/angular-resource.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-sanitize\/angular-sanitize.min.js/g, "lib\/angular-sanitize.min.js");
              retVal = retVal.replace(/..\/bower_components\/jquery\/dist\/jquery.min.js/g, "lib\/jquery.min.js");
              retVal = retVal.replace(/..\/bower_components\/bootstrap\/dist\/js\/bootstrap.min.js/g, "lib\/bootstrap.min.js");

              return retVal;
            } else {
              return content;
            }
          }
        }
      },

      substitutePaths: {
        src: 'build/cedek.js',
        dest: 'build/cedek.js',
        options: {
          process: function(content, srcpath){
            return content.replace(/\/\/,'templates'/, ",'templates'").replace(/pages\//g, "");
          }
        }
      }
    },

    clean: {
      all: {
        src: ["build", "public"]
      }
    }

  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-html2js');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');

  // Tasks
  grunt.registerTask('resources', ['copy:statics', 'copy:dynamics', 'concat', 'copy:substitutePaths', 'cssmin', 'uglify']);
  grunt.registerTask('default', ['clean:all', 'jshint:src', 'resources', 'jshint:concat', 'html2js:main']);

};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
    grunt.initConfig({
        jshint: {
            files: ['app.js', 'components/**/*.js'],
            options: {
                jshintrc: true
            }
        },
        sass: {
            options: {
                sourceMap: true
            },
            dist: {
                files: {
                    'public/app.css': 'sass/app.scss'
                }
            }
        },
        ngtemplates: {
            hdpuzzles: {
                //htmlmin
                cwd: 'components',
                src: '**/*.html',
                dest: 'temp/templates.js'
            }
        },
        concat: {
            options: {
                sourceMap: true
            },
            dist: {
                src: [
                    'bower_components/angular/angular.js',
                    'bower_components/angular-resource/angular-resource.js',
                    'app.js',
                    'temp/templates.js',
                    'components/**/*.js'
                ],
                dest: 'public/app.js'
            }
        },
        watch: {
            sass: {
                files: ['sass/**/*.scss'],
                tasks: ['build-css']
            },
            js: {
                files: ['app.js', 'components/**/*.js', 'components/**/*.html'],
                tasks: ['build-javascript']
            }
        },
        clean: {
            temp: ['temp'],
            css: ['public/*.css', 'public/*.css.map'],
            js: ['public/*.js', 'public/*.js.map']
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-sass');
    grunt.loadNpmTasks('grunt-angular-templates');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-clean');

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

    grunt.registerTask('build', ['build-css', 'build-javascript']);
    grunt.registerTask('build-css', ['clean:css', 'sass']);
    grunt.registerTask('build-javascript', ['jshint', 'clean:js', 'ngtemplates', 'concat', 'clean:temp'])
};<commit_msg>html minification inside the angular templates<commit_after>module.exports = function(grunt) {
    grunt.initConfig({
        jshint: {
            files: ['app.js', 'components/**/*.js'],
            options: {
                jshintrc: true
            }
        },
        sass: {
            options: {
                sourceMap: true
            },
            dist: {
                files: {
                    'public/app.css': 'sass/app.scss'
                }
            }
        },
        ngtemplates: {
            hdpuzzles: {
                options: {
                    htmlmin: {
                        collapseBooleanAttributes: true,
                        collapseWhitespace: true,
                        removeAttributeQuotes: true,
                        removeComments: true,
                        removeEmptyAttributes: true,
                        removeRedundantAttributes: true,
                        removeScriptTypeAttributes: true,
                        removeStyleLinkTypeAttributes: true
                    }
                },
                cwd: 'components',
                src: '**/*.html',
                dest: 'temp/templates.js'
            }
        },
        concat: {
            options: {
                sourceMap: true
            },
            dist: {
                src: [
                    'bower_components/angular/angular.js',
                    'bower_components/angular-resource/angular-resource.js',
                    'app.js',
                    'temp/templates.js',
                    'components/**/*.js'
                ],
                dest: 'public/app.js'
            }
        },
        watch: {
            sass: {
                files: ['sass/**/*.scss'],
                tasks: ['build-css']
            },
            js: {
                files: ['app.js', 'components/**/*.js', 'components/**/*.html'],
                tasks: ['build-javascript']
            }
        },
        clean: {
            temp: ['temp'],
            css: ['public/*.css', 'public/*.css.map'],
            js: ['public/*.js', 'public/*.js.map']
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-sass');
    grunt.loadNpmTasks('grunt-angular-templates');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-clean');

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

    grunt.registerTask('build', ['build-css', 'build-javascript']);
    grunt.registerTask('build-css', ['clean:css', 'sass']);
    grunt.registerTask('build-javascript', ['jshint', 'clean:js', 'ngtemplates', 'concat', 'clean:temp'])
};<|endoftext|>


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

	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-mocha-test');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-blanket');
	grunt.loadNpmTasks('grunt-coveralls');

	grunt.initConfig({
		clean: {
			coverage: {
				src: ['coverage/']
			},
			reports: {
				src: ['reports/']
			}
		},

		copy: {
			coverage: {
				src: ['test/**', 'data/**'],
				dest: 'coverage/'
			}
		},

		blanket: {
			coverage: {
				src: ['src/'],
        		dest: 'coverage/src/'
			}
		},

		mochaTest: {
			'spec': {
				options: {
					reporter: 'spec'
				},
				src: ["coverage/test/**/*Test.js"]
			},
			'html-cov': {
				options: {
					reporter: 'html-cov',
					quiet: true,
					captureFile: 'reports/coverage.html'
				},
				src: ["coverage/test/**/*Test.js"]
			},
			'mocha-lcov-reporter': {
				options: {
					reporter: 'mocha-lcov-reporter',
					quiet: true,
					captureFile: 'reports/lcov.info'
				},
				src: ["coverage/test/**/*Test.js"]
			},
		},

		coveralls: {
			options: {
				//force: true
			},
				all: {
				src: 'reports/lcov.info'
			}
		},

		jshint: {
			src: [
				// Files to hint
				"src/**/*.js",
				"test/**/*.js"
			],
			options: {
				jshintrc: '.jshintrc'
			}
		},

	});

	grunt.registerTask('default', ['jshint', 'clean', 'blanket', 'copy', 'mochaTest']);
	grunt.registerTask('travis', ['default', 'coveralls']);
};
<commit_msg>Don't fail if coveralls fails.<commit_after>module.exports = function(grunt) {
	"use strict";

	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-mocha-test');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-blanket');
	grunt.loadNpmTasks('grunt-coveralls');

	grunt.initConfig({
		clean: {
			coverage: {
				src: ['coverage/']
			},
			reports: {
				src: ['reports/']
			}
		},

		copy: {
			coverage: {
				src: ['test/**', 'data/**'],
				dest: 'coverage/'
			}
		},

		blanket: {
			coverage: {
				src: ['src/'],
        		dest: 'coverage/src/'
			}
		},

		mochaTest: {
			'spec': {
				options: {
					reporter: 'spec'
				},
				src: ["coverage/test/**/*Test.js"]
			},
			'html-cov': {
				options: {
					reporter: 'html-cov',
					quiet: true,
					captureFile: 'reports/coverage.html'
				},
				src: ["coverage/test/**/*Test.js"]
			},
			'mocha-lcov-reporter': {
				options: {
					reporter: 'mocha-lcov-reporter',
					quiet: true,
					captureFile: 'reports/lcov.info'
				},
				src: ["coverage/test/**/*Test.js"]
			},
		},

		coveralls: {
			options: {
				// Don't fail a build if coveralls fails
				force: true
			},
				all: {
				src: 'reports/lcov.info'
			}
		},

		jshint: {
			src: [
				// Files to hint
				"src/**/*.js",
				"test/**/*.js"
			],
			options: {
				jshintrc: '.jshintrc'
			}
		},

	});

	grunt.registerTask('default', ['jshint', 'clean', 'blanket', 'copy', 'mochaTest']);
	grunt.registerTask('travis', ['default', 'coveralls']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
	grunt.initConfig({
		shell: {
			jekyllBuild: {
				command: 'jekyll build'
			}
		},
		connect: {
			server: {
				options: {
					port: 8080,
					base: '_site'
				}
			}
		},
		sass: {
			dist: {
				options: {
					style: 'expanded'
				},
				files: {
					'sassy.css': '_sass/sassy.scss'
				}
			}
		},
		watch: {
			scripts: {
				files: [
					'_config.yml',
					'index.html',
					'_layouts/**',
					'_posts/**',
					'_includes/**'
				],
				tasks: ['shell:jekyllBuild'],
				options: {
					livereload: true
				},
			},
			css: {
				files: [
					'_sass/**'
				],
				tasks: ['sass', 'shell:jekyllBuild'],
				options: {
					livereload: true
				},
			},
		},

		browserSync: {
			default_options: {
				bsFiles: {
					src: [
						'./_site/*.html',
						'./_site/*.css'
					]
				},
				options: {
					watchTask: true,
					server: './_site',
					watchOptions: {
						ignoreInitial: true,
						ignored: ['*.txt', 'node_modules', '.git'],
					},
					browser: "google chrome",
					notify: false
				}
			}
		}
	})

	grunt.loadNpmTasks('grunt-contrib-sass')
	grunt.loadNpmTasks('grunt-contrib-connect')
	grunt.loadNpmTasks('grunt-contrib-watch')
	grunt.loadNpmTasks('grunt-shell')
	grunt.loadNpmTasks('grunt-browser-sync');

	grunt.registerTask('tasting', ['browserSync', 'watch'])
	grunt.registerTask('default', ['shell', 'connect', 'watch'])
}
<commit_msg>Compressed CSS output<commit_after>module.exports = function(grunt) {
	grunt.initConfig({
		shell: {
			jekyllBuild: {
				command: 'jekyll build'
			}
		},
		connect: {
			server: {
				options: {
					port: 8080,
					base: '_site'
				}
			}
		},
		sass: {
			dist: {
				options: {
					style: 'compressed'
				},
				files: {
					'sassy.css': '_sass/sassy.scss'
				}
			}
		},
		watch: {
			scripts: {
				files: [
					'_config.yml',
					'index.html',
					'_layouts/**',
					'_posts/**',
					'_includes/**'
				],
				tasks: ['shell:jekyllBuild'],
				options: {
					livereload: true
				},
			},
			css: {
				files: [
					'_sass/**'
				],
				tasks: ['sass', 'shell:jekyllBuild'],
				options: {
					livereload: true
				},
			},
		},

		browserSync: {
			default_options: {
				bsFiles: {
					src: [
						'./_site/*.html',
						'./_site/*.css'
					]
				},
				options: {
					watchTask: true,
					server: './_site',
					watchOptions: {
						ignoreInitial: true,
						ignored: ['*.txt', 'node_modules', '.git'],
					},
					browser: 'google chrome',
					notify: false
				}
			}
		}
	})

	grunt.loadNpmTasks('grunt-contrib-sass')
	grunt.loadNpmTasks('grunt-contrib-connect')
	grunt.loadNpmTasks('grunt-contrib-watch')
	grunt.loadNpmTasks('grunt-shell')
	grunt.loadNpmTasks('grunt-browser-sync');

	grunt.registerTask('tasting', ['browserSync', 'watch'])
	grunt.registerTask('default', ['shell', 'connect', 'watch'])
}
<|endoftext|>


<commit_before>/**
 @toc
 2. load grunt plugins
 3. init
 4. setup variables
 5. grunt.initConfig
 6. register grunt tasks

 */

'use strict';

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

  /**
   Load grunt plugins
   @toc 2.
   */
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-karma');

  /**
   Function that wraps everything to allow dynamically setting/changing grunt options and config later by grunt task. This init function is called once immediately (for using the default grunt options, config, and setup) and then may be called again AFTER updating grunt (command line) options.
   @toc 3.
   @method init
   */
  function init(params) {
    var files=require('./files').files;
    /**
     Project configuration.
     @toc 5.
     */
    grunt.initConfig({
      concat: {
        options: {},
        dist: {
          src: ['src/_intro.js.txt'].concat(files.src).concat(['src/_outtro.js.txt']),
          dest: 'build/ct-ui-router-extras.js'
        }
      },
      jshint: {
        options: {
          //force:          true,
          globalstrict: true,
          //sub:            true,
          node: true,
          loopfunc: true,
          browser: true,
          devel: true,
          globals: {
            angular: false,
            $: false,
            moment: false,
            Pikaday: false,
            module: false,
            forge: false
          }
        },
        beforeconcat: {
          options: {
            force: false,
            ignores: ['**.min.js'],
            strict: false
          },
          files: {
            src: []
          }
        },
        //quick version - will not fail entire grunt process if there are lint errors
        beforeconcatQ: {
          options: {
            force: true,
            strict: false,
            ignores: ['**.min.js']
          },
          files: {
            src: ['src/**/*.js']
          }
        }
      },
      uglify: {
        options: {
          mangle: false
        },
        build: {
          files: {},
          src: 'build/ct-ui-router-extras.js',
          dest: 'build/ct-ui-router-extras.min.js'
        }
      },
      karma: {
        options: {
          configFile: 'test/conf/karma.conf.js',
          singleRun: true,
          exclude: [],
          frameworks: ['jasmine'],
          reporters: 'dots', // 'dots' || 'progress'
          port: 8080,
          colors: true,
          autoWatch: false,
          autoWatchInterval: 0,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        unit: {
          configFile: 'test/conf/karma.dev.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        min: {
          configFile: 'test/conf/karma.min.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        uirouter0_2_5: {
          configFile: 'test/conf/karma.0_2_5.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        uirouter0_2_6: {
          configFile: 'test/conf/karma.0_2_6.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        uirouter0_2_7: {
          configFile: 'test/conf/karma.0_2_7.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        uirouter0_2_8: {
          configFile: 'test/conf/karma.0_2_8.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        uirouter0_2_10: {
          configFile: 'test/conf/karma.0_2_10.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        HEAD: {
          configFile: 'test/conf/karma.HEAD.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        watch: {
          configFile: 'test/conf/karma.conf.js',
          browsers: [ grunt.option('browser') || 'PhantomJS' ],
          singleRun: false,
          autoWatch: true,
          autoWatchInterval: 1
        },
        debug: {
          singleRun: false,
          background: false,
          browsers: [ grunt.option('browser') || 'Chrome' ]
        }
      }
    });

    /**
     register/define grunt tasks
     @toc 6.
     */
      // Default task(s).
    grunt.registerTask('default', ['jshint:beforeconcatQ', 'concat', 'uglify:build',
      'karma:uirouter0_2_5', 'karma:uirouter0_2_6', 'karma:uirouter0_2_7', 'karma:uirouter0_2_8', 'karma:uirouter0_2_10', 'karma:HEAD'
    ]);
    grunt.registerTask('test', ['jshint:beforeconcatQ', 'concat', 'karma:unit']);
    grunt.registerTask('test:watch', ['jshint:beforeconcatQ', 'karma:watch']);

  }

  init({});		//initialize here for defaults (init may be called again later within a task)

};
<commit_msg>Fixed karma:watch task<commit_after>/**
 @toc
 2. load grunt plugins
 3. init
 4. setup variables
 5. grunt.initConfig
 6. register grunt tasks

 */

'use strict';

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

  /**
   Load grunt plugins
   @toc 2.
   */
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-karma');

  /**
   Function that wraps everything to allow dynamically setting/changing grunt options and config later by grunt task. This init function is called once immediately (for using the default grunt options, config, and setup) and then may be called again AFTER updating grunt (command line) options.
   @toc 3.
   @method init
   */
  function init(params) {
    var files=require('./files').files;
    /**
     Project configuration.
     @toc 5.
     */
    grunt.initConfig({
      concat: {
        options: {},
        dist: {
          src: ['src/_intro.js.txt'].concat(files.src).concat(['src/_outtro.js.txt']),
          dest: 'build/ct-ui-router-extras.js'
        }
      },
      jshint: {
        options: {
          //force:          true,
          globalstrict: true,
          //sub:            true,
          node: true,
          loopfunc: true,
          browser: true,
          devel: true,
          globals: {
            angular: false,
            $: false,
            moment: false,
            Pikaday: false,
            module: false,
            forge: false
          }
        },
        beforeconcat: {
          options: {
            force: false,
            ignores: ['**.min.js'],
            strict: false
          },
          files: {
            src: []
          }
        },
        //quick version - will not fail entire grunt process if there are lint errors
        beforeconcatQ: {
          options: {
            force: true,
            strict: false,
            ignores: ['**.min.js']
          },
          files: {
            src: ['src/**/*.js']
          }
        }
      },
      uglify: {
        options: {
          mangle: false
        },
        build: {
          files: {},
          src: 'build/ct-ui-router-extras.js',
          dest: 'build/ct-ui-router-extras.min.js'
        }
      },
      karma: {
        options: {
          configFile: 'test/conf/karma.conf.js',
          singleRun: true,
          exclude: [],
          frameworks: ['jasmine'],
          reporters: 'dots', // 'dots' || 'progress'
          port: 8080,
          colors: true,
          autoWatch: false,
          autoWatchInterval: 0,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        unit: {
          configFile: 'test/conf/karma.dev.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        min: {
          configFile: 'test/conf/karma.min.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        uirouter0_2_5: {
          configFile: 'test/conf/karma.0_2_5.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        uirouter0_2_6: {
          configFile: 'test/conf/karma.0_2_6.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        uirouter0_2_7: {
          configFile: 'test/conf/karma.0_2_7.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        uirouter0_2_8: {
          configFile: 'test/conf/karma.0_2_8.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        uirouter0_2_10: {
          configFile: 'test/conf/karma.0_2_10.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        HEAD: {
          configFile: 'test/conf/karma.HEAD.conf.js',
          singleRun: true,
          browsers: [ grunt.option('browser') || 'PhantomJS' ]
        },
        watch: {
          configFile: 'test/conf/karma.dev.conf.js',
          browsers: [ grunt.option('browser') || 'PhantomJS' ],
          singleRun: false,
          autoWatch: true,
          autoWatchInterval: 1
        },
        debug: {
          singleRun: false,
          background: false,
          browsers: [ grunt.option('browser') || 'Chrome' ]
        }
      }
    });

    /**
     register/define grunt tasks
     @toc 6.
     */
      // Default task(s).
    grunt.registerTask('default', ['jshint:beforeconcatQ', 'concat', 'uglify:build',
      'karma:uirouter0_2_5', 'karma:uirouter0_2_6', 'karma:uirouter0_2_7', 'karma:uirouter0_2_8', 'karma:uirouter0_2_10', 'karma:HEAD'
    ]);
    grunt.registerTask('test', ['jshint:beforeconcatQ', 'concat', 'karma:unit']);
    grunt.registerTask('test:watch', ['jshint:beforeconcatQ', 'karma:watch']);

  }

  init({});		//initialize here for defaults (init may be called again later within a task)

};
<|endoftext|>