<commit_before>// Generated on 2013-09-19 using generator-angular 0.4.0
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({
    port: LIVERELOAD_PORT
});

var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
};

var fs = require('fs');

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

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

    // configurable paths
    var yeomanConfig = {
        app: 'app',
        dist: 'dist',
        doc: 'doc'
    };

    try {
        yeomanConfig.app = require('./bower.json').appPath || yeomanConfig.app;
    } catch (e) {}

    grunt.initConfig({
        yeoman: yeomanConfig,
        watch: {
            coffee: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
                tasks: ['coffee:dist']
            },
            coffeeTest: {
                files: ['test/spec/{,*/}*.coffee'],
                tasks: ['coffee:test']
            },
            compass: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
                tasks: ['compass:server', 'autoprefixer']
            },
            styles: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.css',
                       '<%= yeoman.app %>/styles/images'],
                tasks: ['copy:styles', 'autoprefixer']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '<%= yeoman.app %>/**/*.html',
                    '{.tmp,<%= yeoman.app %>}/styles/**/*.css',
                    '{.tmp,<%= yeoman.app %>}/scripts/**/*.js',
                    '{.tmp,<%= yeoman.app %>}/configuration/**/*.json',
                    '<%= yeoman.app %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            },
            karma: {
                files: ['app/scripts/**/*.js', 'test/unit/**/*.js'],
                tasks: ['karma:unit:run']
            },
            doc: {
                files: ['{.tmp,<%= yeoman.app %>}/scripts/**/*.js'],
                tasks: ['docular', 'open:doc']
            }
        },
        autoprefixer: {
            options: ['last 1 version'],
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },
        connect: {
            options: {
                port: 9000,
                // Change this to '0.0.0.0' to access the server from outside.
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [function (request, response, next) {
                                if (request.url.indexOf('/api') !== -1) {
                                    setTimeout(function () {
                                        next();
                                    }, 1000);
                                } else {
                                    next();
                                }
                            },
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app),
                            function (request, response, next) {

                                console.log("request method: " + JSON.stringify(request.method));
                                var rawpath = request.url.split('?')[0];
                                console.log("request url: " + JSON.stringify(request.url));
                                var path = require('path').resolve(__dirname, 'app/' + rawpath);

                                console.log("request path : " + JSON.stringify(path));

                                console.log("request current dir : " + JSON.stringify(__dirname));

                                if ((request.method === 'PUT' || request.method === 'POST')) {

                                    console.log('inside put/post');

                                    request.content = '';

                                    request.addListener("data", function (chunk) {
                                        request.content += chunk;
                                    });

                                    request.addListener("end", function () {
                                        console.log("request content: " + JSON.stringify(request.content));

                                        if (fs.existsSync(path)) {

                                            fs.writeFile(path, request.content, function (err) {
                                                if (err) {
                                                    throw err;
                                                }
                                                console.log('file saved');
                                                response.end('file was saved');
                                            });
                                            return;
                                        }

                                        if (request.url === '/log') {

                                            var filePath = 'server/log/server.log';

                                            var logData = JSON.parse(request.content);

                                            fs.appendFile(filePath, logData.logUrl + '\n' + logData.logMessage + '\n', function (err) {
                                                if (err) {
                                                    throw err;
                                                }
                                                console.log('log saved');
                                                response.end('log was saved');
                                            });
                                            return;
                                        }
                                    });
                                    return;
                                }
                                next();
                            }];
                    }
                }
            },
            test: {
                options: {
                    middleware: function (connect) {
                        return [mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app),
                            mountFolder(connect, 'test')];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [mountFolder(connect, yeomanConfig.dist)];
                    }
                }
            },
            doc: {
                options: {
                    port: 3000,
                    middleware: function (connect) {
                        return [mountFolder(connect, yeomanConfig.doc)];
                    }
                }
            }
        },
        open: {
            server: {
                url: 'http://localhost:<%= connect.options.port %>'
            },
            doc: {
                url: 'http://appverse.gftlabs.com:3000'
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.app %>/scripts/{,*/}*.js'
            ]
        },
        coffee: {
            options: {
                sourceMap: true,
                sourceRoot: ''
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/scripts',
                    src: '{,*/}*.coffee',
                    dest: '.tmp/scripts',
                    ext: '.js'
                }]
            },
            test: {
                files: [{
                    expand: true,
                    cwd: 'test/spec',
                    src: '{,*/}*.coffee',
                    dest: '.tmp/spec',
                    ext: '.js'
                }]
            }
        },
        compass: {
            options: {
                sassDir: '<%= yeoman.app %>/styles',
                cssDir: '.tmp/styles',
                generatedImagesDir: '.tmp/images/generated',
                imagesDir: '<%= yeoman.app %>/images',
                javascriptsDir: '<%= yeoman.app %>/scripts',
                fontsDir: '<%= yeoman.app %>/styles/fonts',
                importPath: '<%= yeoman.app %>/bower_components',
                httpImagesPath: '/images',
                httpGeneratedImagesPath: '/images/generated',
                httpFontsPath: '/styles/fonts',
                relativeAssets: false
            },
            dist: {},
            server: {
                options: {
                    debugInfo: true
                }
            }
        },
        // not used since Uglify task does concat,
        // but still available if needed
        /*concat: {
      dist: {}
    },*/
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
                        '<%= yeoman.dist %>/styles/fonts/*'
                    ]
                }
            }
        },
        useminPrepare: {
            html: '<%= yeoman.app %>/index.html',
            options: {
                dest: '<%= yeoman.dist %>'
            }
        },
        usemin: {
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
            options: {
                dirs: ['<%= yeoman.dist %>']
            }
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        cssmin: {
            // By default, your `index.html` <!-- Usemin Block --> will take care of
            // minification. This option is pre-configured if you do not wish to use
            // Usemin blocks.
            // dist: {
            //   files: {
            //     '<%= yeoman.dist %>/styles/main.css': [
            //       '.tmp/styles/{,*/}*.css',
            //       '<%= yeoman.app %>/styles/{,*/}*.css'
            //     ]
            //   }
            // }
        },
        htmlmin: {
            dist: {
                options: {
                    /*removeCommentsFromCDATA: true,
          // https://github.com/yeoman/grunt-usemin/issues/44
          //collapseWhitespace: true,
          collapseBooleanAttributes: true,
          removeAttributeQuotes: true,
          removeRedundantAttributes: true,
          useShortDoctype: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true*/
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    src: ['*.html', 'views/**/*.*', 'template/**/*.html'],
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },
        // Put files not handled in other tasks here
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,png,txt}',
                        '.htaccess',
                        'api/**',
                        'bower_components/angular-touch/angular-touch.js',
                        'bower_components/angular-animate/angular-animate.js',
                        'bower_components/angular-route/angular-route.js',
                        'scripts/api/angular-jqm.js',
                        'images/{,*/}*.{gif,webp}',
                        'resources/**',
                        'styles/fonts/*',
                        'styles/images/*'
                    ]
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: [
                        'generated/*'
                    ]
                }, {
                    expand: true,
                    cwd: '<%= yeoman.app %>/bower_components/angular-i18n',
                    dest: '<%= yeoman.dist %>/resources/i18n/angular',
                    src: [
                        '*.js'
                    ]
                }]
            },
            styles: {
                expand: true,
                cwd: '<%= yeoman.app %>/styles',
                dest: '.tmp/styles',
                src: '{,*/}*.css'
            },
            i18n: {
                expand: true,
                cwd: '<%= yeoman.app %>/bower_components/angular-i18n',
                dest: '.tmp/resources/i18n/angular',
                src: '*.js'
            }
        },
        concurrent: {
            server: [
                'coffee:dist',
                'compass:server',
                'copy:styles',
                'copy:i18n'
            ],
            test: [
                'coffee',
                'compass',
                'copy:styles',
                'copy:i18n'
            ],
            dist: [
                'coffee',
                'compass:dist',
                'copy:styles',
                'imagemin',
                'svgmin',
                'htmlmin'
            ]
        },
        karma: {
            unit: {
                configFile: 'karma.conf.js',
                background: true
            }
        },
        cdnify: {
            dist: {
                html: ['<%= yeoman.dist %>/*.html']
            }
        },
        ngmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.dist %>/scripts',
                    src: '*.js',
                    dest: '<%= yeoman.dist %>/scripts'
                }]
            }
        },
        uglify: {
            dist: {
                files: {
                    '<%= yeoman.dist %>/scripts/scripts.js': [
                        '<%= yeoman.dist %>/scripts/scripts.js'
                    ]
                }
            }
        },
        docular: {
            showDocularDocs: false,
            showAngularDocs: true,
            docular_webapp_target: "doc",
            groups: [
                {
                    groupTitle: 'Appverse HTML5',
                    groupId: 'appverse',
                    groupIcon: 'icon-beer',
                    sections: [
                        {
                            id: "commonapi",
                            title: "Common API",
                            showSource: true,
                            scripts: ["app/scripts/api/modules", "app/scripts/api/directives"
                            ],
                            docs: ["ngdocs/commonapi"],
                            rank: {}
                        }
                    ]
                }, {
                    groupTitle: 'Angular jQM',
                    groupId: 'angular-jqm',
                    groupIcon: 'icon-mobile-phone',
                    sections: [
                        {
                            id: "jqmapi",
                            title: "API",
                            showSource: true,
                            scripts: ["app/scripts/api/angular-jqm.js"
                            ],
                            docs: ["ngdocs/jqmapi"],
                            rank: {}
                        }
                    ]
                }
            ]
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-docular');

    grunt.registerTask('server', function (target) {
//        if (target === 'dist') {
//            return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
//        }

        grunt.task.run([
            'clean:server',
            'concurrent:server',
            'autoprefixer',
            'connect:livereload',
            'open:server',
            'watch'
        ]);
    });

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

    grunt.registerTask('devmode', [
        'karma:unit',
        'watch:karma'
    ]);

    grunt.registerTask('doc', [
        'docular',
        'connect:doc',
        'open:doc',
        'watch:doc'
    ]);

    grunt.registerTask('dist', [
        'clean:dist',
        'useminPrepare',
        'concurrent:dist',
        'autoprefixer',
        'concat',
        'copy:dist',
        'cdnify',
        'ngmin',
        'cssmin',
        'uglify',
        'rev',
        'usemin',
        'connect:dist',
        'docular',
        //'connect:doc',
        //'open:server',
        //'open:doc',
        //'watch'
    ]);

    grunt.registerTask('default', [
        'jshint',
        'test',
        'build'
    ]);
};<commit_msg>Changed domain in connect task for deployment purposes<commit_after>// Generated on 2013-09-19 using generator-angular 0.4.0
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({
    port: LIVERELOAD_PORT
});

var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
};

var fs = require('fs');

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

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

    // configurable paths
    var yeomanConfig = {
        app: 'app',
        dist: 'dist',
        doc: 'doc'
    };

    try {
        yeomanConfig.app = require('./bower.json').appPath || yeomanConfig.app;
    } catch (e) {}

    grunt.initConfig({
        yeoman: yeomanConfig,
        watch: {
            coffee: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
                tasks: ['coffee:dist']
            },
            coffeeTest: {
                files: ['test/spec/{,*/}*.coffee'],
                tasks: ['coffee:test']
            },
            compass: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
                tasks: ['compass:server', 'autoprefixer']
            },
            styles: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.css',
                       '<%= yeoman.app %>/styles/images'],
                tasks: ['copy:styles', 'autoprefixer']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '<%= yeoman.app %>/**/*.html',
                    '{.tmp,<%= yeoman.app %>}/styles/**/*.css',
                    '{.tmp,<%= yeoman.app %>}/scripts/**/*.js',
                    '{.tmp,<%= yeoman.app %>}/configuration/**/*.json',
                    '<%= yeoman.app %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            },
            karma: {
                files: ['app/scripts/**/*.js', 'test/unit/**/*.js'],
                tasks: ['karma:unit:run']
            },
            doc: {
                files: ['{.tmp,<%= yeoman.app %>}/scripts/**/*.js'],
                tasks: ['docular', 'open:doc']
            }
        },
        autoprefixer: {
            options: ['last 1 version'],
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },
        connect: {
            options: {
                port: 9000,
                // Change this to '0.0.0.0' to access the server from outside.
                //hostname: 'localhost'
                hostname: '0.0.0.0'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [function (request, response, next) {
                                if (request.url.indexOf('/api') !== -1) {
                                    setTimeout(function () {
                                        next();
                                    }, 1000);
                                } else {
                                    next();
                                }
                            },
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app),
                            function (request, response, next) {

                                console.log("request method: " + JSON.stringify(request.method));
                                var rawpath = request.url.split('?')[0];
                                console.log("request url: " + JSON.stringify(request.url));
                                var path = require('path').resolve(__dirname, 'app/' + rawpath);

                                console.log("request path : " + JSON.stringify(path));

                                console.log("request current dir : " + JSON.stringify(__dirname));

                                if ((request.method === 'PUT' || request.method === 'POST')) {

                                    console.log('inside put/post');

                                    request.content = '';

                                    request.addListener("data", function (chunk) {
                                        request.content += chunk;
                                    });

                                    request.addListener("end", function () {
                                        console.log("request content: " + JSON.stringify(request.content));

                                        if (fs.existsSync(path)) {

                                            fs.writeFile(path, request.content, function (err) {
                                                if (err) {
                                                    throw err;
                                                }
                                                console.log('file saved');
                                                response.end('file was saved');
                                            });
                                            return;
                                        }

                                        if (request.url === '/log') {

                                            var filePath = 'server/log/server.log';

                                            var logData = JSON.parse(request.content);

                                            fs.appendFile(filePath, logData.logUrl + '\n' + logData.logMessage + '\n', function (err) {
                                                if (err) {
                                                    throw err;
                                                }
                                                console.log('log saved');
                                                response.end('log was saved');
                                            });
                                            return;
                                        }
                                    });
                                    return;
                                }
                                next();
                            }];
                    }
                }
            },
            test: {
                options: {
                    middleware: function (connect) {
                        return [mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app),
                            mountFolder(connect, 'test')];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [mountFolder(connect, yeomanConfig.dist)];
                    }
                }
            },
            doc: {
                options: {
                    port: 3000,
                    middleware: function (connect) {
                        return [mountFolder(connect, yeomanConfig.doc)];
                    }
                }
            }
        },
        open: {
            server: {
                url: 'http://localhost:<%= connect.options.port %>'
            },
            doc: {
                url: 'http://appverse.gftlabs.com:3000'
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.app %>/scripts/{,*/}*.js'
            ]
        },
        coffee: {
            options: {
                sourceMap: true,
                sourceRoot: ''
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/scripts',
                    src: '{,*/}*.coffee',
                    dest: '.tmp/scripts',
                    ext: '.js'
                }]
            },
            test: {
                files: [{
                    expand: true,
                    cwd: 'test/spec',
                    src: '{,*/}*.coffee',
                    dest: '.tmp/spec',
                    ext: '.js'
                }]
            }
        },
        compass: {
            options: {
                sassDir: '<%= yeoman.app %>/styles',
                cssDir: '.tmp/styles',
                generatedImagesDir: '.tmp/images/generated',
                imagesDir: '<%= yeoman.app %>/images',
                javascriptsDir: '<%= yeoman.app %>/scripts',
                fontsDir: '<%= yeoman.app %>/styles/fonts',
                importPath: '<%= yeoman.app %>/bower_components',
                httpImagesPath: '/images',
                httpGeneratedImagesPath: '/images/generated',
                httpFontsPath: '/styles/fonts',
                relativeAssets: false
            },
            dist: {},
            server: {
                options: {
                    debugInfo: true
                }
            }
        },
        // not used since Uglify task does concat,
        // but still available if needed
        /*concat: {
      dist: {}
    },*/
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
                        '<%= yeoman.dist %>/styles/fonts/*'
                    ]
                }
            }
        },
        useminPrepare: {
            html: '<%= yeoman.app %>/index.html',
            options: {
                dest: '<%= yeoman.dist %>'
            }
        },
        usemin: {
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
            options: {
                dirs: ['<%= yeoman.dist %>']
            }
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        cssmin: {
            // By default, your `index.html` <!-- Usemin Block --> will take care of
            // minification. This option is pre-configured if you do not wish to use
            // Usemin blocks.
            // dist: {
            //   files: {
            //     '<%= yeoman.dist %>/styles/main.css': [
            //       '.tmp/styles/{,*/}*.css',
            //       '<%= yeoman.app %>/styles/{,*/}*.css'
            //     ]
            //   }
            // }
        },
        htmlmin: {
            dist: {
                options: {
                    /*removeCommentsFromCDATA: true,
          // https://github.com/yeoman/grunt-usemin/issues/44
          //collapseWhitespace: true,
          collapseBooleanAttributes: true,
          removeAttributeQuotes: true,
          removeRedundantAttributes: true,
          useShortDoctype: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true*/
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    src: ['*.html', 'views/**/*.*', 'template/**/*.html'],
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },
        // Put files not handled in other tasks here
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,png,txt}',
                        '.htaccess',
                        'api/**',
                        'bower_components/angular-touch/angular-touch.js',
                        'bower_components/angular-animate/angular-animate.js',
                        'bower_components/angular-route/angular-route.js',
                        'scripts/api/angular-jqm.js',
                        'images/{,*/}*.{gif,webp}',
                        'resources/**',
                        'styles/fonts/*',
                        'styles/images/*'
                    ]
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: [
                        'generated/*'
                    ]
                }, {
                    expand: true,
                    cwd: '<%= yeoman.app %>/bower_components/angular-i18n',
                    dest: '<%= yeoman.dist %>/resources/i18n/angular',
                    src: [
                        '*.js'
                    ]
                }]
            },
            styles: {
                expand: true,
                cwd: '<%= yeoman.app %>/styles',
                dest: '.tmp/styles',
                src: '{,*/}*.css'
            },
            i18n: {
                expand: true,
                cwd: '<%= yeoman.app %>/bower_components/angular-i18n',
                dest: '.tmp/resources/i18n/angular',
                src: '*.js'
            }
        },
        concurrent: {
            server: [
                'coffee:dist',
                'compass:server',
                'copy:styles',
                'copy:i18n'
            ],
            test: [
                'coffee',
                'compass',
                'copy:styles',
                'copy:i18n'
            ],
            dist: [
                'coffee',
                'compass:dist',
                'copy:styles',
                'imagemin',
                'svgmin',
                'htmlmin'
            ]
        },
        karma: {
            unit: {
                configFile: 'karma.conf.js',
                background: true
            }
        },
        cdnify: {
            dist: {
                html: ['<%= yeoman.dist %>/*.html']
            }
        },
        ngmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.dist %>/scripts',
                    src: '*.js',
                    dest: '<%= yeoman.dist %>/scripts'
                }]
            }
        },
        uglify: {
            dist: {
                files: {
                    '<%= yeoman.dist %>/scripts/scripts.js': [
                        '<%= yeoman.dist %>/scripts/scripts.js'
                    ]
                }
            }
        },
        docular: {
            showDocularDocs: false,
            showAngularDocs: true,
            docular_webapp_target: "doc",
            groups: [
                {
                    groupTitle: 'Appverse HTML5',
                    groupId: 'appverse',
                    groupIcon: 'icon-beer',
                    sections: [
                        {
                            id: "commonapi",
                            title: "Common API",
                            showSource: true,
                            scripts: ["app/scripts/api/modules", "app/scripts/api/directives"
                            ],
                            docs: ["ngdocs/commonapi"],
                            rank: {}
                        }
                    ]
                }, {
                    groupTitle: 'Angular jQM',
                    groupId: 'angular-jqm',
                    groupIcon: 'icon-mobile-phone',
                    sections: [
                        {
                            id: "jqmapi",
                            title: "API",
                            showSource: true,
                            scripts: ["app/scripts/api/angular-jqm.js"
                            ],
                            docs: ["ngdocs/jqmapi"],
                            rank: {}
                        }
                    ]
                }
            ]
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-docular');

    grunt.registerTask('server', function (target) {
//        if (target === 'dist') {
//            return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
//        }

        grunt.task.run([
            'clean:server',
            'concurrent:server',
            'autoprefixer',
            'connect:livereload',
            'open:server',
            'watch'
        ]);
    });

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

    grunt.registerTask('devmode', [
        'karma:unit',
        'watch:karma'
    ]);

    grunt.registerTask('doc', [
        'docular',
        'connect:doc',
        'open:doc',
        'watch:doc'
    ]);

    grunt.registerTask('dist', [
        'clean:dist',
        'useminPrepare',
        'concurrent:dist',
        'autoprefixer',
        'concat',
        'copy:dist',
        'cdnify',
        'ngmin',
        'cssmin',
        'uglify',
        'rev',
        'usemin',
        'connect:dist',
        'docular',
        //'connect:doc',
        //'open:server',
        //'open:doc',
        //'watch'
    ]);

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


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      files: ['index.js', 'Gruntfile.js', 'lib/**/*.js', 'spec/**/*.js']
    },
    uglify: {
      options: {
        banner: '/*! <= % pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
        report: 'gzip'
      },
      schemaValidator: {
        src: 'lib/<%= pkg.name %>.js',
        dest: 'build/<%= pkg.name %>.min.js'
      }
    },
    mochaTest: {
      test: {
        src: 'test/**/*.js',
        options: {
          reporter: 'spec'
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.registerTask('travis', ['jshint', 'mochaTest']);
  grunt.registerTask('default', ['jshint', 'uglify', 'mochaTest']);
};
<commit_msg>Changed ordering of tests.<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      files: ['index.js', 'Gruntfile.js', 'lib/**/*.js', 'spec/**/*.js']
    },
    uglify: {
      options: {
        banner: '/*! <= % pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
        report: 'gzip'
      },
      schemaValidator: {
        src: 'lib/<%= pkg.name %>.js',
        dest: 'build/<%= pkg.name %>.min.js'
      }
    },
    mochaTest: {
      test: {
        src: 'test/**/*.js',
        options: {
          reporter: 'spec'
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.registerTask('travis', ['jshint', 'mochaTest']);
  grunt.registerTask('default', ['jshint', 'mochaTest', 'uglify']);
};
<|endoftext|>


<commit_before>const { expect } = require('chai');
const { BadRequest } = require('@feathersjs/errors');
const mockery = require('mockery');

const {
	TSPBaseSyncer,
	SYNCER_TARGET,
} = require('../../../../../src/services/sync/strategies/TSP/TSPBaseSyncer');

describe.only('TSPBaseSyncer', () => {
	it('implements the Syncer interface', () => {
		expect(TSPBaseSyncer.params).to.not.equal(undefined);
		expect(TSPBaseSyncer.respondsTo).to.not.equal(undefined);
		expect(TSPBaseSyncer.aggregateStats).to.not.equal(undefined);
	});

	describe('repondsTo', () => {
		it('should accept the exported syncer target', () => {
			expect(TSPBaseSyncer.respondsTo(SYNCER_TARGET)).to.equal(true);
		});
	});

	describe('params', () => {
		it('should not accept empty params and data', () => {
			try {
				TSPBaseSyncer.params(undefined, undefined);
				throw new Error('The previous call should have failed.');
			} catch (err) {
				expect(err).to.be.instanceOf(BadRequest);
			}
		});

		it('should accept valid config objects via params.query or data', () => {
			const config = { baseUrl: 'http://example.com', clientId: 'foobar42' };
			expect(TSPBaseSyncer.params({ query: { config } })).to.deep.equal([config]);
			expect(TSPBaseSyncer.params(undefined, { config })).to.deep.equal([config]);
		});

		it('should not accept incomplete config objects', () => {
			try {
				TSPBaseSyncer.params(undefined, { config: { clientId: 'foobar42' } });
				throw new Error('The previous call should have failed.');
			} catch (err) {
				expect(err).to.be.instanceOf(BadRequest);
				expect(/(?=.*missing)(?=.*parameter)(?=.*baseUrl)/i.test(err.message)).to.equal(true);
			}
			try {
				TSPBaseSyncer.params(undefined, { config: { baseUrl: 'http://schul-cloud.org' } });
				throw new Error('The previous call should have failed.');
			} catch (err) {
				expect(err).to.be.instanceOf(BadRequest);
				expect(/(?=.*missing)(?=.*parameter)(?=.*clientId)/i.test(err.message)).to.equal(true);
			}
		});
	});

	describe('getSchools', () => {
		const MOCK_SCHOOLS = [
			{ schuleNummer: 42, schuleName: 'Douglas Adams Gymnasium' },
			{ schuleNummer: 3000, schuleName: 'Mars-Universität' },
		];
		const TSPAPIMock = function TSPAPIMock() {
			this.request = (url) => {
				if (url === '/tip-ms/api/schulverwaltung_export_schule') {
					return MOCK_SCHOOLS;
				}
				throw new Error('Unknown request URL');
			};
		};

		let TSPBaseSyncerWithMockedApi;

		before(() => {
			mockery.enable({
				useCleanCache: true,
				warnOnUnregistered: false,
			});
			mockery.registerMock('./TSP', { TspApi: TSPAPIMock });
			// eslint-disable-next-line global-require, max-len
			TSPBaseSyncerWithMockedApi = require('../../../../../src/services/sync/strategies/TSP/TSPBaseSyncer').TSPBaseSyncer;
		});

		after(() => {
			mockery.deregisterAll();
			mockery.disable();
		});

		it('should return schools fetched from the TSP API', async () => {
			const syncer = new TSPBaseSyncerWithMockedApi();
			expect(await syncer.getSchools()).to.equal(MOCK_SCHOOLS);
		});
	});
});
<commit_msg>Remove .only<commit_after>const { expect } = require('chai');
const { BadRequest } = require('@feathersjs/errors');
const mockery = require('mockery');

const {
	TSPBaseSyncer,
	SYNCER_TARGET,
} = require('../../../../../src/services/sync/strategies/TSP/TSPBaseSyncer');

describe('TSPBaseSyncer', () => {
	it('implements the Syncer interface', () => {
		expect(TSPBaseSyncer.params).to.not.equal(undefined);
		expect(TSPBaseSyncer.respondsTo).to.not.equal(undefined);
		expect(TSPBaseSyncer.aggregateStats).to.not.equal(undefined);
	});

	describe('repondsTo', () => {
		it('should accept the exported syncer target', () => {
			expect(TSPBaseSyncer.respondsTo(SYNCER_TARGET)).to.equal(true);
		});
	});

	describe('params', () => {
		it('should not accept empty params and data', () => {
			try {
				TSPBaseSyncer.params(undefined, undefined);
				throw new Error('The previous call should have failed.');
			} catch (err) {
				expect(err).to.be.instanceOf(BadRequest);
			}
		});

		it('should accept valid config objects via params.query or data', () => {
			const config = { baseUrl: 'http://example.com', clientId: 'foobar42' };
			expect(TSPBaseSyncer.params({ query: { config } })).to.deep.equal([config]);
			expect(TSPBaseSyncer.params(undefined, { config })).to.deep.equal([config]);
		});

		it('should not accept incomplete config objects', () => {
			try {
				TSPBaseSyncer.params(undefined, { config: { clientId: 'foobar42' } });
				throw new Error('The previous call should have failed.');
			} catch (err) {
				expect(err).to.be.instanceOf(BadRequest);
				expect(/(?=.*missing)(?=.*parameter)(?=.*baseUrl)/i.test(err.message)).to.equal(true);
			}
			try {
				TSPBaseSyncer.params(undefined, { config: { baseUrl: 'http://schul-cloud.org' } });
				throw new Error('The previous call should have failed.');
			} catch (err) {
				expect(err).to.be.instanceOf(BadRequest);
				expect(/(?=.*missing)(?=.*parameter)(?=.*clientId)/i.test(err.message)).to.equal(true);
			}
		});
	});

	describe('getSchools', () => {
		const MOCK_SCHOOLS = [
			{ schuleNummer: 42, schuleName: 'Douglas Adams Gymnasium' },
			{ schuleNummer: 3000, schuleName: 'Mars-Universität' },
		];
		const TSPAPIMock = function TSPAPIMock() {
			this.request = (url) => {
				if (url === '/tip-ms/api/schulverwaltung_export_schule') {
					return MOCK_SCHOOLS;
				}
				throw new Error('Unknown request URL');
			};
		};

		let TSPBaseSyncerWithMockedApi;

		before(() => {
			mockery.enable({
				useCleanCache: true,
				warnOnUnregistered: false,
			});
			mockery.registerMock('./TSP', { TspApi: TSPAPIMock });
			// eslint-disable-next-line global-require, max-len
			TSPBaseSyncerWithMockedApi = require('../../../../../src/services/sync/strategies/TSP/TSPBaseSyncer').TSPBaseSyncer;
		});

		after(() => {
			mockery.deregisterAll();
			mockery.disable();
		});

		it('should return schools fetched from the TSP API', async () => {
			const syncer = new TSPBaseSyncerWithMockedApi();
			expect(await syncer.getSchools()).to.equal(MOCK_SCHOOLS);
		});
	});
});
<|endoftext|>


<commit_before>/*global module:false*/

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

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

    /* Project configuration */
    grunt.initConfig({
        jshint: {
            options: {
                jshintrc    : '.jshintrc',
                jshintignore: '.jshintignore'
            },
            server: {
                /*
                   TODO add option "devel: true" for production linting

                   This option defines globals that are usually used for
                   logging poor-man's debugging: console, alert, etc.
                   It is usually a good idea to not ship them in production because,
                   for example, console.log breaks in legacy versions of Internet Explorer.

                   http://www.jshint.com/docs/options/#devel
                 */
                options: {
                    ignores: [
                        'lib/client/system'
                    ]
                },
                files: {
                    src: [
                        'Gruntfile.js',
                        'test/**/*.js',
                        'lib/**/*.js'
                    ]
                }
            },
            client: {
                options: {
                    browser: true,
                    node   : false,
                    ignores: []
                },
                files: {
                    src: [
                        'lib/client/system/**/*.js'
                    ]
                }
            },
            test: {
                options: {
                    ignores: ['test/fixtures']
                },
                files: {
                    src: [
                        'test/unit/**/*.js'
                    ]
                }
            }
        },
        mochaTest: {
            src: [
                'test/unit/**/*.test.js',
            ],
            options: {
                reporter: 'spec'
            }
        }
    });

    grunt.registerTask('default', 'Default task which runs all the required subtasks', ['jshint', 'test']);
    grunt.registerTask('test', 'Test everything', ['mochaTest']);
}<commit_msg>Fixed Grunt's jshint tasks to be able to merge options, according to https://github.com/gruntjs/grunt-contrib-jshint/pull/24#issuecomment-14976842<commit_after>/*global module:false*/

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

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

    /*
        Project configuration
        According to https://github.com/gruntjs/grunt-contrib-jshint/pull/24#issuecomment-14976842
        jshint options could not be merged with .jshintrc
        so we need to use

        options: grunt.util._.merge({}, grunt.file.readJSON('.jshintrc')),

        to merge the required options

    */
    grunt.initConfig({
        jshint: {
            server: {
                /*
                   TODO add option "devel: true" for production linting

                   This option defines globals that are usually used for
                   logging poor-man's debugging: console, alert, etc.
                   It is usually a good idea to not ship them in production because,
                   for example, console.log breaks in legacy versions of Internet Explorer.

                   http://www.jshint.com/docs/options/#devel
                 */
                options: grunt.util._.merge({
                    ignores: [
                        'lib/client/system/libs/*',
                        'lib/client/system/modules/*',
                        'lib/websocket/transports/engineio/*',
                        'test/fixtures/project/client/code/libs/*'
                    ]
                }, grunt.file.readJSON('.jshintrc')),
                files: {
                    src: [
                        'Gruntfile.js',
                        'test/**/*.js',
                        'lib/**/*.js',
                        'lib/websocket/transports/engineio/index.js'
                    ]
                }
            },
            client: {
                options: grunt.util._.merge({
                    browser: true,
                    node   : false,
                    ignores: [
                        'lib/client/system/libs/*',
                        'lib/client/system/index.js'
                    ]
                }, grunt.file.readJSON('.jshintrc')),
                files: {
                    src: [
                        'lib/client/system/**/*.js'
                    ]
                }
            },
            test: {
                options: {
                    ignores: ['test/fixtures']
                },
                files: {
                    src: [
                        'test/unit/**/*.js'
                    ]
                }
            }
        },
        mochaTest: {
            src: [
                'test/unit/**/*.test.js',
            ],
            options: {
                reporter: 'spec'
            }
        }
    });

    grunt.registerTask('default', 'Default task which runs all the required subtasks', ['jshint', 'test']);
    grunt.registerTask('test', 'Test everything', ['mochaTest']);
}<|endoftext|>


<commit_before>/* global module:false */
module.exports = function(grunt) {
	var srcFiles = ['src/Init.js', 'src/util.js', 'src/Sca.js', 'src/Key.js', 'src/Event.js', 'src/IDBRequest.js', 'src/IDBKeyRange.js', 'src/IDBCursor.js', 'src/IDBIndex.js', 'src/IDBObjectStore.js', 'src/IDBTransaction.js', 'src/IDBDatabase.js', 'src/shimIndexedDB.js', 'src/globalVars.js'];
	// Project configuration.
	var saucekey = null;
	if (typeof process.env.saucekey !== "undefined") {
		saucekey = process.env.saucekey;
	}
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		concat: {
			dist: {
				src: srcFiles,
				dest: 'dist/<%= pkg.name%>.js'
			}
		},
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */\n',
				sourceMap: 'dist/<%=pkg.name%>.min.map',
				sourceMapRoot: 'http://nparashuram.com/IndexedDBShim/',
				sourceMappingURL: 'http://nparashuram.com/IndexedDBShim/dist/<%=pkg.name%>.min.map'
			},
			all: {
				src: srcFiles,
				dest: 'dist/<%=pkg.name%>.min.js',
			}
		},
		connect: {
			server: {
				options: {
					base: '.',
					port: 9999
				}
			}
		},
		qunit: {
			all: ['http://localhost:9999/test/index.html']
		},

		'saucelabs-qunit': {
			all: {
				options : {
					username: 'indexeddbshim',
					key: saucekey,
					tags: ['master'],
					urls: ['http://127.0.0.1:9999/test/index.html'],
					browsers: [{
						browserName: 'safari',
						platform: 'Windows 2008',
						version: '5'
					}, {
						browserName: 'opera',
						version: '12'
					}]
				}
			}
		},

		jshint: {
			files: ['grunt.js', 'src/**/*.js', 'test/**/*.js'],
			options: {
				jshintrc: '.jshintrc'
			}
		},
		watch: {
			dev: {
				files: ["src/*"],
				tasks: ["jshint", "concat"]
			}
		}
	});

	for (var key in grunt.file.readJSON('package.json').devDependencies) {
		if (key !== 'grunt' && key.indexOf('grunt') === 0) grunt.loadNpmTasks(key);
	}

	grunt.registerTask("publish", "Publish to gh-pages", function() {
		var done = this.async();
		console.log("Running publish action");
		var request = require("request");
		request("https://api.travis-ci.org/repos/axemclion/IndexedDBShim/builds.json", function(err, res, body) {
			var commit = JSON.parse(body)[0];
			var commitMessage = ["Commit from Travis Build #", commit.number, "\nBuild - https://travis-ci.org/axemclion/IndexedDBShim/builds/", commit.id, "\nBranch : ", commit.branch, "@ ", commit.commit];
			console.log("Got Travis Build details");
			request({
				url: "https://api.github.com/repos/axemclion/IndexedDBShim/merges?access_token=" + process.env.githubtoken,
				method: "POST",
				body: JSON.stringify({
					"base": "gh-pages",
					"head": "master",
					"commit_message": commitMessage.join("")
				})
			}, function(err, response, body) {
				console.log(body);
				done(!err);
			});
		});
	});

	grunt.registerTask('build', ['jshint', 'concat', 'uglify']);
	var testJobs = ["build", "connect"];
	if (saucekey !== null) {
		testJobs.push("saucelabs-qunit");
	}

	if (process.env.CI && process.env.TRAVIS) {
		testJobs.push("publish");
	}
	grunt.registerTask('test', testJobs);

	grunt.registerTask('default', 'build');
	grunt.registerTask('dev', ['build', 'connect', 'watch']);
};<commit_msg>Added travis user agent for github publish<commit_after>/* global module:false */
module.exports = function(grunt) {
	var srcFiles = ['src/Init.js', 'src/util.js', 'src/Sca.js', 'src/Key.js', 'src/Event.js', 'src/IDBRequest.js', 'src/IDBKeyRange.js', 'src/IDBCursor.js', 'src/IDBIndex.js', 'src/IDBObjectStore.js', 'src/IDBTransaction.js', 'src/IDBDatabase.js', 'src/shimIndexedDB.js', 'src/globalVars.js'];
	// Project configuration.
	var saucekey = null;
	if (typeof process.env.saucekey !== "undefined") {
		saucekey = process.env.saucekey;
	}
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		concat: {
			dist: {
				src: srcFiles,
				dest: 'dist/<%= pkg.name%>.js'
			}
		},
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */\n',
				sourceMap: 'dist/<%=pkg.name%>.min.map',
				sourceMapRoot: 'http://nparashuram.com/IndexedDBShim/',
				sourceMappingURL: 'http://nparashuram.com/IndexedDBShim/dist/<%=pkg.name%>.min.map'
			},
			all: {
				src: srcFiles,
				dest: 'dist/<%=pkg.name%>.min.js',
			}
		},
		connect: {
			server: {
				options: {
					base: '.',
					port: 9999
				}
			}
		},
		qunit: {
			all: ['http://localhost:9999/test/index.html']
		},

		'saucelabs-qunit': {
			all: {
				options: {
					username: 'indexeddbshim',
					key: saucekey,
					tags: ['master'],
					urls: ['http://127.0.0.1:9999/test/index.html'],
					browsers: [{
							browserName: 'safari',
							platform: 'Windows 2008',
							version: '5'
						}, {
							browserName: 'opera',
							version: '12'
						}
					]
				}
			}
		},

		jshint: {
			files: ['grunt.js', 'src/**/*.js', 'test/**/*.js'],
			options: {
				jshintrc: '.jshintrc'
			}
		},
		watch: {
			dev: {
				files: ["src/*"],
				tasks: ["jshint", "concat"]
			}
		}
	});

	for (var key in grunt.file.readJSON('package.json').devDependencies) {
		if (key !== 'grunt' && key.indexOf('grunt') === 0) grunt.loadNpmTasks(key);
	}

	grunt.registerTask("publish", "Publish to gh-pages", function() {
		var done = this.async();
		console.log("Running publish action");
		var request = require("request");
		request("https://api.travis-ci.org/repos/axemclion/IndexedDBShim/builds.json", function(err, res, body) {
			var commit = JSON.parse(body)[0];
			var commitMessage = ["Commit from Travis Build #", commit.number, "\nBuild - https://travis-ci.org/axemclion/IndexedDBShim/builds/", commit.id, "\nBranch : ", commit.branch, "@ ", commit.commit];
			console.log("Got Travis Build details");
			request({
				url: "https://api.github.com/repos/axemclion/IndexedDBShim/merges?access_token=" + process.env.githubtoken,
				method: "POST",
				headers: {
					'User-Agent': 'Travis'
				},
				body: JSON.stringify({
					"base": "gh-pages",
					"head": "master",
					"commit_message": commitMessage.join("")
				})
			}, function(err, response, body) {
				console.log(body);
				done(!err);
			});
		});
	});

	grunt.registerTask('build', ['jshint', 'concat', 'uglify']);
	var testJobs = ["build", "connect"];
	if (saucekey !== null) {
		testJobs.push("saucelabs-qunit");
	}

	if (process.env.CI && process.env.TRAVIS) {
		testJobs.push("publish");
	}
	grunt.registerTask('test', testJobs);

	grunt.registerTask('default', 'build');
	grunt.registerTask('dev', ['build', 'connect', 'watch']);
};<|endoftext|>


<commit_before>module.exports = function (grunt) {
    var path = require('path');
    require('load-grunt-tasks')(grunt);

    var coverallsVerbose = grunt.option('coverallsVerbose') ? '-DCOVERALLS_VERBOSE=ON ' : '';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        update_submodules: {
            default: {}
        },
        shell: {
            options: {
                stderr: false
            },
            target: {
                command: 'echo Use build:js or cmake:native'
            },
            native: {
                command: [
                    'echo Running CMake for native',
                    'cd build',
                    'cmake -DOTUCHA_DO_NOT_WARN_GL_H=ON ..'
                ].join('&&')
            },
            coveralls: {
                command: [
                    'echo Running CMake for Coveralls',
                    'cd cbuild',
                    'cmake -DOTUCHA_DO_NOT_WARN_GL_H=ON -DCOVERALLS=ON ' + coverallsVerbose + '-DCMAKE_BUILD_TYPE=Debug ..'
                ].join('&&')
            },
            xcode: {
                command: [
                    'echo Running CMake for Xcode',
                    'cd xbuild',
                    'cmake -DOTUCHA_DO_NOT_WARN_GL_H=ON -G Xcode ..',
                    'echo Opening Xcode...',
                    'open -a Xcode otucha.xcodeproj'
                ].join('&&')
            },
            emscripten_cmake: {
                options: {
                    failOnError: false
                },
                command: [
                    'cd embuild',
                    'emcmake cmake -DOTUCHA_EMSCRIPTEN_ENABLED=ON -G "MinGW Makefiles" ..'
                ].join('&&')
            },
            emscripten_make: {
                command: [
                    'cd embuild',
                    'make'
                ].join('&&')
            }
        },
        bowercopy: {
            server: {
                options: {
                    srcPrefix: 'src/server',
                    destPrefix: 'www'
                },
                files: {
                    'server.js': 'server.js'
                }
            },
            html: {
                options: {
                    srcPrefix: 'src/server',
                    destPrefix: 'www'
                },
                files: {
                    'index.html': 'index.html'
                }
            },
            js: {
                options: {
                    srcPrefix: 'embuild',
                    destPrefix: 'www'
                },
                files: {
                    'otucha.js': 'otucha.js',
                }
            }
        },
        uglify: {
            options: {
                sourceMap: false,
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyy-mm-dd-HH-MM-ss") %> */\n',
                compress: true,
                mangle: true
            },
            build: {
                files: {
                    'www/otucha.js': [
                        'embuild/otucha.js'
                    ]
                }
            }
        }
    });

    grunt.registerTask('default', ['cmake']);
    grunt.registerTask('cmake', ['cmake:native']);
    grunt.registerTask('cmake:native', function () {
        grunt.file.mkdir('build');
        grunt.task.run(['shell:native']);
    });
    grunt.registerTask('cmake:coveralls', function () {
        grunt.file.mkdir('cbuild');
        grunt.task.run(['shell:coveralls']);
    });
    grunt.registerTask('cmake:xcode', function () {
        grunt.file.mkdir('xbuild');
        grunt.task.run(['shell:xcode']);
    });
    grunt.registerTask('build:js', function () {
        if (grunt.option('jsUseDist')) {
            grunt.fail('jsUseDist is not supported at the moment.');
        } else {
            if (!grunt.file.exists('embuild/CMakeCache.txt')) {
                grunt.file.mkdir('embuild');
                grunt.task.run('shell:emscripten_cmake');
                grunt.task.run('shell:emscripten_cmake');
            }
            grunt.task.run('shell:emscripten_make');
            grunt.task.run('bowercopy:html');
            if (grunt.option('jsMin')) {
                grunt.task.run('uglify');
            } else {
                grunt.task.run('bowercopy:js');
            }
        }
        grunt.task.run('bowercopy:server');
    });
    grunt.registerTask('init', ['update_submodules']);
}
<commit_msg>build and launch xcode projects with just grunt xcode<commit_after>module.exports = function (grunt) {
    var path = require('path');
    require('load-grunt-tasks')(grunt);

    var coverallsVerbose = grunt.option('coverallsVerbose') ? '-DCOVERALLS_VERBOSE=ON ' : '';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        update_submodules: {
            default: {}
        },
        shell: {
            options: {
                stderr: false
            },
            target: {
                command: 'echo Use build:js or cmake:native'
            },
            native: {
                command: [
                    'echo Running CMake for native',
                    'cd build',
                    'cmake -DOTUCHA_DO_NOT_WARN_GL_H=ON ..'
                ].join('&&')
            },
            coveralls: {
                command: [
                    'echo Running CMake for Coveralls',
                    'cd cbuild',
                    'cmake -DOTUCHA_DO_NOT_WARN_GL_H=ON -DCOVERALLS=ON ' + coverallsVerbose + '-DCMAKE_BUILD_TYPE=Debug ..'
                ].join('&&')
            },
            xcode: {
                command: [
                    'echo Running CMake for Xcode',
                    'cd xbuild',
                    'cmake -DOTUCHA_DO_NOT_WARN_GL_H=ON -G Xcode ..',
                    'echo Opening Xcode...',
                    'open -a Xcode otucha.xcodeproj'
                ].join('&&')
            },
            emscripten_cmake: {
                options: {
                    failOnError: false
                },
                command: [
                    'cd embuild',
                    'emcmake cmake -DOTUCHA_EMSCRIPTEN_ENABLED=ON -G "MinGW Makefiles" ..'
                ].join('&&')
            },
            emscripten_make: {
                command: [
                    'cd embuild',
                    'make'
                ].join('&&')
            }
        },
        bowercopy: {
            server: {
                options: {
                    srcPrefix: 'src/server',
                    destPrefix: 'www'
                },
                files: {
                    'server.js': 'server.js'
                }
            },
            html: {
                options: {
                    srcPrefix: 'src/server',
                    destPrefix: 'www'
                },
                files: {
                    'index.html': 'index.html'
                }
            },
            js: {
                options: {
                    srcPrefix: 'embuild',
                    destPrefix: 'www'
                },
                files: {
                    'otucha.js': 'otucha.js',
                }
            }
        },
        uglify: {
            options: {
                sourceMap: false,
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyy-mm-dd-HH-MM-ss") %> */\n',
                compress: true,
                mangle: true
            },
            build: {
                files: {
                    'www/otucha.js': [
                        'embuild/otucha.js'
                    ]
                }
            }
        }
    });

    grunt.registerTask('default', ['cmake']);
    grunt.registerTask('cmake', ['cmake:native']);
    grunt.registerTask('cmake:native', function () {
        grunt.file.mkdir('build');
        grunt.task.run(['shell:native']);
    });
    grunt.registerTask('cmake:coveralls', function () {
        grunt.file.mkdir('cbuild');
        grunt.task.run(['shell:coveralls']);
    });
	grunt.registerTask('xcode', ['cmake:xcode']);
    grunt.registerTask('cmake:xcode', function () {
        grunt.file.mkdir('xbuild');
        grunt.task.run(['shell:xcode']);
    });
    grunt.registerTask('build:js', function () {
        if (grunt.option('jsUseDist')) {
            grunt.fail('jsUseDist is not supported at the moment.');
        } else {
            if (!grunt.file.exists('embuild/CMakeCache.txt')) {
                grunt.file.mkdir('embuild');
                grunt.task.run('shell:emscripten_cmake');
                grunt.task.run('shell:emscripten_cmake');
            }
            grunt.task.run('shell:emscripten_make');
            grunt.task.run('bowercopy:html');
            if (grunt.option('jsMin')) {
                grunt.task.run('uglify');
            } else {
                grunt.task.run('bowercopy:js');
            }
        }
        grunt.task.run('bowercopy:server');
    });
    grunt.registerTask('init', ['update_submodules']);
}
<|endoftext|>


<commit_before>angular.module('pascalprecht.translate').constant(
    'TRANSLATE_FS_INTERPOLATION_CACHE', '$translateFormatJsInterpolation')
  .factory('$translateFormatJsInterpolation', [
    '$cacheFactory',
    'TRANSLATE_FS_INTERPOLATION_CACHE',
    function($cacheFactory, TRANSLATE_FS_INTERPOLATION_CACHE) {
      var DEFAULT_LOCALE = 'en';
      var $translateInterpolator = {},
        $cache = $cacheFactory.get(TRANSLATE_FS_INTERPOLATION_CACHE),
        _locale = DEFAULT_LOCALE;
      //
      $identifier = 'formatjs',
        $sanitizeValueStrategy = null,
        sanitizeValueStrategies = {
          escaped: function(params) {
            var result = {};
            for (var key in params) {
              if (Object.prototype.hasOwnProperty.call(params, key)) {
                result[key] = angular.element('

').text(params[
                  key]).html();
              }
            }
            return result;
          }
        };
      var sanitizeParams = function(params) {
        var result;
        if (angular.isFunction(sanitizeValueStrategies[
            $sanitizeValueStrategy])) {
          result = sanitizeValueStrategies[$sanitizeValueStrategy](params);
        } else {
          result = params;
        }
        return result;
      };
      if (!$cache) {
        $cache = $cacheFactory(TRANSLATE_FS_INTERPOLATION_CACHE);
      }
      $translateInterpolator.setLocale = function(locale) {
        var langId;
        if (locale.split("_").length == 2) {
          langId = locale.split("_")[0];
        } else if (locale.split("-").length == 2) {
          langId = locale.split("-")[0];
        } else {
          langId = locale;
        }

        _locale = langId;
      };
      $translateInterpolator.getInterpolationIdentifier = function() {
        return $identifier;
      };
      $translateInterpolator.useSanitizeValueStrategy = function(value) {
        $sanitizeValueStrategy = value;
        return this;
      };

      function _prefixMessageFormat(stringKey) {
        return "mf." + stringKey;
      }
      $translateInterpolator.interpolate = function(string,
        interpolateParams) {

        interpolateParams = interpolateParams || {};
        if ($sanitizeValueStrategy) {
          interpolateParams = sanitizeParams(interpolateParams);
        }
        var stringKey = string + angular.toJson(interpolateParams);
        var interpolatedText = $cache.get(stringKey);

        if (!interpolatedText) {
          var messageFormat = $cache.get(_prefixMessageFormat(stringKey));
          if (!messageFormat) {
            messageFormat = new IntlMessageFormat(string, _locale);
            $cache.put(_prefixMessageFormat(stringKey), messageFormat);
          }
          interpolatedText = messageFormat.format(interpolateParams);
          $cache.put(stringKey, interpolatedText);
        }
        return interpolatedText;
      };
      return $translateInterpolator;
    }
  ]);
<commit_msg>Remove useless line<commit_after>angular.module('pascalprecht.translate').constant(
    'TRANSLATE_FS_INTERPOLATION_CACHE', '$translateFormatJsInterpolation')
  .factory('$translateFormatJsInterpolation', [
    '$cacheFactory',
    'TRANSLATE_FS_INTERPOLATION_CACHE',
    function($cacheFactory, TRANSLATE_FS_INTERPOLATION_CACHE) {
      var DEFAULT_LOCALE = 'en';
      var $translateInterpolator = {},
        $cache = $cacheFactory.get(TRANSLATE_FS_INTERPOLATION_CACHE),
        _locale = DEFAULT_LOCALE;
      var $identifier = 'formatjs',
        $sanitizeValueStrategy = null,
        sanitizeValueStrategies = {
          escaped: function(params) {
            var result = {};
            for (var key in params) {
              if (Object.prototype.hasOwnProperty.call(params, key)) {
                result[key] = angular.element('

').text(params[
                  key]).html();
              }
            }
            return result;
          }
        };
      var sanitizeParams = function(params) {
        var result;
        if (angular.isFunction(sanitizeValueStrategies[
            $sanitizeValueStrategy])) {
          result = sanitizeValueStrategies[$sanitizeValueStrategy](params);
        } else {
          result = params;
        }
        return result;
      };
      if (!$cache) {
        $cache = $cacheFactory(TRANSLATE_FS_INTERPOLATION_CACHE);
      }
      $translateInterpolator.setLocale = function(locale) {
        var langId;
        if (locale.split("_").length == 2) {
          langId = locale.split("_")[0];
        } else if (locale.split("-").length == 2) {
          langId = locale.split("-")[0];
        } else {
          langId = locale;
        }

        _locale = langId;
      };
      $translateInterpolator.getInterpolationIdentifier = function() {
        return $identifier;
      };
      $translateInterpolator.useSanitizeValueStrategy = function(value) {
        $sanitizeValueStrategy = value;
        return this;
      };

      function _prefixMessageFormat(stringKey) {
        return "mf." + stringKey;
      }
      $translateInterpolator.interpolate = function(string,
        interpolateParams) {

        interpolateParams = interpolateParams || {};
        if ($sanitizeValueStrategy) {
          interpolateParams = sanitizeParams(interpolateParams);
        }
        var stringKey = string + angular.toJson(interpolateParams);
        var interpolatedText = $cache.get(stringKey);

        if (!interpolatedText) {
          var messageFormat = $cache.get(_prefixMessageFormat(stringKey));
          if (!messageFormat) {
            messageFormat = new IntlMessageFormat(string, _locale);
            $cache.put(_prefixMessageFormat(stringKey), messageFormat);
          }
          interpolatedText = messageFormat.format(interpolateParams);
          $cache.put(stringKey, interpolatedText);
        }
        return interpolatedText;
      };
      return $translateInterpolator;
    }
  ]);
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            gruntfile: {
                src: 'Gruntfile.js'
            },
            test: {
                src: ['test/**/*.js']
            }
        },
        watch: {
            gruntfile: {
                files: '<%= jshint.gruntfile.src %>',
                tasks: ['jshint:gruntfile']
            },
            test: {
                files: '<%= jshint.test.src %>',
                tasks: ['jshint:test', 'karma:all']
            }
        },
        karma: {
            options: {
                configFile: 'karma.conf.js'
            },
            all: {
                singleRun: true,
                reporters: 'dots'
            }
        },
        cucumberjs: {
            src: 'test/acceptance/features/',
            options: {
                steps: 'test/acceptance/features/step_definitions/',
                format: 'pretty'
            }
        },
        mochacov: {
            options: {
                reporter: 'spec',
                ui: 'bdd'
            },
            all: ['test/unit/server/**/*.spec.js']
        }
    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-mocha-cov');
    grunt.loadNpmTasks('grunt-cucumber');

    // Default task.
    grunt.registerTask('default', ['jshint']);
    grunt.registerTask('test', ['bdd', 'unit:server', 'unit:ui']);
    grunt.registerTask('unit:server', ['jshint', 'mochacov:all']);
    grunt.registerTask('unit:ui', ['jshint', 'karma']);
    grunt.registerTask('bdd', ['cucumberjs']);
};
<commit_msg>Changed test execution order in Gruntfile<commit_after>'use strict';

module.exports = function (grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            gruntfile: {
                src: 'Gruntfile.js'
            },
            test: {
                src: ['test/**/*.js']
            }
        },
        watch: {
            gruntfile: {
                files: '<%= jshint.gruntfile.src %>',
                tasks: ['jshint:gruntfile']
            },
            test: {
                files: '<%= jshint.test.src %>',
                tasks: ['jshint:test', 'karma:all']
            }
        },
        karma: {
            options: {
                configFile: 'karma.conf.js'
            },
            all: {
                singleRun: true,
                reporters: 'dots'
            }
        },
        cucumberjs: {
            src: 'test/acceptance/features/',
            options: {
                steps: 'test/acceptance/features/step_definitions/',
                format: 'pretty'
            }
        },
        mochacov: {
            options: {
                reporter: 'spec',
                ui: 'bdd'
            },
            all: ['test/unit/server/**/*.spec.js']
        }
    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-mocha-cov');
    grunt.loadNpmTasks('grunt-cucumber');

    // Default task.
    grunt.registerTask('default', ['jshint']);
    grunt.registerTask('test', ['unit:server', 'unit:ui', 'bdd']);
    grunt.registerTask('unit:server', ['jshint', 'mochacov:all']);
    grunt.registerTask('unit:ui', ['jshint', 'karma']);
    grunt.registerTask('bdd', ['cucumberjs']);
};
<|endoftext|>


<commit_before>const url = require('url')
const path = require('path')
const fs = require('fs')
const cheerio = require('cheerio')

let updatedPages = []

const getTargetHtmlPath = (mdPath) => {
  const mdInfo = path.parse(mdPath)
  let targetFile = mdInfo.base.replace('.md', '.html')
  if (mdInfo.base === 'README.md') {
    targetFile = 'index.html'
  }
  const relpath = path.join('./', '_book', mdInfo.dir, targetFile)
  return path.resolve(relpath)
}

const useExplicitUrl = (filename) => {
  const data = fs.readFileSync(filename, 'UTF-8')
  const $ = cheerio.load(data)
  $('a').each((idx, element) => {
    const href = element.attribs.href
    if (href === undefined) return

    const link = url.parse(href)
    if (link.pathname === null) {
      link.pathname = ''
    }
    const basename = link.pathname.split('/').pop()

    if (link.protocol) {
      // this is a external link
    } else if (link.pathname === '' && link.hash !== '') {
      // this is anchor
    } else if (link.pathname.endsWith('/')) {
      link.pathname += 'index.html'
    } else if (!basename.includes('.')) {
      link.pathname += '/index.html'
    }
    element.attribs.href = url.format(link)
  })
  fs.writeFileSync(filename, $.html(), 'UTF-8')
}

module.exports = {
  book: {},
  hooks: {
    page: (page) => {
      updatedPages.push(page.path)
      return page
    },
    finish: () => {
      for (let page of updatedPages) {
        const filePath = getTargetHtmlPath(page)
        useExplicitUrl(filePath)
      }
      updatedPages = []
    }
  }
}
<commit_msg>allow utf8 chars<commit_after>const url = require('url')
const path = require('path')
const fs = require('fs')
const cheerio = require('cheerio')

let updatedPages = []

const getTargetHtmlPath = (mdPath) => {
  const mdInfo = path.parse(mdPath)
  let targetFile = mdInfo.base.replace('.md', '.html')
  if (mdInfo.base === 'README.md') {
    targetFile = 'index.html'
  }
  const relpath = path.join('./', '_book', mdInfo.dir, targetFile)
  return path.resolve(relpath)
}

const useExplicitUrl = (filename) => {
  const data = fs.readFileSync(filename, 'UTF-8')
  const $ = cheerio.load(data)
  $('a').each((idx, element) => {
    const href = element.attribs.href
    if (href === undefined) return

    const link = url.parse(href)
    if (link.pathname === null) {
      link.pathname = ''
    }
    const basename = link.pathname.split('/').pop()

    if (link.protocol) {
      // this is a external link
    } else if (link.pathname === '' && link.hash !== '') {
      // this is anchor
    } else if (link.pathname.endsWith('/')) {
      link.pathname += 'index.html'
    } else if (!basename.includes('.')) {
      link.pathname += '/index.html'
    }
    element.attribs.href = url.format(link)
  })
  fs.writeFileSync(filename, $.html({decodeEntities: false}), 'UTF-8')
}

module.exports = {
  book: {},
  hooks: {
    page: (page) => {
      updatedPages.push(page.path)
      return page
    },
    finish: () => {
      for (let page of updatedPages) {
        const filePath = getTargetHtmlPath(page)
        useExplicitUrl(filePath)
      }
      updatedPages = []
    }
  }
}
<|endoftext|>


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

  grunt.initConfig({
    'json-minify': {
      build: {
        files: 'dist/mathmaps/**/*.json'
      }
    },
    gitclone: {
      'speech-rule-engine': {
        options: {
          repository: 'https://github.com/zorkow/speech-rule-engine.git',
          branch: 'v1.2.0',
          cwd: "."
        }
      }
    },
    'uglify': {
      mathmaps: {
        files: {
          'dist/mathmaps/mathmaps_ie.js': 'dist/mathmaps/mathmaps_ie.js'
        }
      },
      build: {
        files: {
          'dist/accessibility-menu.js': 'extensions/accessibility-menu.js',
          'dist/explorer.js': 'extensions/explorer.js',
          'dist/auto-collapse.js': 'extensions/auto-collapse.js',
          'dist/collapsible.js': 'extensions/collapsible.js',
          'dist/semantic-enrich.js': 'extensions/semantic-enrich.js'
        },
        options: {
          beautify: {
            ascii_only: true
          }
        }
      }
    },
    shell: {
      clean_dist: {
        command: 'rm -rf dist'
      },
      make_dist: {
        command: 'mkdir -p dist'
      },
      clean_sre: {
        command: 'rm -rf speech-rule-engine'
      },
      clean_node: {
        command: 'rm -rf node_modules'
      },
      prepare: {
        command: [
          '<%= shell.clean_dist.command %>',
          '<%= shell.make_dist.command %>'
        ].join('&&')
      },
      clean: {
        command: [
          '<%= shell.clean_node.command %>',
          '<%= shell.clean_sre.command %>',
          '<%= shell.clean_dist.command %>'
        ].join('&&')
      },
      compile: {
        command: [
          'npm install',
          'npm install --only=dev',
          'npm install wicked-good-xpath',
          'make mathjax'
        ].join('&&'),
        options: {
          execOptions: {
            cwd: 'speech-rule-engine'
          }
        }
      },
      copy: [
        'cp speech-rule-engine/lib/mathjax-sre.js dist/mathjax-sre.js',
        'cp speech-rule-engine/node_modules/wicked-good-xpath/dist/wgxpath.install.js dist/',
        'cp -R speech-rule-engine/src/mathmaps dist/',
        'cp extensions/*.ogg dist/',
        'cp extensions/*.mp3 dist/',
        'rm dist/mathmaps/math_map.js'
      ].join('&&')
    }
  });

  // Cloning git repos.
  grunt.loadNpmTasks('grunt-git');
  // Run shell commands.
  grunt.loadNpmTasks('grunt-shell');
  // Minify JSON files.
  grunt.loadNpmTasks('grunt-json-minify');
  // Minify regular files.
  grunt.loadNpmTasks('grunt-contrib-uglify');

  grunt.registerTask('default', [
    'shell:prepare',
    'gitclone',
    'shell:compile',
    'shell:copy',
    'json-minify',
    'uglify',
    'shell:clean_sre'
  ]);

};
<commit_msg>Updates sre version.<commit_after>module.exports = function(grunt) {

  grunt.initConfig({
    'json-minify': {
      build: {
        files: 'dist/mathmaps/**/*.json'
      }
    },
    gitclone: {
      'speech-rule-engine': {
        options: {
          repository: 'https://github.com/zorkow/speech-rule-engine.git',
          branch: 'v2.0.0-beta.1',
          cwd: "."
        }
      }
    },
    'uglify': {
      mathmaps: {
        files: {
          'dist/mathmaps/mathmaps_ie.js': 'dist/mathmaps/mathmaps_ie.js'
        }
      },
      build: {
        files: {
          'dist/accessibility-menu.js': 'extensions/accessibility-menu.js',
          'dist/explorer.js': 'extensions/explorer.js',
          'dist/auto-collapse.js': 'extensions/auto-collapse.js',
          'dist/collapsible.js': 'extensions/collapsible.js',
          'dist/semantic-enrich.js': 'extensions/semantic-enrich.js'
        },
        options: {
          beautify: {
            ascii_only: true
          }
        }
      }
    },
    shell: {
      clean_dist: {
        command: 'rm -rf dist'
      },
      make_dist: {
        command: 'mkdir -p dist'
      },
      clean_sre: {
        command: 'rm -rf speech-rule-engine'
      },
      clean_node: {
        command: 'rm -rf node_modules'
      },
      prepare: {
        command: [
          '<%= shell.clean_dist.command %>',
          '<%= shell.make_dist.command %>'
        ].join('&&')
      },
      clean: {
        command: [
          '<%= shell.clean_node.command %>',
          '<%= shell.clean_sre.command %>',
          '<%= shell.clean_dist.command %>'
        ].join('&&')
      },
      compile: {
        command: [
          'npm install',
          'npm install --only=dev',
          'npm install wicked-good-xpath',
          'make mathjax'
        ].join('&&'),
        options: {
          execOptions: {
            cwd: 'speech-rule-engine'
          }
        }
      },
      copy: [
        'cp speech-rule-engine/lib/mathjax-sre.js dist/mathjax-sre.js',
        'cp speech-rule-engine/node_modules/wicked-good-xpath/dist/wgxpath.install.js dist/',
        'cp -R speech-rule-engine/src/mathmaps dist/',
        'cp extensions/*.ogg dist/',
        'cp extensions/*.mp3 dist/',
        'rm dist/mathmaps/math_map.js'
      ].join('&&')
    }
  });

  // Cloning git repos.
  grunt.loadNpmTasks('grunt-git');
  // Run shell commands.
  grunt.loadNpmTasks('grunt-shell');
  // Minify JSON files.
  grunt.loadNpmTasks('grunt-json-minify');
  // Minify regular files.
  grunt.loadNpmTasks('grunt-contrib-uglify');

  grunt.registerTask('default', [
    'shell:prepare',
    'gitclone',
    'shell:compile',
    'shell:copy',
    'json-minify',
    'uglify',
    'shell:clean_sre'
  ]);

};
<|endoftext|>