<commit_before>/**
 * Copyright 2015 Kitware Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
module.exports = function (grunt) {
    var path = require('path');

    // This gruntfile is only designed to be used with girder's build system.
    // Fail if grunt is executed here.
    if (path.resolve(__dirname) === path.resolve(process.cwd())) {
        grunt.fail.fatal('To build Minerva, run grunt from Girder\'s root directory');
    }

    grunt.config.requires('pluginDir');

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

    try {
        // Extreme hackery used to avoid exception on first time `grunt init`
        // before local npm dependencies are installed.  If this isn't done,
        // then `grunt init` needs to be run twice.
        _ = require('underscore');
    } catch (e) {
        grunt.log.writeln(
            'Mocking underscore dependency for first time install.'.yellow
        );
        grunt.log.writeln(
            'grunt watch'.yellow.underline + ' will not be initialized this run.'.yellow
        );
        _ = {
            pluck: function () {
                return [];
            }
        };
    }

    grunt.config.merge({
        plugin: {
            minerva: {
                root: '<%= pluginDir %>/minerva',
                external: '<%= plugin.minerva.root %>/web_external',
                static: '<%= staticDir %>/built/plugins/minerva',
                source: '<%= plugin.minerva.external %>/js',
                geojs: '<%= plugin.minerva.root %>/node_modules/geojs',
                extra: '<%= plugin.minerva.external %>/extra',
                fontello: '<%= plugin.minerva.external %>/fontello'
            }
        },
        jade: {
            minerva: {
                files: [{
                    src: ['<%= plugin.minerva.external %>/templates/**/*.jade'],
                    dest: '<%= plugin.minerva.static %>/minerva_templates.js'
                }],
                options: {
                    namespace: 'minerva.templates'
                }
            }
        },
        stylus: {
            minerva: {
                files: [{
                    src: [
                        '<%= plugin.minerva.external %>/stylesheets/**/*.styl',
                        '<%= plugin.minerva.root %>/node_modules/colorbrewer/colorbrewer.css'
                    ],
                    dest: '<%= plugin.minerva.static %>/plugin.min.css'
                }]
            }
        },
        uglify: {
            minerva: {
                files: [
                    {
                        src: [
                            '<%= plugin.minerva.source %>/init.js',
                            '<%= plugin.minerva.static %>/minerva_templates.js',
                            '<%= plugin.minerva.source %>/minerva-version.js',
                            '<%= plugin.minerva.source %>/view.js',
                            '<%= plugin.minerva.source %>/contourJsonReader.js',
                            '<%= plugin.minerva.source %>/app.js',
                            '<%= plugin.minerva.source %>/utilities.js',
                            '<%= plugin.minerva.source %>/MinervaModel.js',
                            '<%= plugin.minerva.source %>/MinervaCollection.js',
                            '<%= plugin.minerva.source %>/models/DatasetModel.js',
                            '<%= plugin.minerva.source %>/models/SourceModel.js',
                            '<%= plugin.minerva.source %>/models/**/*.js',
                            '<%= plugin.minerva.source %>/collections/**/*.js',
                            '<%= plugin.minerva.source %>/views/body/Panel.js',
                            '<%= plugin.minerva.source %>/views/**/*.js'
                        ],
                        dest: '<%= plugin.minerva.static %>/minerva.app.min.js'
                    },
                    {
                        src: ['<%= plugin.minerva.source %>/main.js'],
                        dest: '<%= plugin.minerva.static %>/minerva.main.min.js'
                    }
                ]
            },
            'minerva-ext': {
                files: [
                    {
                        src: [
                            '<%= plugin.minerva.geojs %>/bower_components/gl-matrix/dist/gl-matrix.js',
                            '<%= plugin.minerva.geojs %>/bower_components/proj4/dist/proj4-src.js',
                            '<%= plugin.minerva.geojs %>/node_modules/pnltri/pnltri.js'
                        ],
                        dest: '<%= plugin.minerva.static %>/minerva.geo.ext.min.js'
                    },
                    {
                        src: ['<%= plugin.minerva.root %>/node_modules/JSONPath/lib/jsonpath.js'],
                        dest: '<%= plugin.minerva.static %>/jsonpath.min.js'
                    },
                    {
                        src: ['<%= plugin.minerva.root %>/node_modules/colorbrewer/colorbrewer.js'],
                        dest: '<%= plugin.minerva.static %>/colorbrewer.min.js'
                    }
                ]
            }
        },
        copy: {
            'papaparse': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.extra %>',
                        src: ['papaparse.min.js'],
                        dest: '<%= plugin.minerva.static %>'
                    }
                ]
            },
            'geojs': {
                files: [

                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.geojs %>',
                        src: ['geo.min.js'],
                        dest: '<%= plugin.minerva.static %>'
                    }
                ]
            },
            'minerva-fontello': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.fontello %>',
                        src: ['font/*', 'css/*'],
                        dest: '<%= staticDir %>/lib/fontello/minerva'
                    }
                ]
            },
            'jquery-ui': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.geojs %>/bower_components/jquery-ui',
                        src: ['jquery-ui.min.js'],
                        dest: '<%= plugin.minerva.static %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.geojs %>/bower_components/jquery-ui/themes/smoothness',
                        src: ['jquery-ui.min.css'],
                        dest: '<%= plugin.minerva.static %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.geojs %>/bower_components/jquery-ui/themes/smoothness',
                        src: ['images/*'],
                        dest: '<%= plugin.minerva.static %>'
                    }
                ]
            },
            'dataTables': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.extra %>',
                        src: ['datatables.min.js'],
                        dest: '<%= plugin.minerva.static %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.extra %>',
                        src: ['datatables.min.css'],
                        dest: '<%= plugin.minerva.static %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.extra %>',
                        src: ['DataTables-1.10.11/images/*'],
                        dest: '<%= plugin.minerva.static %>'
                    }
                ]
            }
        },
        concat: {
            'minerva-ext': {
                files: {
                    '<%= plugin.minerva.static %>/minerva.ext.min.js':
                    [
                        '<%= plugin.minerva.static %>/minerva.geo.ext.min.js',
                        '<%= plugin.minerva.static %>/geo.min.js',
                        '<%= plugin.minerva.static %>/jsonpath.min.js',
                        '<%= plugin.minerva.static %>/papaparse.min.js',
                        '<%= plugin.minerva.static %>/colorbrewer.min.js',
                        '<%= plugin.minerva.static %>/jquery-ui.min.js',
                        '<%= plugin.minerva.static %>/datatables.min.js'
                    ]
                }
            }
        },
        init: {
            'copy:papaparse': {
                dependencies: []
            },
            'copy:geojs': {
                dependencies: ['shell:plugin-minerva']
            },
            'copy:minerva-fontello': {
                dependencies: []
            },
            'copy:jquery-ui': {
                dependencies: ['shell:plugin-minerva']
            },
            'copy:dataTables': {
                dependencies: []
            },
            'uglify:minerva-ext': {
                dependencies: ['shell:plugin-minerva']
            },
            'concat:minerva-ext': {
                dependencies: ['copy:papaparse', 'copy:jquery-ui', 'copy:dataTables', 'uglify:minerva-ext']
            }
        },
        default: {
            'uglify:minerva': {
                dependencies: ['jade:minerva']
            },
            'jade:minerva': {},
            'stylus:minerva': {},
            'test-env-html:minerva': {
                dependencies: ['uglify:minerva', 'stylus:minerva']
            }
        }
    });

    grunt.config.merge({
        watch: {
            'plugin-minerva-jade-external': {
                files: _.pluck(grunt.config.get('jade.minerva.files'), 'src'),
                tasks: ['jade:minerva']
            },
            'plugin-minerva-stylus-external': {
                files: _.pluck(grunt.config.get('stylus.minerva.files'), 'src'),
                tasks: ['stylus:minerva']
            },
            'plugin-minerva-uglify-external': {
                files: _.pluck(grunt.config.get('uglify.minerva.files'), 'src'),
                tasks: ['uglify:minerva']
            },
            'plugin-minerva-copy-geojs': {
                files: [
                    '<%= plugin.minerva.geojs %>/geo.min.js'
                ],
                tasks: ['copy:geojs']
            }
        }
    });

    // make the destination path if it doesn't exist
    var staticDir = grunt.config.get('plugin.minerva.static');
    if (!fs.existsSync(staticDir)) {
        fs.mkdirSync(staticDir);
    }
    grunt.registerTask('test-env-html:minerva', 'Build the phantom test html page for minerava', function () {
        var jade = require('jade');
        var pluginConfig = grunt.file.readYAML(
            grunt.config.get('plugin.minerva.root') + '/plugin.json'
        );
        var pluginDependencies = pluginConfig.dependencies;
        var staticDir = grunt.config.get('plugin.minerva.static');
        var rootStaticDir = grunt.config.get('staticDir') + '/built';
        var pluginsStaticDir = staticDir + '/..';
        var rootStaticLibDir = grunt.config.get('staticDir') + '/lib';
        var i, plugin, pluginJs, pluginCss;
        var buffer = fs.readFileSync('clients/web/test/testEnv.jadehtml');
        var dependencies = [
            '/clients/web/static/built/libs.min.js',
            '/test/minerva/minervaTestUtils.js',
            '/clients/web/test/testUtils.js',
            '/' + staticDir + '/minerva.geo.ext.min.js',
            // '/' + rootStaticDir + '/libs.min.js', // libs included in jade template
            '/' + staticDir + '/jquery-ui.min.js',
            '/' + staticDir + '/geo.min.js',
            '/' + rootStaticDir + '/app.min.js'
        ];
        // if any plugin dependencies have js, add them
        for (i = 0; i < pluginDependencies.length; i = i + 1) {
            plugin = pluginDependencies[i];
            pluginJs = pluginsStaticDir + '/' + plugin + '/plugin.min.js';
            if (fs.existsSync(pluginJs)) {
                dependencies.push('/' + pluginJs);
            }
        }
        dependencies.concat([
            '/' + staticDir + '/papaparse.min.js',
            '/' + staticDir + '/jsonpath.min.js'
        ]);

        var globs = grunt.config.get('uglify.minerva.files')[0].src;
        var jsFiles = [];
        globs.forEach(function (glob) {
            var files = grunt.file.expand(glob);
            files.forEach(function (file) {
                jsFiles.push('/' + file);
            });
        });

        var fn = jade.compile(buffer, {
            client: false,
            pretty: true
        });

        var cssFiles = [
            // ?? href="//fonts.googleapis.com/css?family=Droid+Sans:400,700">
            '/' + rootStaticLibDir + '/bootstrap/css/bootstrap.min.css',
            '/' + rootStaticLibDir + '/fontello/css/fontello.css',
            '/' + rootStaticLibDir + '/fontello/css/animation.css',
            '/' + staticDir + '/jquery-ui.min.css',
            '/' + rootStaticDir + '/app.min.css'
        ];
        // if any plugin dependencies have css, add them
        for (i = 0; i < pluginDependencies.length; i = i + 1) {
            plugin = pluginDependencies[i];
            pluginCss = pluginsStaticDir + '/' + plugin + '/plugin.min.css';
            if (fs.existsSync(pluginCss)) {
                cssFiles.push('/' + pluginCss);
            }
        }
        cssFiles.push('/' + staticDir + '/minerva.min.css');

        fs.writeFileSync(rootStaticDir + '/testEnvMinerva.html', fn({
            cssFiles: cssFiles,
            jsFilesUncovered: dependencies,
            jsFilesCovered: jsFiles,
            staticRoot: '/static',
            apiRoot: '/api/v1'
        }));
    });
};
<commit_msg>Explicitly state dependency for Gruntfile init tasks<commit_after>/**
 * Copyright 2015 Kitware Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
module.exports = function (grunt) {
    var path = require('path');

    // This gruntfile is only designed to be used with girder's build system.
    // Fail if grunt is executed here.
    if (path.resolve(__dirname) === path.resolve(process.cwd())) {
        grunt.fail.fatal('To build Minerva, run grunt from Girder\'s root directory');
    }

    grunt.config.requires('pluginDir');

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

    try {
        // Extreme hackery used to avoid exception on first time `grunt init`
        // before local npm dependencies are installed.  If this isn't done,
        // then `grunt init` needs to be run twice.
        _ = require('underscore');
    } catch (e) {
        grunt.log.writeln(
            'Mocking underscore dependency for first time install.'.yellow
        );
        grunt.log.writeln(
            'grunt watch'.yellow.underline + ' will not be initialized this run.'.yellow
        );
        _ = {
            pluck: function () {
                return [];
            }
        };
    }

    grunt.config.merge({
        plugin: {
            minerva: {
                root: '<%= pluginDir %>/minerva',
                external: '<%= plugin.minerva.root %>/web_external',
                static: '<%= staticDir %>/built/plugins/minerva',
                source: '<%= plugin.minerva.external %>/js',
                geojs: '<%= plugin.minerva.root %>/node_modules/geojs',
                extra: '<%= plugin.minerva.external %>/extra',
                fontello: '<%= plugin.minerva.external %>/fontello'
            }
        },
        jade: {
            minerva: {
                files: [{
                    src: ['<%= plugin.minerva.external %>/templates/**/*.jade'],
                    dest: '<%= plugin.minerva.static %>/minerva_templates.js'
                }],
                options: {
                    namespace: 'minerva.templates'
                }
            }
        },
        stylus: {
            minerva: {
                files: [{
                    src: [
                        '<%= plugin.minerva.external %>/stylesheets/**/*.styl',
                        '<%= plugin.minerva.root %>/node_modules/colorbrewer/colorbrewer.css'
                    ],
                    dest: '<%= plugin.minerva.static %>/plugin.min.css'
                }]
            }
        },
        uglify: {
            minerva: {
                files: [
                    {
                        src: [
                            '<%= plugin.minerva.source %>/init.js',
                            '<%= plugin.minerva.static %>/minerva_templates.js',
                            '<%= plugin.minerva.source %>/minerva-version.js',
                            '<%= plugin.minerva.source %>/view.js',
                            '<%= plugin.minerva.source %>/contourJsonReader.js',
                            '<%= plugin.minerva.source %>/app.js',
                            '<%= plugin.minerva.source %>/utilities.js',
                            '<%= plugin.minerva.source %>/MinervaModel.js',
                            '<%= plugin.minerva.source %>/MinervaCollection.js',
                            '<%= plugin.minerva.source %>/models/DatasetModel.js',
                            '<%= plugin.minerva.source %>/models/SourceModel.js',
                            '<%= plugin.minerva.source %>/models/**/*.js',
                            '<%= plugin.minerva.source %>/collections/**/*.js',
                            '<%= plugin.minerva.source %>/views/body/Panel.js',
                            '<%= plugin.minerva.source %>/views/**/*.js'
                        ],
                        dest: '<%= plugin.minerva.static %>/minerva.app.min.js'
                    },
                    {
                        src: ['<%= plugin.minerva.source %>/main.js'],
                        dest: '<%= plugin.minerva.static %>/minerva.main.min.js'
                    }
                ]
            },
            'minerva-ext': {
                files: [
                    {
                        src: [
                            '<%= plugin.minerva.geojs %>/bower_components/gl-matrix/dist/gl-matrix.js',
                            '<%= plugin.minerva.geojs %>/bower_components/proj4/dist/proj4-src.js',
                            '<%= plugin.minerva.geojs %>/node_modules/pnltri/pnltri.js'
                        ],
                        dest: '<%= plugin.minerva.static %>/minerva.geo.ext.min.js'
                    },
                    {
                        src: ['<%= plugin.minerva.root %>/node_modules/JSONPath/lib/jsonpath.js'],
                        dest: '<%= plugin.minerva.static %>/jsonpath.min.js'
                    },
                    {
                        src: ['<%= plugin.minerva.root %>/node_modules/colorbrewer/colorbrewer.js'],
                        dest: '<%= plugin.minerva.static %>/colorbrewer.min.js'
                    }
                ]
            }
        },
        copy: {
            'papaparse': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.extra %>',
                        src: ['papaparse.min.js'],
                        dest: '<%= plugin.minerva.static %>'
                    }
                ]
            },
            'geojs': {
                files: [

                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.geojs %>',
                        src: ['geo.min.js'],
                        dest: '<%= plugin.minerva.static %>'
                    }
                ]
            },
            'minerva-fontello': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.fontello %>',
                        src: ['font/*', 'css/*'],
                        dest: '<%= staticDir %>/lib/fontello/minerva'
                    }
                ]
            },
            'jquery-ui': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.geojs %>/bower_components/jquery-ui',
                        src: ['jquery-ui.min.js'],
                        dest: '<%= plugin.minerva.static %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.geojs %>/bower_components/jquery-ui/themes/smoothness',
                        src: ['jquery-ui.min.css'],
                        dest: '<%= plugin.minerva.static %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.geojs %>/bower_components/jquery-ui/themes/smoothness',
                        src: ['images/*'],
                        dest: '<%= plugin.minerva.static %>'
                    }
                ]
            },
            'dataTables': {
                files: [
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.extra %>',
                        src: ['datatables.min.js'],
                        dest: '<%= plugin.minerva.static %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.extra %>',
                        src: ['datatables.min.css'],
                        dest: '<%= plugin.minerva.static %>'
                    },
                    {
                        expand: true,
                        cwd: '<%= plugin.minerva.extra %>',
                        src: ['DataTables-1.10.11/images/*'],
                        dest: '<%= plugin.minerva.static %>'
                    }
                ]
            }
        },
        concat: {
            'minerva-ext': {
                files: {
                    '<%= plugin.minerva.static %>/minerva.ext.min.js':
                    [
                        '<%= plugin.minerva.static %>/minerva.geo.ext.min.js',
                        '<%= plugin.minerva.static %>/geo.min.js',
                        '<%= plugin.minerva.static %>/jsonpath.min.js',
                        '<%= plugin.minerva.static %>/papaparse.min.js',
                        '<%= plugin.minerva.static %>/colorbrewer.min.js',
                        '<%= plugin.minerva.static %>/jquery-ui.min.js',
                        '<%= plugin.minerva.static %>/datatables.min.js'
                    ]
                }
            }
        },
        init: {
            'copy:papaparse': {
                dependencies: ['shell:plugin-minerva']
            },
            'copy:geojs': {
                dependencies: ['shell:plugin-minerva']
            },
            'copy:minerva-fontello': {
                dependencies: ['shell:plugin-minerva']
            },
            'copy:jquery-ui': {
                dependencies: ['shell:plugin-minerva']
            },
            'copy:dataTables': {
                dependencies: ['shell:plugin-minerva']
            },
            'uglify:minerva-ext': {
                dependencies: ['shell:plugin-minerva']
            },
            'concat:minerva-ext': {
                dependencies: ['copy:papaparse', 'copy:jquery-ui', 'copy:dataTables', 'uglify:minerva-ext']
            }
        },
        default: {
            'uglify:minerva': {
                dependencies: ['jade:minerva']
            },
            'jade:minerva': {},
            'stylus:minerva': {},
            'test-env-html:minerva': {
                dependencies: ['uglify:minerva', 'stylus:minerva']
            }
        }
    });

    grunt.config.merge({
        watch: {
            'plugin-minerva-jade-external': {
                files: _.pluck(grunt.config.get('jade.minerva.files'), 'src'),
                tasks: ['jade:minerva']
            },
            'plugin-minerva-stylus-external': {
                files: _.pluck(grunt.config.get('stylus.minerva.files'), 'src'),
                tasks: ['stylus:minerva']
            },
            'plugin-minerva-uglify-external': {
                files: _.pluck(grunt.config.get('uglify.minerva.files'), 'src'),
                tasks: ['uglify:minerva']
            },
            'plugin-minerva-copy-geojs': {
                files: [
                    '<%= plugin.minerva.geojs %>/geo.min.js'
                ],
                tasks: ['copy:geojs']
            }
        }
    });

    // make the destination path if it doesn't exist
    var staticDir = grunt.config.get('plugin.minerva.static');
    if (!fs.existsSync(staticDir)) {
        fs.mkdirSync(staticDir);
    }
    grunt.registerTask('test-env-html:minerva', 'Build the phantom test html page for minerava', function () {
        var jade = require('jade');
        var pluginConfig = grunt.file.readYAML(
            grunt.config.get('plugin.minerva.root') + '/plugin.json'
        );
        var pluginDependencies = pluginConfig.dependencies;
        var staticDir = grunt.config.get('plugin.minerva.static');
        var rootStaticDir = grunt.config.get('staticDir') + '/built';
        var pluginsStaticDir = staticDir + '/..';
        var rootStaticLibDir = grunt.config.get('staticDir') + '/lib';
        var i, plugin, pluginJs, pluginCss;
        var buffer = fs.readFileSync('clients/web/test/testEnv.jadehtml');
        var dependencies = [
            '/clients/web/static/built/libs.min.js',
            '/test/minerva/minervaTestUtils.js',
            '/clients/web/test/testUtils.js',
            '/' + staticDir + '/minerva.geo.ext.min.js',
            // '/' + rootStaticDir + '/libs.min.js', // libs included in jade template
            '/' + staticDir + '/jquery-ui.min.js',
            '/' + staticDir + '/geo.min.js',
            '/' + rootStaticDir + '/app.min.js'
        ];
        // if any plugin dependencies have js, add them
        for (i = 0; i < pluginDependencies.length; i = i + 1) {
            plugin = pluginDependencies[i];
            pluginJs = pluginsStaticDir + '/' + plugin + '/plugin.min.js';
            if (fs.existsSync(pluginJs)) {
                dependencies.push('/' + pluginJs);
            }
        }
        dependencies.concat([
            '/' + staticDir + '/papaparse.min.js',
            '/' + staticDir + '/jsonpath.min.js'
        ]);

        var globs = grunt.config.get('uglify.minerva.files')[0].src;
        var jsFiles = [];
        globs.forEach(function (glob) {
            var files = grunt.file.expand(glob);
            files.forEach(function (file) {
                jsFiles.push('/' + file);
            });
        });

        var fn = jade.compile(buffer, {
            client: false,
            pretty: true
        });

        var cssFiles = [
            // ?? href="//fonts.googleapis.com/css?family=Droid+Sans:400,700">
            '/' + rootStaticLibDir + '/bootstrap/css/bootstrap.min.css',
            '/' + rootStaticLibDir + '/fontello/css/fontello.css',
            '/' + rootStaticLibDir + '/fontello/css/animation.css',
            '/' + staticDir + '/jquery-ui.min.css',
            '/' + rootStaticDir + '/app.min.css'
        ];
        // if any plugin dependencies have css, add them
        for (i = 0; i < pluginDependencies.length; i = i + 1) {
            plugin = pluginDependencies[i];
            pluginCss = pluginsStaticDir + '/' + plugin + '/plugin.min.css';
            if (fs.existsSync(pluginCss)) {
                cssFiles.push('/' + pluginCss);
            }
        }
        cssFiles.push('/' + staticDir + '/minerva.min.css');

        fs.writeFileSync(rootStaticDir + '/testEnvMinerva.html', fn({
            cssFiles: cssFiles,
            jsFilesUncovered: dependencies,
            jsFilesCovered: jsFiles,
            staticRoot: '/static',
            apiRoot: '/api/v1'
        }));
    });
};
<|endoftext|>


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

  // Project configuration.
  grunt.initConfig({

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

    // -----------------------------
    // Browserify
    // -----------------------------

    browserify: {
      core: {
        options: {
          transform:[["babelify", { "presets": ["es2015"] }]],
        },
        src: 'src/index.js',
        dest: 'build/numbers.js',
      },
    },

    // -----------------------------
    // Uglify
    // -----------------------------

    uglify: {
      core: {
        files: {
          './build/numbers.min.js': ['./build/numbers.js'],
        }
      }
    },

    // -----------------------------
    // Watch
    // -----------------------------

    watch: {
      scripts: {
        files: ['index.js', 'Gruntfile.js', './src/**/*.js'],
        tasks: ['build'],
        options: {
          spawn: true,
        },
      },
    },

    // -----------------------------
    // JSHint
    // -----------------------------

    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: ['./index.js', './src/**/*.js'],
      },
    },

    // -----------------------------
    // Mocha
    // -----------------------------

    mochaTest: {
      test: {
        options: {
          reporter: 'spec',
          require: ['babel-core/register']
        },
        src: ['./tests/**/*.js']
      }
    },

  });

  // Load the Plugins
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-mocha-test');

  // Task(s)
  grunt.registerTask('build', ['jshint', 'mochaTest', 'browserify', 'uglify']);
  grunt.registerTask('serve', ['build', 'watch']);

};
<commit_msg>updated Gruntfile.js<commit_after>module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({

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

    // -----------------------------
    // Browserify
    // -----------------------------

    browserify: {
      core: {
        options:{
          transform:[["babelify", { "presets": ["es2015"] }]],
          browserifyOptions: {
            standalone: 'numbers'
          }
        },
        src: 'src/index.js',
        dest: 'build/numbers.js',
      },
    },

    // -----------------------------
    // Uglify
    // -----------------------------

    uglify: {
      core: {
        files: {
          './build/numbers.min.js': ['./build/numbers.js'],
        }
      }
    },

    // -----------------------------
    // Watch
    // -----------------------------

    watch: {
      scripts: {
        files: ['index.js', 'Gruntfile.js', './src/**/*.js'],
        tasks: ['build'],
        options: {
          spawn: true,
        },
      },
    },

    // -----------------------------
    // JSHint
    // -----------------------------

    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: ['./index.js', './src/**/*.js'],
      },
    },

    // -----------------------------
    // Mocha
    // -----------------------------

    mochaTest: {
      test: {
        options: {
          reporter: 'spec',
          require: ['babel-core/register']
        },
        src: ['./tests/**/*.js']
      }
    },

  });

  // Load the Plugins
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-mocha-test');

  // Task(s)
  grunt.registerTask('build', ['jshint', 'mochaTest', 'browserify', 'uglify']);
  grunt.registerTask('serve', ['build', 'watch']);

};
<|endoftext|>


<commit_before>/*
 * Grunt Script for Bootstrap Stylus
 * http://gruntjs.com/
 */

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

  grunt.initConfig({

  stylus: {
    bootstrap: {
      options: {
        paths: ['stylus'],
        urlfunc: 'embedurl', // use embedurl('test.png') in our code to trigger Data URI embedding
      },
      files: {
        'dist/bootstrap.css': 'bootstrap/index.styl' // 1:1 compile
      }
    },

    theme: {
      options: {
        paths: ['stylus'],
        urlfunc: 'embedurl',
      },
      files: {
        'dist/theme.css': 'bootstrap/theme.styl' // 1:1 compile
      }
    }
  },

  watch: {
    css: {
      files: 'bootstrap/**/*.styl',
      tasks: ['stylus'],
      options: {
        debounceDelay: 250
      }
    }
  },

  clean: {
    dist: ["dist/*.css", "dist/*.js"]
  },

  autoprefixer: {
    options: {
      browsers: [
        'Android 2.3',
        'Android >= 4',
        'Chrome >= 20',
        'Firefox >= 24', // Firefox 24 is the latest ESR
        'Explorer >= 8',
        'iOS >= 6',
        'Opera >= 12',
        'Safari >= 6'
      ]
    },
    core: {
      options: {
        map: true
      },
      src: 'dist/bootstrap.css'
    },
    theme: {
      options: {
        map: true
      },
      src: 'dist/theme.css'
    }
  },

  cssmin: {
    bootstrap: {
      files: {
        "dist/bootstrap.min.css": ["dist/bootstrap.css"]
      }
    },
    theme: {
      files: {
        "dist/theme.min.css": ["dist/theme.css"]
      }
    }
  },

  uglify: {
    dist: {
      files: {
        'dist/bootstrap.min.js': [
            'js/transition.js',
            'js/alert.js',
            'js/button.js',
            'js/carousel.js',
            'js/collapse.js',
            'js/dropdown.js',
            'js/modal.js',
            'js/tooltip.js',
            'js/popover.js',
            'js/scrollspy.js',
            'js/tab.js',
            'js/affix.js'
        ]
      }
    }
  },

  });

  // Load plugins here
  grunt.loadNpmTasks('grunt-contrib-stylus');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-uglify');

  grunt.registerTask('dist', ['clean','stylus:bootstrap', 'cssmin:bootstrap', 'uglify']);
  grunt.registerTask('theme', ['stylus:theme', 'cssmin:theme']);
  grunt.registerTask('build', ['clean','stylus:bootstrap', 'stylus:theme', 'cssmin:bootstrap', 'cssmin:theme', 'uglify']);
};
<commit_msg>cuz cssmin plugin is used in Gruntfile and it will generate bootstrap.min.css for minification, I think adding `compress: false` in stylus config would be a better choice~~<commit_after>/*
 * Grunt Script for Bootstrap Stylus
 * http://gruntjs.com/
 */

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

  grunt.initConfig({

  stylus: {
    options: {
      compress: false,
      paths: ['stylus'],
      urlfunc: 'embedurl', // use embedurl('test.png') in our code to trigger Data URI embedding
    },
    bootstrap: {
      files: {
        'dist/bootstrap.css': 'bootstrap/index.styl' // 1:1 compile
      }
    },

    theme: {
      files: {
        'dist/theme.css': 'bootstrap/theme.styl' // 1:1 compile
      }
    }
  },

  watch: {
    css: {
      files: 'bootstrap/**/*.styl',
      tasks: ['stylus'],
      options: {
        debounceDelay: 250
      }
    }
  },

  clean: {
    dist: ["dist/*.css", "dist/*.js"]
  },

  autoprefixer: {
    options: {
      browsers: [
        'Android 2.3',
        'Android >= 4',
        'Chrome >= 20',
        'Firefox >= 24', // Firefox 24 is the latest ESR
        'Explorer >= 8',
        'iOS >= 6',
        'Opera >= 12',
        'Safari >= 6'
      ]
    },
    core: {
      options: {
        map: true
      },
      src: 'dist/bootstrap.css'
    },
    theme: {
      options: {
        map: true
      },
      src: 'dist/theme.css'
    }
  },

  cssmin: {
    bootstrap: {
      files: {
        "dist/bootstrap.min.css": ["dist/bootstrap.css"]
      }
    },
    theme: {
      files: {
        "dist/theme.min.css": ["dist/theme.css"]
      }
    }
  },

  uglify: {
    dist: {
      files: {
        'dist/bootstrap.min.js': [
            'js/transition.js',
            'js/alert.js',
            'js/button.js',
            'js/carousel.js',
            'js/collapse.js',
            'js/dropdown.js',
            'js/modal.js',
            'js/tooltip.js',
            'js/popover.js',
            'js/scrollspy.js',
            'js/tab.js',
            'js/affix.js'
        ]
      }
    }
  },

  });

  // Load plugins here
  grunt.loadNpmTasks('grunt-contrib-stylus');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-uglify');

  grunt.registerTask('dist', ['clean','stylus:bootstrap', 'cssmin:bootstrap', 'uglify']);
  grunt.registerTask('theme', ['stylus:theme', 'cssmin:theme']);
  grunt.registerTask('build', ['clean','stylus:bootstrap', 'stylus:theme', 'cssmin:bootstrap', 'cssmin:theme', 'uglify']);
};
<|endoftext|>


<commit_before>module.exports = function (grunt) {
    grunt.initConfig({
      pkg: grunt.file.readJSON('package.json'),
      concat: {
          servs: {
              src: ['static/app/scripts/services/authservices.js',
                  'static/app/scripts/services/infonodeservices.js',
                  'static/app/scripts/services/mapservices.js',
                  'static/app/scripts/services/accountservices.js',
                  'static/app/scripts/services/contactservices.js',
                  'static/app/scripts/services/opportunityservices.js',
                  'static/app/scripts/services/leadservices.js',
                  'static/app/scripts/services/caseservices.js',
                  'static/app/scripts/services/topicservices.js',
                  'static/app/scripts/services/taskservices.js',
                  'static/app/scripts/services/eventservices.js',
                  'static/app/scripts/services/userservices.js',
                  'static/app/scripts/services/billingservices.js',
                  'static/app/scripts/services/noteservices.js',
                  'static/app/scripts/services/commentservices.js',
                  'static/app/scripts/services/settingservices.js',
                  'static/app/scripts/services/edgeservices.js',
                  'static/app/scripts/services/profileservices.js',
                  'static/app/scripts/services/linkedinservices.js'
              ],
              dest: 'static/build/js/_servs.js',
          },
          ctrls: {
              src: [
                  'static/app/scripts/app.js',
                  'static/app/scripts/directives/directives.js',
                  'static/app/scripts/controllers/admin/**/*.js',
                  'static/app/scripts/controllers/mysettingcontrollers.js',
                  'static/app/scripts/controllers/searchcontrollers.js',
                  'static/app/scripts/controllers/accountcontrollers.js',
                  'static/app/scripts/controllers/leadcontrollers.js',
                  'static/app/scripts/controllers/casecontrollers.js',
                  'static/app/scripts/controllers/billingController.js',
                  'static/app/scripts/controllers/contactcontroller.js',
                  'static/app/scripts/controllers/opportunitycontroller.js',
                  'static/app/scripts/controllers/documentcontrollers.js',
                  'static/app/scripts/controllers/notecontrollers.js',
                  'static/app/scripts/controllers/taskcontrollers.js',
                  'static/app/scripts/controllers/eventcontrollers.js',
                  'static/app/scripts/controllers/usercontrollers.js',
                  'static/app/scripts/controllers/settingscontrollers.js'
              ],
              dest: 'static/build/js/_ctrls.js',
          },
        },
        bower_concat: {
          first: {
            dest: {
                'js': 'static/build/js/_first.js'
            },
            include: [
              'jquery',
              'jquery-ui',
              'moment',
              'angular-unstable',
              'angular-moment',
              'angular-google-chart'
            ],
            mainFiles: {
              'angular-unstable': 'angular.min.js'
            },
            dependencies: {
                'jquery-ui': 'jquery',
                'angular-google-chart': 'angular-unstable',
                'angular-moment': 'angular-unstable'
            },
            bowerOptions: {
              relative: false
            }
          },
          async: {
            dest: {
                'js': 'static/build/js/_async.js',
                'css': 'static/build/css/_async.css'
            },
            include: [
              'jquery-textfill',
              'select2',
              'angular-ui-select2',
              'angular-xeditable',
              'wysihtml5',
              'bootstrap-wysihtml5',
              'jquery.uniform',
              'jquery-simple-datetimepicker',
              'bootstrap-datepicker',
              'bootstrap-hover-dropdown',
              'twitter-bootstrap-wizard',
              'angular-sortable-view',
              'datetimepicker',
              'fullcalendar'
            ],
            dependencies: {
                'bootstrap-wysihtml5': 'wysihtml5',
                'angular-ui-select2': 'select2'
            },
            mainFiles: {
              'jquery-textfill':'jquery.textfill.min.js',
              'select2':'select2.min.js',
              'wysihtml5': 'dist/wysihtml5-0.3.0.min.js',
              'jquery.uniform': [
                  "jquery.uniform.min.js",
                  "themes/default/css/uniform.default.min.css"
              ]
            },
            bowerOptions: {
              relative: false
            }
          },
          sync: {
            dest: {
                'js': 'static/build/js/_sync.js',
                'css': 'static/build/css/_sync.css'
            },
            include: [
              'bootstrap',
              'angular-bootstrap',
              'jquery-ui-maps',
              'zepto',
              'hopscotch',
              'jquery-validation'
            ],
            dependencies: {
                'angular-bootstrap': 'bootstrap'
            },
            mainFiles: {
              'jquery-ui-maps': [
                  'ui/min/jquery.ui.map.min.js',
                  'ui/min/jquery.ui.map.services.min.js'
              ],
              'hopscotch': [
                  'dist/css/hopscotch.min.css',
                  'dist/js/hopscotch.min.js'
              ]
            },
            bowerOptions: {
              relative: false
            }
          }
      },
      cssmin: {
            sync_css: {
                files: {
                    'static/build/css/_sync.css': ['static/build/css/_sync.css']
                }
            },
             async_css: {
                files: {
                    'static/build/css/_async.css': ['static/build/css/_async.css']
                }
            },

      },
      uglify: {
            options: {
                mangle: false
            },
            first_sync_js: {
               files: {
               'static/build/js/_first.js': ['static/build/js/_first.js']
               }
            },
            sync_js: {
               files: {
               'static/build/js/_sync.js': ['static/build/js/_sync.js']
               }
            },
            async_js: {
             files: {
             'static/build/js/_async.js': ['static/build/js/_async.js']
             }
            },
            ctrls: {
                files: {
                    'static/build/js/_ctrls.js': ['static/build/js/_ctrls.js']
                }
            },
            servs: {
                files: {
                    'static/build/js/_servs.js': ['static/build/js/_servs.js']
                }
            }
        },
        watch: {
            ctrls: {
                files: ['static/app/scripts/app.js',
                        'static/app/scripts/directives/directives.js',
                        'static/app/scripts/controllers/*.js',
                        'static/app/scripts/controllers/admin/*.js'],
                tasks: ['concat:ctrls', 'uglify:ctrls'],
            },
            servs: {
                files: ['static/app/scripts/services/*.js'],
                tasks: ['concat:servs', 'uglify:servs'],
            },
        },
            removeLoggingCalls: {
        // the files inside which you want to remove the console statements
        files: ['static/build/js/*.js'],
        options: {
            // an array of method names to remove
            methods: ['log', 'info', 'assert'],
            // replacement strategy
            strategy: function(consoleStatement) {
                // comments console calls statements
                //return '/* ' + consoleStatement + '*/';
                return ''; // to remove
            },

            // when the logging statement is ended by a semicolon ';'
            // include it in the 'consoleStatement' given to the strategy
            removeSemicolonIfPossible: true
        }
    }

    });
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-bower-concat');
    //grunt.loadNpmTasks("grunt-remove-logging-calls");

    grunt.registerTask('default', [
      'bower_concat',
      'concat',
      'cssmin'
    ]);
    grunt.registerTask('prod', [
      'bower_concat',
      'concat',
      'cssmin',
      //  'removeLoggingCalls',       //buggy
      'uglify',

    ]);
};
<commit_msg>add htmlmin command in grunt<commit_after>module.exports = function (grunt) {
    grunt.initConfig({
      pkg: grunt.file.readJSON('package.json'),
      concat: {
          servs: {
              src: ['static/app/scripts/services/authservices.js',
                  'static/app/scripts/services/infonodeservices.js',
                  'static/app/scripts/services/mapservices.js',
                  'static/app/scripts/services/accountservices.js',
                  'static/app/scripts/services/contactservices.js',
                  'static/app/scripts/services/opportunityservices.js',
                  'static/app/scripts/services/leadservices.js',
                  'static/app/scripts/services/caseservices.js',
                  'static/app/scripts/services/topicservices.js',
                  'static/app/scripts/services/taskservices.js',
                  'static/app/scripts/services/eventservices.js',
                  'static/app/scripts/services/userservices.js',
                  'static/app/scripts/services/billingservices.js',
                  'static/app/scripts/services/noteservices.js',
                  'static/app/scripts/services/commentservices.js',
                  'static/app/scripts/services/settingservices.js',
                  'static/app/scripts/services/edgeservices.js',
                  'static/app/scripts/services/profileservices.js',
                  'static/app/scripts/services/linkedinservices.js'
              ],
              dest: 'static/build/js/_servs.js',
          },
          ctrls: {
              src: [
                  'static/app/scripts/app.js',
                  'static/app/scripts/directives/directives.js',
                  'static/app/scripts/controllers/admin/**/*.js',
                  'static/app/scripts/controllers/mysettingcontrollers.js',
                  'static/app/scripts/controllers/searchcontrollers.js',
                  'static/app/scripts/controllers/accountcontrollers.js',
                  'static/app/scripts/controllers/leadcontrollers.js',
                  'static/app/scripts/controllers/casecontrollers.js',
                  'static/app/scripts/controllers/billingController.js',
                  'static/app/scripts/controllers/contactcontroller.js',
                  'static/app/scripts/controllers/opportunitycontroller.js',
                  'static/app/scripts/controllers/documentcontrollers.js',
                  'static/app/scripts/controllers/notecontrollers.js',
                  'static/app/scripts/controllers/taskcontrollers.js',
                  'static/app/scripts/controllers/eventcontrollers.js',
                  'static/app/scripts/controllers/usercontrollers.js',
                  'static/app/scripts/controllers/settingscontrollers.js'
              ],
              dest: 'static/build/js/_ctrls.js',
          },
        },
        bower_concat: {
          first: {
            dest: {
                'js': 'static/build/js/_first.js'
            },
            include: [
              'jquery',
              'jquery-ui',
              'moment',
              'angular-unstable',
              'angular-moment',
              'angular-google-chart'
            ],
            mainFiles: {
              'angular-unstable': 'angular.min.js'
            },
            dependencies: {
                'jquery-ui': 'jquery',
                'angular-google-chart': 'angular-unstable',
                'angular-moment': 'angular-unstable'
            },
            bowerOptions: {
              relative: false
            }
          },
          async: {
            dest: {
                'js': 'static/build/js/_async.js',
                'css': 'static/build/css/_async.css'
            },
            include: [
              'jquery-textfill',
              'select2',
              'angular-ui-select2',
              'angular-xeditable',
              'wysihtml5',
              'bootstrap-wysihtml5',
              'jquery.uniform',
              'jquery-simple-datetimepicker',
              'bootstrap-datepicker',
              'bootstrap-hover-dropdown',
              'twitter-bootstrap-wizard',
              'angular-sortable-view',
              'datetimepicker',
              'fullcalendar'
            ],
            dependencies: {
                'bootstrap-wysihtml5': 'wysihtml5',
                'angular-ui-select2': 'select2'
            },
            mainFiles: {
              'jquery-textfill':'jquery.textfill.min.js',
              'select2':'select2.min.js',
              'wysihtml5': 'dist/wysihtml5-0.3.0.min.js',
              'jquery.uniform': [
                  "jquery.uniform.min.js",
                  "themes/default/css/uniform.default.min.css"
              ]
            },
            bowerOptions: {
              relative: false
            }
          },
          sync: {
            dest: {
                'js': 'static/build/js/_sync.js',
                'css': 'static/build/css/_sync.css'
            },
            include: [
              'bootstrap',
              'angular-bootstrap',
              'jquery-ui-maps',
              'zepto',
              'hopscotch',
              'jquery-validation'
            ],
            dependencies: {
                'angular-bootstrap': 'bootstrap'
            },
            mainFiles: {
              'jquery-ui-maps': [
                  'ui/min/jquery.ui.map.min.js',
                  'ui/min/jquery.ui.map.services.min.js'
              ],
              'hopscotch': [
                  'dist/css/hopscotch.min.css',
                  'dist/js/hopscotch.min.js'
              ]
            },
            bowerOptions: {
              relative: false
            }
          }
      },
        htmlmin: {
        dist: {
            options: {
                removeComments: true,
                collapseWhitespace: true,
                minifyCSS: true,
                minifyJS:true,
                minifyURLs:true,
                },
                    expand: true,
                    cwd: '',
                    src: ['templates/**/*.html'],

    }
    },
      cssmin: {
            sync_css: {
                files: {
                    'static/build/css/_sync.css': ['static/build/css/_sync.css']
                }
            },
             async_css: {
                files: {
                    'static/build/css/_async.css': ['static/build/css/_async.css']
                }
            },

      },
      uglify: {
            options: {
                mangle: false
            },
            first_sync_js: {
               files: {
               'static/build/js/_first.js': ['static/build/js/_first.js']
               }
            },
            sync_js: {
               files: {
               'static/build/js/_sync.js': ['static/build/js/_sync.js']
               }
            },
            async_js: {
             files: {
             'static/build/js/_async.js': ['static/build/js/_async.js']
             }
            },
            ctrls: {
                files: {
                    'static/build/js/_ctrls.js': ['static/build/js/_ctrls.js']
                }
            },
            servs: {
                files: {
                    'static/build/js/_servs.js': ['static/build/js/_servs.js']
                }
            }
        },
        watch: {
            ctrls: {
                files: ['static/app/scripts/app.js',
                        'static/app/scripts/directives/directives.js',
                        'static/app/scripts/controllers/*.js',
                        'static/app/scripts/controllers/admin/*.js'],
                tasks: ['concat:ctrls', 'uglify:ctrls'],
            },
            servs: {
                files: ['static/app/scripts/services/*.js'],
                tasks: ['concat:servs', 'uglify:servs'],
            },
        },
            removeLoggingCalls: {
        // the files inside which you want to remove the console statements
        files: ['static/build/js/*.js'],
        options: {
            // an array of method names to remove
            methods: ['log', 'info', 'assert'],
            // replacement strategy
            strategy: function(consoleStatement) {
                // comments console calls statements
                //return '/* ' + consoleStatement + '*/';
                return ''; // to remove
            },

            // when the logging statement is ended by a semicolon ';'
            // include it in the 'consoleStatement' given to the strategy
            removeSemicolonIfPossible: true
        }
    }

    });
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-htmlmin');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-bower-concat');

    //grunt.loadNpmTasks("grunt-remove-logging-calls");

    grunt.registerTask('default', [
      'bower_concat',
      'concat',
      'cssmin'
    ]);
    grunt.registerTask('prod', [
      'bower_concat',
      'concat',
      'cssmin',
      //  'removeLoggingCalls',       //buggy
      'uglify',

    ]);
};
<|endoftext|>


<commit_before>/* jshint node:true */
"use strict";

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

    watch: {
      sass: {
        files: ["scss/**/*.{scss,sass}"],
        tasks: ["sass:compile"]
      },
      js: {
        files: ["js/**/*.js", "tests/**/*.js"],
        tasks: ["jshint:all", "uglify:dev"]
      },
      images: {
        files: ["assets/images/**/*.{png,jpg,jpeg,gif}"],
        tasks: ["imagemin"]
      },
      livereload: {
        files: ["dist/**/*.css", "dist/**/*.{js,json}", "dist/images/**/*.{png,jpg,jpeg,gif,webp,svg}"],
        options: {
          livereload: true
        }
      }
    },

    sass: {
      compile: {
        files: {
          "dist/neue.css": "scss/neue.scss",
          "dist/ie.css": "scss/ie.scss"
        },
        options: {
          sourceComments: "normal"
        }
      }
    },

    cssmin: {
      minify: {
        options: {
          report: "gzip"
        },
        files: {
          "dist/neue.css": ["dist/neue.css"],
          "dist/ie.css": ["dist/ie.css"]
        }
      }
    },

    copy: {
      main: {
        files: [
          {expand: true, src: ["assets/images/**", "!images/**/*"], dest: "dist/"},
          {expand: true, src: ["assets/kss/**"], dest: "dist/"},
          {expand: true, src: ["assets/fonts/**"], dest: "dist/"},
          {src: "scss/helpers.scss", dest: "dist/helpers.scss"},
          {src: "README.md", dest: "dist/README.md"},
          {src: "LICENSE", dest: "dist/LICENSE"},
          {src: "bower.json", dest: "dist/bower.json"},
          {src: "package.json", dest: "dist/package.json"}
        ]
      }
    },

    imagemin: {
      bundle: {
        files: [{
          expand: true,
          cwd: "assets/images/",
          src: ["**/*.{png,jpg,jpeg,gif}"],
          dest: "dist/assets/images"
        }]
      }
    },

    jshint: {
      options: {
        force: true,
        jshintrc: true,
        reporter: require("jshint-stylish")
      },
      all: ["js/**/*.js", "!js/vendor/**/*.js", "!js/polyfills/**/*.js",  "tests/**/*.js", "!tests/wraith/**/*.js", "!tests/lib/**/*.js"]
    },

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

    uglify: {
      prod: {
        options: {
          report: "gzip"
        },
        files: {
          "dist/neue.js": ["js/**/*.js", "!js/polyfills/**/*.js"],
        }
      },
      dev: {
        options: {
          mangle: false,
          compress: false,
          beautify: true
        },
        files: {
          "dist/neue.js": ["js/**/*.js", "!js/polyfills/**/*.js"],
        }
      }
    },

    docco: {
      docs: {
        src: ["js/*.js"],
        options: {
          output: "dist/docs"
        }
      }
    },

    bump: {
      options: {
        files: ["package.json", "bower.json"],
        commitFiles: ["package.json", "bower.json"],
        updateConfigs: ["pkg"],
        pushTo: "origin",
        createTag: false
      }
    },

    checkrepo: {
      clean: {
        clean: true, // Require repo to be clean (no unstaged changes)
      },
      validtag: {
        tag: {
          valid: '<%= pkg.version %>', // check if pkg.version is valid semantic version
          lt: '<%= pkg.version %>' // check if highest repo tag is lower than pkg.version
        }
      }
    },

    shell: {
      wraith: {
        command: "cd tests/wraith && rake && open tests/wraith/ds/gallery.html",
        options: {
          stdout: true
        }
      },

      scsslint: {
        command: "scss-lint scss/ --config .scss-lint.yaml",
        options: {
          stdout: true
        }
      },

      clean: {
        command: "rm -rf dist/*"
      },

      dist: {
        command: [
          // destroy current dist branch
          "git branch -D dist",
          "git push origin :dist",

          // create a new dist branch off of master
          "git checkout -b dist ",

          // get rid of everything besides the contents of the dist directory
          "find . -maxdepth 1 ! -name 'dist' ! -name 'node_modules' ! -name '.*' | xargs rm -rf",
          "cp -r dist/* .",
          "rm -rf dist",

          // commit those changes and tag with version
          "git add --all .",
          "git commit -m 'Prepared for distribution.'",
          "git tag -a v<%= pkg.version %> -m 'Version <%= pkg.version %>'",

          // push dist branch and tags to origin
          "git push origin dist --tags",

          // and finally, bring us back to the master branch
          "git checkout master"
        ].join("&&"),
        options: {
          stdout: true,
          failOnError: true
        }
      }
    }

  });

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

  // code linting
  grunt.registerTask("lint", ["jshint:all", "shell:scsslint"]);

  // testing
  grunt.registerTask("test", ["test:css", "test:js"]);
  grunt.registerTask("test:css", ["shell:wraith"]);
  grunt.registerTask("test:js", ["qunit"]);

  // build
  grunt.registerTask("build", ["lint", "sass:compile", "imagemin", "uglify:dev", "copy:main", "docco"]);
  grunt.registerTask("prod", ["shell:clean", "sass:compile", "cssmin:minify", "copy:main", "imagemin", "uglify:prod"]); // used when preparing code for distribution

  // deploy
  grunt.registerTask("deploy", "Runs tests and lints code, compiles for production, deploys master to the dist branch, and makes a git tag.", function() {
    grunt.task.run("checkbranch:master", "checkbranch:validtag", "test:js", "lint", "prod", "checkrepo:clean", "shell:dist");
  });

  grunt.loadNpmTasks("grunt-sass");
  grunt.loadNpmTasks("grunt-contrib-cssmin");
  grunt.loadNpmTasks("grunt-contrib-imagemin");
  grunt.loadNpmTasks("grunt-contrib-copy");
  grunt.loadNpmTasks("grunt-contrib-jshint");
  grunt.loadNpmTasks("grunt-contrib-qunit");
  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks("grunt-contrib-watch");
  grunt.loadNpmTasks("grunt-checkbranch");
  grunt.loadNpmTasks("grunt-checkrepo");
  grunt.loadNpmTasks("grunt-docco2");
  grunt.loadNpmTasks("grunt-bump");
  grunt.loadNpmTasks("grunt-shell");
};
<commit_msg>Proper task name for checktag.<commit_after>/* jshint node:true */
"use strict";

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

    watch: {
      sass: {
        files: ["scss/**/*.{scss,sass}"],
        tasks: ["sass:compile"]
      },
      js: {
        files: ["js/**/*.js", "tests/**/*.js"],
        tasks: ["jshint:all", "uglify:dev"]
      },
      images: {
        files: ["assets/images/**/*.{png,jpg,jpeg,gif}"],
        tasks: ["imagemin"]
      },
      livereload: {
        files: ["dist/**/*.css", "dist/**/*.{js,json}", "dist/images/**/*.{png,jpg,jpeg,gif,webp,svg}"],
        options: {
          livereload: true
        }
      }
    },

    sass: {
      compile: {
        files: {
          "dist/neue.css": "scss/neue.scss",
          "dist/ie.css": "scss/ie.scss"
        },
        options: {
          sourceComments: "normal"
        }
      }
    },

    cssmin: {
      minify: {
        options: {
          report: "gzip"
        },
        files: {
          "dist/neue.css": ["dist/neue.css"],
          "dist/ie.css": ["dist/ie.css"]
        }
      }
    },

    copy: {
      main: {
        files: [
          {expand: true, src: ["assets/images/**", "!images/**/*"], dest: "dist/"},
          {expand: true, src: ["assets/kss/**"], dest: "dist/"},
          {expand: true, src: ["assets/fonts/**"], dest: "dist/"},
          {src: "scss/helpers.scss", dest: "dist/helpers.scss"},
          {src: "README.md", dest: "dist/README.md"},
          {src: "LICENSE", dest: "dist/LICENSE"},
          {src: "bower.json", dest: "dist/bower.json"},
          {src: "package.json", dest: "dist/package.json"}
        ]
      }
    },

    imagemin: {
      bundle: {
        files: [{
          expand: true,
          cwd: "assets/images/",
          src: ["**/*.{png,jpg,jpeg,gif}"],
          dest: "dist/assets/images"
        }]
      }
    },

    jshint: {
      options: {
        force: true,
        jshintrc: true,
        reporter: require("jshint-stylish")
      },
      all: ["js/**/*.js", "!js/vendor/**/*.js", "!js/polyfills/**/*.js",  "tests/**/*.js", "!tests/wraith/**/*.js", "!tests/lib/**/*.js"]
    },

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

    uglify: {
      prod: {
        options: {
          report: "gzip"
        },
        files: {
          "dist/neue.js": ["js/**/*.js", "!js/polyfills/**/*.js"],
        }
      },
      dev: {
        options: {
          mangle: false,
          compress: false,
          beautify: true
        },
        files: {
          "dist/neue.js": ["js/**/*.js", "!js/polyfills/**/*.js"],
        }
      }
    },

    docco: {
      docs: {
        src: ["js/*.js"],
        options: {
          output: "dist/docs"
        }
      }
    },

    bump: {
      options: {
        files: ["package.json", "bower.json"],
        commitFiles: ["package.json", "bower.json"],
        updateConfigs: ["pkg"],
        pushTo: "origin",
        createTag: false
      }
    },

    checkrepo: {
      clean: {
        clean: true, // Require repo to be clean (no unstaged changes)
      },
      validtag: {
        tag: {
          valid: '<%= pkg.version %>', // check if pkg.version is valid semantic version
          lt: '<%= pkg.version %>' // check if highest repo tag is lower than pkg.version
        }
      }
    },

    shell: {
      wraith: {
        command: "cd tests/wraith && rake && open tests/wraith/ds/gallery.html",
        options: {
          stdout: true
        }
      },

      scsslint: {
        command: "scss-lint scss/ --config .scss-lint.yaml",
        options: {
          stdout: true
        }
      },

      clean: {
        command: "rm -rf dist/*"
      },

      dist: {
        command: [
          // destroy current dist branch
          "git branch -D dist",
          "git push origin :dist",

          // create a new dist branch off of master
          "git checkout -b dist ",

          // get rid of everything besides the contents of the dist directory
          "find . -maxdepth 1 ! -name 'dist' ! -name 'node_modules' ! -name '.*' | xargs rm -rf",
          "cp -r dist/* .",
          "rm -rf dist",

          // commit those changes and tag with version
          "git add --all .",
          "git commit -m 'Prepared for distribution.'",
          "git tag -a v<%= pkg.version %> -m 'Version <%= pkg.version %>'",

          // push dist branch and tags to origin
          "git push origin dist --tags",

          // and finally, bring us back to the master branch
          "git checkout master"
        ].join("&&"),
        options: {
          stdout: true,
          failOnError: true
        }
      }
    }

  });

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

  // code linting
  grunt.registerTask("lint", ["jshint:all", "shell:scsslint"]);

  // testing
  grunt.registerTask("test", ["test:css", "test:js"]);
  grunt.registerTask("test:css", ["shell:wraith"]);
  grunt.registerTask("test:js", ["qunit"]);

  // build
  grunt.registerTask("build", ["lint", "sass:compile", "imagemin", "uglify:dev", "copy:main", "docco"]);
  grunt.registerTask("prod", ["shell:clean", "sass:compile", "cssmin:minify", "copy:main", "imagemin", "uglify:prod"]); // used when preparing code for distribution

  // deploy
  grunt.registerTask("deploy", "Runs tests and lints code, compiles for production, deploys master to the dist branch, and makes a git tag.", function() {
    grunt.task.run("checkbranch:master", "checkrepo:validtag", "test:js", "lint", "prod", "checkrepo:clean", "shell:dist");
  });

  grunt.loadNpmTasks("grunt-sass");
  grunt.loadNpmTasks("grunt-contrib-cssmin");
  grunt.loadNpmTasks("grunt-contrib-imagemin");
  grunt.loadNpmTasks("grunt-contrib-copy");
  grunt.loadNpmTasks("grunt-contrib-jshint");
  grunt.loadNpmTasks("grunt-contrib-qunit");
  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks("grunt-contrib-watch");
  grunt.loadNpmTasks("grunt-checkbranch");
  grunt.loadNpmTasks("grunt-checkrepo");
  grunt.loadNpmTasks("grunt-docco2");
  grunt.loadNpmTasks("grunt-bump");
  grunt.loadNpmTasks("grunt-shell");
};
<|endoftext|>


<commit_before>
/* Src File listing
Format:
"map_dir/*.js", "!map_dir/*.min.js"
The second part is to avoid to use the min file
*/
src_file_listing = [
    'argentina/*.js', '!argentina/*.min.js',
    'belgium/*.js', '!belgium/*.min.js',
    'european_union/*.js', '!european_union/*.min.js',
    'france/*.js', '!france/*.min.js',
    'netherlands/*.js', '!netherlands/*.min.js',
    'thailand/*.js', '!thailand/*.min.js',
    'ukraine/*.js', '!ukraine/*.min.js',
    'united_kingdom/*.js', '!united_kingdom/*.min.js',
    'wales/*.js', '!wales/*.min.js'
];

module.exports = function (grunt) {
    grunt.initConfig({
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: src_file_listing
        },
        uglify: {
            options: {
                compress: true,
                mangle: true,
                preserveComments: 'some',
                report: 'gzip'
            },
            build: {
                files: [
                    {
                        expand: true,     // Enable dynamic expansion.
                        src: src_file_listing,
                        ext: '.min.js',   // Dest filepaths will have this extension.
                        extDot: 'last'   // Extensions in filenames begin after the last dot
                    }
                ]
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');

    grunt.registerTask('default', ['jshint', 'uglify']);
};
<commit_msg>Added map of Scandinavia for minification<commit_after>
/* Src File listing
Format:
"map_dir/*.js", "!map_dir/*.min.js"
The second part is to avoid to use the min file
*/
src_file_listing = [
    'argentina/*.js', '!argentina/*.min.js',
    'belgium/*.js', '!belgium/*.min.js',
    'european_union/*.js', '!european_union/*.min.js',
    'france/*.js', '!france/*.min.js',
    'netherlands/*.js', '!netherlands/*.min.js',
    'thailand/*.js', '!thailand/*.min.js',
    'ukraine/*.js', '!ukraine/*.min.js',
    'united_kingdom/*.js', '!united_kingdom/*.min.js',
    'wales/*.js', '!wales/*.min.js',
    'scandinavia/*.js', '!scandinavia/*.min.js'
];

module.exports = function (grunt) {
    grunt.initConfig({
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: src_file_listing
        },
        uglify: {
            options: {
                compress: true,
                mangle: true,
                preserveComments: 'some',
                report: 'gzip'
            },
            build: {
                files: [
                    {
                        expand: true,     // Enable dynamic expansion.
                        src: src_file_listing,
                        ext: '.min.js',   // Dest filepaths will have this extension.
                        extDot: 'last'   // Extensions in filenames begin after the last dot
                    }
                ]
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');

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


<commit_before>// eslint-disable-next-line
module.exports = function (grunt) {
  "use strict";

  var sourceFiles = grunt.file.readJSON("sourceFiles.json");
  var testSpecs = "tests/spec/**/*.js";

  var quadFragment = "<%= grunt.file.read('build/glsl/quad-fragment.glsl') %>";
  var quadVertex = "<%= grunt.file.read('build/glsl/quad-vertex.glsl') %>";
  var lineFragment = "<%= grunt.file.read('build/glsl/line-fragment.glsl') %>";
  var lineVertex = "<%= grunt.file.read('build/glsl/line-vertex.glsl') %>";

  // Project configuration.
  grunt.initConfig({
    pkg : grunt.file.readJSON("package.json"),
    path : {
      main : "build/<%= pkg.name %>.js",
      min : "build/<%= pkg.name %>.min.js"
    },

    concat : {
      dist : {
        src : sourceFiles,
        dest : "<%= path.main %>"
      }
    },

    replace : {
      dist : {
        options : {
          variables : {
            "__VERSION__"     : "<%= pkg.version %>",
            "__QUAD_FRAGMENT__" : quadFragment,
            "__QUAD_VERTEX__"   : quadVertex,
            "__LINE_FRAGMENT__" : lineFragment,
            "__LINE_VERTEX__"   : lineVertex
          },
          usePrefix : false,
          force : true,
          patterns : [
            {
              match : /this\._super\(\s*([\w\.]+)\s*,\s*"(\w+)"\s*(,\s*)?/g,
              replacement : "$1.prototype.$2.apply(this$3"
            }
          ]
        },
        files : [
          {
            expand : true,
            flatten : true,
            src : [ "<%= path.main %>" ],
            dest : "build/"
          }
        ]
      },

      docs : {
        options : {
          variables : {
            "__VERSION__" : "<%= pkg.version %>"
          },
          usePrefix : false,
          force : true
        },
        files : [
          {
            expand : true,
            src : sourceFiles.concat([ "README.md" ]),
            dest : "build/docs/"
          }
        ]
      },

      glsl : {
        options : {
          preserveOrder : true,
          patterns : [
            {
              // Remove comments
              match : /(\/\/.*?\\n)|(\/\*(.|\\n)*?\*\/)/g,
              replacement : ""
            },
            {
              // Remove leading and trailing whitespace from lines
              match : /(\\n\s+)|(\s+\\n)/g,
              replacement : ""
            },
            {
              // Remove line breaks
              match : /(\\r|\\n)+/g,
              replacement : ""
            },
            {
              // Remove unnecessary whitespace
              match : /\s*([;,[\](){}\\\/\-+*|^&!=<>?~%])\s*/g,
              replacement : "$1"
            }
          ]
        },
        files : [
          {
            expand : true,
            flatten : true,
            src : [ "build/glsl/*.glsl" ],
            dest : "build/glsl/"
          }
        ]
      }
    },

    dot : {
      glsl : {
        options : {
          strip : false
        },
        files : [
          {
            src : "src/video/webgl/glsl/",
            dest : "build/glsl/"
          }
        ]
      }
    },

    uglify : {
      options : {
        report : "min",
        preserveComments :  /(?:^!|@(?:license|preserve|cc_on))/,
        screwIE8 : "true",
        mangle: {
          eval: true
        }
      },
      dist : {
        files : {
          "<%= path.min %>" : [
            "<%= path.main %>"
          ]
        }
      }
    },

    eslint : {
        options : {
          configFile : ".eslintrc.json"
        },

        beforeConcat : {
          files : {
            src : [
              testSpecs,
              sourceFiles,
              "Gruntfile.js",
              "plugins/**/*.js"
            ]
          }
        },

      afterConcat : {
        files : {
          src : [ "<%= path.main %>" ]
        }
      }
    },

    clean : {
      dist : [
        "<%= path.main %>",
        "<%= path.min %>"
      ],
      jsdoc : [
        "build/docs",
        "build/glsl/*.glsl",
        "./docs/**/*.*",
        "./docs/scripts",
        "./docs/styles",
        "./docs/images",
        "./docs/img"
      ]
    },

    jsdoc : {
      dist : {
        src : sourceFiles.map(function (value) {
          return value.replace("src/", "build/docs/src/");
        }).concat([ "README.md" ]),
        options : {
          configure : "jsdoc_conf.json",
          destination : "docs",
          template : "tasks/jsdoc-template/template"
        }
      }
    },

    connect : {
      server : {
        options : {
          port : 8001
        }
      },

      keepalive : {
        options : {
          port : 8000,
          keepalive : true
        }
      }
    },

    copy : {
      dist : {
        expand : true,
        src : [
          "index.html",
          "build/melonjs.js",
          "build/melonjs.min.js",
          "docs/**",
          "examples/**",
          "media/logo.png",
          "plugins/**"
        ],
        dest : "dist/"
      }
    },

    buildGhPages : {
      dist : {
        options : {
          dist : "dist",
          build_branch : "gh-pages",
          exclude : [ "node_modules/" ],
          pull : true
        }
      }
    },

    karma: {
      unit: {
        configFile: "karma.conf.js",
        browsers: ["ChromeHeadless"] //other supported options are Chrome and ChromeHeadless
      }
    }

  });

  grunt.loadNpmTasks("grunt-contrib-clean");
  grunt.loadNpmTasks("grunt-contrib-concat");
  grunt.loadNpmTasks("grunt-contrib-connect");
  grunt.loadNpmTasks("grunt-contrib-copy");
  grunt.loadNpmTasks("grunt-eslint");
  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks("grunt-build-gh-pages");
  grunt.loadNpmTasks("grunt-jsdoc");
  grunt.loadNpmTasks("grunt-karma");
  grunt.loadNpmTasks("grunt-replace");

  // Custom Tasks
  grunt.loadTasks("tasks");

  // Default task.
  grunt.registerTask("default", [ "test", "uglify" ]);
  grunt.registerTask("build", [ "lint", "uglify" ]);
  grunt.registerTask("glsl", [ "dot:glsl", "replace:glsl" ]);
  grunt.registerTask("lint", [
    "eslint:beforeConcat",
    "glsl",
    "concat",
    "replace:dist",
    "eslint:afterConcat"
  ]);
  grunt.registerTask("doc", [ "replace:docs", "jsdoc" ]);
  grunt.registerTask("test", [ "lint", "karma" ]);
  grunt.registerTask("serve", [ "connect:keepalive" ]);
  grunt.registerTask("gh-pages", [
    "test",
    "build",
    "doc",
    "copy:dist",
    "buildGhPages:dist"
  ]);
  grunt.registerTask("release", [ "gh-pages", "dorelease" ]);
};
<commit_msg>[#894] giving up for now, back to PhantomJS<commit_after>// eslint-disable-next-line
module.exports = function (grunt) {
  "use strict";

  var sourceFiles = grunt.file.readJSON("sourceFiles.json");
  var testSpecs = "tests/spec/**/*.js";

  var quadFragment = "<%= grunt.file.read('build/glsl/quad-fragment.glsl') %>";
  var quadVertex = "<%= grunt.file.read('build/glsl/quad-vertex.glsl') %>";
  var lineFragment = "<%= grunt.file.read('build/glsl/line-fragment.glsl') %>";
  var lineVertex = "<%= grunt.file.read('build/glsl/line-vertex.glsl') %>";

  // Project configuration.
  grunt.initConfig({
    pkg : grunt.file.readJSON("package.json"),
    path : {
      main : "build/<%= pkg.name %>.js",
      min : "build/<%= pkg.name %>.min.js"
    },

    concat : {
      dist : {
        src : sourceFiles,
        dest : "<%= path.main %>"
      }
    },

    replace : {
      dist : {
        options : {
          variables : {
            "__VERSION__"     : "<%= pkg.version %>",
            "__QUAD_FRAGMENT__" : quadFragment,
            "__QUAD_VERTEX__"   : quadVertex,
            "__LINE_FRAGMENT__" : lineFragment,
            "__LINE_VERTEX__"   : lineVertex
          },
          usePrefix : false,
          force : true,
          patterns : [
            {
              match : /this\._super\(\s*([\w\.]+)\s*,\s*"(\w+)"\s*(,\s*)?/g,
              replacement : "$1.prototype.$2.apply(this$3"
            }
          ]
        },
        files : [
          {
            expand : true,
            flatten : true,
            src : [ "<%= path.main %>" ],
            dest : "build/"
          }
        ]
      },

      docs : {
        options : {
          variables : {
            "__VERSION__" : "<%= pkg.version %>"
          },
          usePrefix : false,
          force : true
        },
        files : [
          {
            expand : true,
            src : sourceFiles.concat([ "README.md" ]),
            dest : "build/docs/"
          }
        ]
      },

      glsl : {
        options : {
          preserveOrder : true,
          patterns : [
            {
              // Remove comments
              match : /(\/\/.*?\\n)|(\/\*(.|\\n)*?\*\/)/g,
              replacement : ""
            },
            {
              // Remove leading and trailing whitespace from lines
              match : /(\\n\s+)|(\s+\\n)/g,
              replacement : ""
            },
            {
              // Remove line breaks
              match : /(\\r|\\n)+/g,
              replacement : ""
            },
            {
              // Remove unnecessary whitespace
              match : /\s*([;,[\](){}\\\/\-+*|^&!=<>?~%])\s*/g,
              replacement : "$1"
            }
          ]
        },
        files : [
          {
            expand : true,
            flatten : true,
            src : [ "build/glsl/*.glsl" ],
            dest : "build/glsl/"
          }
        ]
      }
    },

    dot : {
      glsl : {
        options : {
          strip : false
        },
        files : [
          {
            src : "src/video/webgl/glsl/",
            dest : "build/glsl/"
          }
        ]
      }
    },

    uglify : {
      options : {
        report : "min",
        preserveComments :  /(?:^!|@(?:license|preserve|cc_on))/,
        screwIE8 : "true",
        mangle: {
          eval: true
        }
      },
      dist : {
        files : {
          "<%= path.min %>" : [
            "<%= path.main %>"
          ]
        }
      }
    },

    eslint : {
        options : {
          configFile : ".eslintrc.json"
        },

        beforeConcat : {
          files : {
            src : [
              testSpecs,
              sourceFiles,
              "Gruntfile.js",
              "plugins/**/*.js"
            ]
          }
        },

      afterConcat : {
        files : {
          src : [ "<%= path.main %>" ]
        }
      }
    },

    clean : {
      dist : [
        "<%= path.main %>",
        "<%= path.min %>"
      ],
      jsdoc : [
        "build/docs",
        "build/glsl/*.glsl",
        "./docs/**/*.*",
        "./docs/scripts",
        "./docs/styles",
        "./docs/images",
        "./docs/img"
      ]
    },

    jsdoc : {
      dist : {
        src : sourceFiles.map(function (value) {
          return value.replace("src/", "build/docs/src/");
        }).concat([ "README.md" ]),
        options : {
          configure : "jsdoc_conf.json",
          destination : "docs",
          template : "tasks/jsdoc-template/template"
        }
      }
    },

    connect : {
      server : {
        options : {
          port : 8001
        }
      },

      keepalive : {
        options : {
          port : 8000,
          keepalive : true
        }
      }
    },

    copy : {
      dist : {
        expand : true,
        src : [
          "index.html",
          "build/melonjs.js",
          "build/melonjs.min.js",
          "docs/**",
          "examples/**",
          "media/logo.png",
          "plugins/**"
        ],
        dest : "dist/"
      }
    },

    buildGhPages : {
      dist : {
        options : {
          dist : "dist",
          build_branch : "gh-pages",
          exclude : [ "node_modules/" ],
          pull : true
        }
      }
    },

    karma: {
      unit: {
        configFile: "karma.conf.js",
        browsers: ["PhantomJS"] //other supported options are Chrome and ChromeHeadless
      }
    }

  });

  grunt.loadNpmTasks("grunt-contrib-clean");
  grunt.loadNpmTasks("grunt-contrib-concat");
  grunt.loadNpmTasks("grunt-contrib-connect");
  grunt.loadNpmTasks("grunt-contrib-copy");
  grunt.loadNpmTasks("grunt-eslint");
  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks("grunt-build-gh-pages");
  grunt.loadNpmTasks("grunt-jsdoc");
  grunt.loadNpmTasks("grunt-karma");
  grunt.loadNpmTasks("grunt-replace");

  // Custom Tasks
  grunt.loadTasks("tasks");

  // Default task.
  grunt.registerTask("default", [ "test", "uglify" ]);
  grunt.registerTask("build", [ "lint", "uglify" ]);
  grunt.registerTask("glsl", [ "dot:glsl", "replace:glsl" ]);
  grunt.registerTask("lint", [
    "eslint:beforeConcat",
    "glsl",
    "concat",
    "replace:dist",
    "eslint:afterConcat"
  ]);
  grunt.registerTask("doc", [ "replace:docs", "jsdoc" ]);
  grunt.registerTask("test", [ "lint", "karma" ]);
  grunt.registerTask("serve", [ "connect:keepalive" ]);
  grunt.registerTask("gh-pages", [
    "test",
    "build",
    "doc",
    "copy:dist",
    "buildGhPages:dist"
  ]);
  grunt.registerTask("release", [ "gh-pages", "dorelease" ]);
};
<|endoftext|>


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

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        banner: '/*!\n' +
            ' * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
            '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
            ' *\n' +
            ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
            ' * Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' +
            ' */\n\n',
        // Before generating any new files, remove any previously-created files.
        clean: {
            jasmine: ['build/reports/jasmine'],
            coverage: ['build/reports/coverage']
        },
        jshint: {
            options: {
                bitwise: true,
                curly: true,
                eqeqeq: true,
                forin: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                noempty: true,
                nonew: true,
                regexp: true,
                undef: true,
                unused: true,
                indent: 4,
                quotmark: 'single',
                loopfunc: true,
                browser: true,
                node: true,
                globals: {
                }
            },
            test: ['Gruntfile.js', 'lib/**/.js', 'test/**/*.js'],
            jslint: {
                options: {
                    reporter: 'jslint',
                    reporterOutput: 'build/reports/jshint.xml'
                },
                files: {
                    src: ['Gruntfile.js', 'lib/**/.js', 'test/**/*.js']
                }
            },
            checkstyle: {
                options: {
                    reporter: 'checkstyle',
                    reporterOutput: 'build/reports/jshint_checkstyle.xml'
                },
                files: {
                    src: ['Gruntfile.js', 'lib/**/.js', 'test/**/*.js']
                }
            }
        },
        bgShell: {
            coverage: {
                cmd: 'node node_modules/istanbul/lib/cli.js cover --dir build/coverage node_modules/grunt-jasmine-node/node_modules/jasmine-node/bin/jasmine-node test'
            },
            cobertura: {
                cmd: 'node node_modules/istanbul/lib/cli.js report --root build/coverage --dir build/coverage/cobertura cobertura'
            }
        },
        open: {
            file: {
                path: 'build/coverage/lcov-report/index.html'
            }
        },
        jasmine_node: {
            specNameMatcher: './*.spec', // load only specs containing specNameMatcher
            projectRoot: 'test',
            requirejs: false,
            forceExit: true,
            jUnit: {
                report: true,
                savePath: './build/reports/jasmine/',
                useDotNotation: true,
                consolidate: true
            }
        }
    });

    // Load tasks.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-jasmine-node');
    grunt.loadNpmTasks('grunt-bg-shell');
    grunt.loadNpmTasks('grunt-open');

    // Default task.
    grunt.registerTask('test', ['clean:jasmine', 'jshint:test', 'jasmine_node']);
    grunt.registerTask('cover', ['clean:coverage', 'jshint:test', 'bgShell:coverage', 'open']);
    grunt.registerTask('ci', ['clean', 'jshint:jslint', 'jshint:checkstyle', 'bgShell:coverage', 'bgShell:cobertura']);
    grunt.registerTask('default', ['test']);
};<commit_msg>fix(tests): fix error in test execution<commit_after>module.exports = function (grunt) {
    'use strict';

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        banner: '/*!\n' +
            ' * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
            '<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
            ' *\n' +
            ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
            ' * Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' +
            ' */\n\n',
        // Before generating any new files, remove any previously-created files.
        clean: {
            jasmine: ['build/reports/jasmine', 'build/tmp'],
            coverage: ['build/reports/coverage', 'build/tmp']
        },
        jshint: {
            options: {
                bitwise: true,
                curly: true,
                eqeqeq: true,
                forin: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                noempty: true,
                nonew: true,
                regexp: true,
                undef: true,
                unused: true,
                indent: 4,
                quotmark: 'single',
                loopfunc: true,
                browser: true,
                node: true,
                globals: {
                }
            },
            test: ['Gruntfile.js', 'lib/**/.js', 'test/**/*.js'],
            jslint: {
                options: {
                    reporter: 'jslint',
                    reporterOutput: 'build/reports/jshint.xml'
                },
                files: {
                    src: ['Gruntfile.js', 'lib/**/.js', 'test/**/*.js']
                }
            },
            checkstyle: {
                options: {
                    reporter: 'checkstyle',
                    reporterOutput: 'build/reports/jshint_checkstyle.xml'
                },
                files: {
                    src: ['Gruntfile.js', 'lib/**/.js', 'test/**/*.js']
                }
            }
        },
        bgShell: {
            coverage: {
                cmd: 'node node_modules/istanbul/lib/cli.js cover --dir build/coverage node_modules/grunt-jasmine-node/node_modules/jasmine-node/bin/jasmine-node -- test --forceexit'
            },
            cobertura: {
                cmd: 'node node_modules/istanbul/lib/cli.js report --root build/coverage --dir build/coverage/cobertura cobertura'
            }
        },
        open: {
            file: {
                path: 'build/coverage/lcov-report/index.html'
            }
        },
        jasmine_node: {
            specNameMatcher: './*.spec', // load only specs containing specNameMatcher
            projectRoot: 'test',
            requirejs: false,
            forceExit: true,
            jUnit: {
                report: true,
                savePath: './build/reports/jasmine/',
                useDotNotation: true,
                consolidate: true
            }
        }
    });

    // Load tasks.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-jasmine-node');
    grunt.loadNpmTasks('grunt-bg-shell');
    grunt.loadNpmTasks('grunt-open');

    // Register tasks.
    grunt.registerTask('test', ['clean:jasmine', 'jshint:test', 'jasmine_node']);
    grunt.registerTask('cover', ['clean:coverage', 'jshint:test', 'bgShell:coverage', 'open']);
    grunt.registerTask('ci', ['clean', 'jshint:jslint', 'jshint:checkstyle', 'bgShell:coverage', 'bgShell:cobertura']);

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


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

	grunt.initConfig({
		copy: {
			main: {
				src: [
					'includes/**',
					'languages/**',
					'airstory.php',
					'readme.txt',
					'uninstall.php',
					'composer.json',
					'CHANGELOG.md',
					'LICENSE.md',
				],
				dest: 'dist/'
			},
		},

		makepot: {
			target: {
				options: {
					domainPath: 'languages/',
					exclude: [
						'node_modules',
						'tests',
						'vendor'
					],
					mainFile: 'airstory.php',
					type: 'wp-plugin',
					updateTimestamp: false,
					updatePoFiles: true
				}
			}
		}
	});

	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-wp-i18n');
	grunt.loadNpmTasks('grunt-composer');

	grunt.registerTask('build', ['composer:install', 'i18n', 'copy']);
	grunt.registerTask('i18n', ['makepot']);
};
<commit_msg>Don't attempt to internationalize the dist/ directory, only the source files<commit_after>module.exports = function(grunt) {

	grunt.initConfig({
		copy: {
			main: {
				src: [
					'includes/**',
					'languages/**',
					'airstory.php',
					'readme.txt',
					'uninstall.php',
					'composer.json',
					'CHANGELOG.md',
					'LICENSE.md',
				],
				dest: 'dist/'
			},
		},

		makepot: {
			target: {
				options: {
					domainPath: 'languages/',
					exclude: [
						'dist',
						'node_modules',
						'tests',
						'vendor',
					],
					mainFile: 'airstory.php',
					type: 'wp-plugin',
					updateTimestamp: false,
					updatePoFiles: true
				}
			}
		}
	});

	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-wp-i18n');
	grunt.loadNpmTasks('grunt-composer');

	grunt.registerTask('build', ['composer:install', 'i18n', 'copy']);
	grunt.registerTask('i18n', ['makepot']);
};
<|endoftext|>


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

    grunt.initConfig({

        less: {
            production: {
                options: {
                    compress: true,
                    yuicompress: true,
                    paths: ['bower_components/bootstrap/less', 'bower_components/font-awesome/less']
                },
                files: {
                    'assets/css/bootstrap.min.css': 'bower_components/bootstrap/less/bootstrap.less',
                    'assets/css/font-awesome.min.css': 'bower_components/font-awesome/less/font-awesome.less'
                }
            }
        },
        uglify: {
            jquery: {
                files: {
                    'assets/js/jquery.min.js': 'bower_components/jquery/jquery.js'
                }
            }
        },
        copy: {
            normalize: {
                files: [
                    {expand: true, cwd: 'bower_components/normalize-css/', src: ['normalize.css'], dest: 'assets/css/'}
                ]
            },
            fontawesome: {
                files: [
                    {expand: true, cwd: 'bower_components/font-awesome/fonts/', src: ['*'], dest: 'assets/fonts/'}
                ]
            }
        },
        watch: {
            styles: {
                files: 'css/**/*',
                tasks: ['copy:styles']
            },
            images: {
                files: 'img/**/*',
                tasks: ['copy:images']
            }
        },
        concurrent: {
            dev: ['watch', 'exec:serve'],
            options: {
                logConcurrentOutput: true
            }
        },
        exec: {
            build: {
                cmd: 'jekyll build'
            },
            serve: {
                cmd: 'jekyll serve --watch'
            },
            deploy: {
                cmd: 'git push deploy master; git push origin master;'
            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-exec');

    grunt.registerTask('default', [ 'less', 'uglify', 'copy', 'exec:build' ]);
    grunt.registerTask('serve', [ 'less', 'uglify', 'copy', 'concurrent:dev' ]);
    grunt.registerTask('deploy', [ 'exec:deploy' ]);

};
<commit_msg>Cleaning up the Gruntfile to work with the reorganized assets.<commit_after>module.exports = function(grunt) {

    grunt.initConfig({

        less: {
            production: {
                options: {
                    compress: true,
                    yuicompress: true,
                    paths: ['bower_components/bootstrap/less', 'bower_components/font-awesome/less']
                },
                files: {
                    'assets/css/bootstrap.min.css': 'bower_components/bootstrap/less/bootstrap.less',
                    'assets/css/font-awesome.min.css': 'bower_components/font-awesome/less/font-awesome.less'
                }
            }
        },
        uglify: {
            jquery: {
                files: {
                    'assets/js/jquery.min.js': 'bower_components/jquery/jquery.js'
                }
            }
        },
        copy: {
            normalize: {
                files: [
                    {expand: true, cwd: 'bower_components/normalize-css/', src: ['normalize.css'], dest: 'assets/css/'}
                ]
            },
            fontawesome: {
                files: [
                    {expand: true, cwd: 'bower_components/font-awesome/fonts/', src: ['*'], dest: 'assets/fonts/'}
                ]
            }
        },
        watch: {
            styles: {
                files: 'assets/css/main.css',
                tasks: []
            }
        },
        concurrent: {
            dev: ['watch', 'exec:serve'],
            options: {
                logConcurrentOutput: true
            }
        },
        exec: {
            build: {
                cmd: 'jekyll build'
            },
            serve: {
                cmd: 'jekyll serve --watch'
            },
            deploy: {
                cmd: 'git push deploy master; git push origin master;'
            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-exec');

    grunt.registerTask('default', [ 'less', 'uglify', 'copy', 'exec:build' ]);
    grunt.registerTask('serve', [ 'less', 'uglify', 'copy', 'concurrent:dev' ]);
    grunt.registerTask('deploy', [ 'exec:deploy' ]);

};
<|endoftext|>