<commit_before>// Generated on 2013-06-15 using generator-webapp 0.2.2
'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));
};

// # 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) {
    // load all grunt tasks
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

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

    grunt.initConfig({
        yeoman: yeomanConfig,
        watch: {
            options: {
                nospawn: true
            },
            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']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '<%= yeoman.app %>/*.html',
                    '{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
                    '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
                    '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },
        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 [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app),
                            lrSnippet
                        ];
                    }
                }
            },
            test: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test')
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, yeomanConfig.dist)
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>'
            }
        },
        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',
                '!<%= yeoman.app %>/scripts/vendor/*',
                'test/spec/{,*/}*.js'
            ]
        },
        mocha: {
            all: {
                options: {
                    run: true,
                    urls: ['http://localhost:<%= connect.options.port %>/index.html']
                }
            }
        },
        coffee: {
            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',
                relativeAssets: false
            },
            dist: {},
            server: {
                options: {
                    debugInfo: true
                }
            }
        },
        // not used since Uglify task does concat,
        // but still available if needed
        /*concat: {
            dist: {}
        },*/
        // not enabled since usemin task does concat and uglify
        // check index.html to edit your build targets
        // enable this task if you prefer defining your build targets here
        /*uglify: {
            dist: {}
        },*/
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
                        '<%= yeoman.dist %>/styles/fonts/*'
                    ]
                }
            }
        },
        useminPrepare: {
            options: {
                dest: '<%= yeoman.dist %>'
            },
            html: '<%= yeoman.app %>/index.html'
        },
        usemin: {
            options: {
                dirs: ['<%= yeoman.dist %>']
            },
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css']
        },
        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: {
            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',
                    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,txt}',
                        '.htaccess',
                        'images/{,*/}*.{webp,gif}',
                        'styles/fonts/*'
                    ]
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: [
                        'generated/*'
                    ]
                }]
            }
        },
        concurrent: {
            server: [
                'coffee:dist',
                'compass:server'
            ],
            test: [
                'coffee',
                'compass'
            ],
            dist: [
                'coffee',
                'compass:dist',
                'imagemin',
                'svgmin',
                'htmlmin'
            ]
        }
    });

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

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

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

    grunt.registerTask('build', [
        'clean:dist',
        'useminPrepare',
        'concurrent:dist',
        'cssmin',
        'concat',
        'uglify',
        'copy',
        'rev',
        'usemin'
    ]);

    grunt.registerTask('default', [
        'jshint',
        'test',
        'build'
    ]);
};
<commit_msg>removed coffee from grunt<commit_after>// Generated on 2013-06-15 using generator-webapp 0.2.2
'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));
};

// # 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) {
    // load all grunt tasks
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

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

    grunt.initConfig({
        yeoman: yeomanConfig,
        watch: {
            options: {
                nospawn: true
            },
            // 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']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '<%= yeoman.app %>/*.html',
                    '{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
                    '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
                    '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },
        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 [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app),
                            lrSnippet
                        ];
                    }
                }
            },
            test: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test')
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, yeomanConfig.dist)
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>'
            }
        },
        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',
                '!<%= yeoman.app %>/scripts/vendor/*',
                'test/spec/{,*/}*.js'
            ]
        },
        mocha: {
            all: {
                options: {
                    run: true,
                    urls: ['http://localhost:<%= connect.options.port %>/index.html']
                }
            }
        },
        // coffee: {
        //     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',
                relativeAssets: false
            },
            dist: {},
            server: {
                options: {
                    debugInfo: true
                }
            }
        },
        // not used since Uglify task does concat,
        // but still available if needed
        /*concat: {
            dist: {}
        },*/
        // not enabled since usemin task does concat and uglify
        // check index.html to edit your build targets
        // enable this task if you prefer defining your build targets here
        /*uglify: {
            dist: {}
        },*/
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
                        '<%= yeoman.dist %>/styles/fonts/*'
                    ]
                }
            }
        },
        useminPrepare: {
            options: {
                dest: '<%= yeoman.dist %>'
            },
            html: '<%= yeoman.app %>/index.html'
        },
        usemin: {
            options: {
                dirs: ['<%= yeoman.dist %>']
            },
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css']
        },
        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: {
            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',
                    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,txt}',
                        '.htaccess',
                        'images/{,*/}*.{webp,gif}',
                        'styles/fonts/*'
                    ]
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: [
                        'generated/*'
                    ]
                }]
            }
        },
        concurrent: {
            server: [
                // 'coffee:dist',
                'compass:server'
            ],
            test: [
                // 'coffee',
                'compass'
            ],
            dist: [
                // 'coffee',
                'compass:dist',
                'imagemin',
                'svgmin',
                'htmlmin'
            ]
        }
    });

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

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

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

    grunt.registerTask('build', [
        'clean:dist',
        'useminPrepare',
        'concurrent:dist',
        'cssmin',
        'concat',
        'uglify',
        'copy',
        'rev',
        'usemin'
    ]);

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


<commit_before>// This module splits the input into words and return the accented version of the text.

$("document").ready(function(){
    $("#input").on({
        click: function(){
            $('#input').html('');
            $('#input').css({color: 'black'});
        },

        keyup: function(e){
            var words = e.target.innerText.split(/([a-zA-Z0-9_\u0027\u00C6\u00DF-\u00EA\u00EC-\u00EF\u00F1-\u00F6\u00F8-\u00FD\u0101\u0103\u0105\u0107\u0109\u010D\u010F\u0111\u0113\u0117\u0119\u011B\u011D\u011F\u0123\u0125\u012B\u012F\u0131\u0135\u0137\u013C\u013E\u0142\u0144\u0146\u0148\u0151\u0153\u0155\u0159\u015B\u015D\u015F\u0161\u0165\u016B\u016D\u016F\u0171\u0173\u017A\u017C\u017E\u017F\u0219\u021B\u02BC\u0390\u03AC-\u03CE\u03F2\u0401\u0410-\u044F\u0451\u0454\u0456\u0457\u045E\u0491\u0531-\u0556\u0561-\u0587\u0902\u0903\u0905-\u090B\u090E-\u0910\u0912\u0914-\u0928\u092A-\u0939\u093E-\u0943\u0946-\u0948\u094A-\u094D\u0982\u0983\u0985-\u098B\u098F\u0990\u0994-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BE-\u09C3\u09C7\u09C8\u09CB-\u09CD\u09D7\u0A02\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A14-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A82\u0A83\u0A85-\u0A8B\u0A8F\u0A90\u0A94-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABE-\u0AC3\u0AC7\u0AC8\u0ACB-\u0ACD\u0B02\u0B03\u0B05-\u0B0B\u0B0F\u0B10\u0B14-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3E-\u0B43\u0B47\u0B48\u0B4B-\u0B4D\u0B57\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C02\u0C03\u0C05-\u0C0B\u0C0E-\u0C10\u0C12\u0C14-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3E-\u0C43\u0C46-\u0C48\u0C4A-\u0C4D\u0C82\u0C83\u0C85-\u0C8B\u0C8E-\u0C90\u0C92\u0C94-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBE-\u0CC3\u0CC6-\u0CC8\u0CCA-\u0CCD\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D60\u0D61\u0D7A-\u0D7F\u1F00-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB2-\u1FB4\u1FB6\u1FB7\u1FBD\u1FBF\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD2\u1FD3\u1FD6\u1FD7\u1FE2-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u200D\u2019]+)/g); // Returns an array of all the words of the input box.
            for(var i = 0; i < words.length; i++) {
                if(words[i] == "istius"){
                    words[i] = "istíus";
                }
                else if(words[i] == "illius"){
                    words[i] = "illíus";
                }
                else if(words[i] == "ullius"){
                    words[i] = "ullíus";
                }
                else if(words[i] == "nullius"){
                    words[i] = "nullíus";
                }
                else if(words[i] == "totius"){
                    words[i] = "totíus";
                }
                else if(words[i] == "solius"){
                    words[i] = "solíus";
                }
                else if(words[i].length > 2){
                    words[i] = words[i].replace(/æ/g, 'ae');
                    words[i] = words[i].replace(/œ/g, 'oe');
                    words[i] = words[i].replace(/Æ/g, 'Ae');
                    var uppercase = is_uppercase(words[i]);
                    words[i] = accentify(words[i], uppercase).join("|"); // Returns each word accentified.
                    words[i] = words[i].replace(/Ae/g, 'Æ');
                }
            }
            var output = words.join('');
            output = output.replace(/\n/g, "
").replace(/\s\s*/g, " "); // Linebreaks, multiple spaces.
            $("#output").html(output);
        }
    });
});

<commit_msg>Oops: input='' only if example text.<commit_after>// This module splits the input into words and return the accented version of the text.

$("document").ready(function(){
    $("#input").on({
        click: function(){
            if($(this).text() == 'Hic scribe textum tuum…'){
                $('#input').html('');
                $('#input').css({color: 'black'});
            }
        },

        keyup: function(e){
            var words = e.target.innerText.split(/([a-zA-Z0-9_\u0027\u00C6\u00DF-\u00EA\u00EC-\u00EF\u00F1-\u00F6\u00F8-\u00FD\u0101\u0103\u0105\u0107\u0109\u010D\u010F\u0111\u0113\u0117\u0119\u011B\u011D\u011F\u0123\u0125\u012B\u012F\u0131\u0135\u0137\u013C\u013E\u0142\u0144\u0146\u0148\u0151\u0153\u0155\u0159\u015B\u015D\u015F\u0161\u0165\u016B\u016D\u016F\u0171\u0173\u017A\u017C\u017E\u017F\u0219\u021B\u02BC\u0390\u03AC-\u03CE\u03F2\u0401\u0410-\u044F\u0451\u0454\u0456\u0457\u045E\u0491\u0531-\u0556\u0561-\u0587\u0902\u0903\u0905-\u090B\u090E-\u0910\u0912\u0914-\u0928\u092A-\u0939\u093E-\u0943\u0946-\u0948\u094A-\u094D\u0982\u0983\u0985-\u098B\u098F\u0990\u0994-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BE-\u09C3\u09C7\u09C8\u09CB-\u09CD\u09D7\u0A02\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A14-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A82\u0A83\u0A85-\u0A8B\u0A8F\u0A90\u0A94-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABE-\u0AC3\u0AC7\u0AC8\u0ACB-\u0ACD\u0B02\u0B03\u0B05-\u0B0B\u0B0F\u0B10\u0B14-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3E-\u0B43\u0B47\u0B48\u0B4B-\u0B4D\u0B57\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C02\u0C03\u0C05-\u0C0B\u0C0E-\u0C10\u0C12\u0C14-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3E-\u0C43\u0C46-\u0C48\u0C4A-\u0C4D\u0C82\u0C83\u0C85-\u0C8B\u0C8E-\u0C90\u0C92\u0C94-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBE-\u0CC3\u0CC6-\u0CC8\u0CCA-\u0CCD\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D60\u0D61\u0D7A-\u0D7F\u1F00-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB2-\u1FB4\u1FB6\u1FB7\u1FBD\u1FBF\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD2\u1FD3\u1FD6\u1FD7\u1FE2-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u200D\u2019]+)/g); // Returns an array of all the words of the input box.
            for(var i = 0; i < words.length; i++) {
                if(words[i] == "istius"){
                    words[i] = "istíus";
                }
                else if(words[i] == "illius"){
                    words[i] = "illíus";
                }
                else if(words[i] == "ullius"){
                    words[i] = "ullíus";
                }
                else if(words[i] == "nullius"){
                    words[i] = "nullíus";
                }
                else if(words[i] == "totius"){
                    words[i] = "totíus";
                }
                else if(words[i] == "solius"){
                    words[i] = "solíus";
                }
                else if(words[i].length > 2){
                    words[i] = words[i].replace(/æ/g, 'ae');
                    words[i] = words[i].replace(/œ/g, 'oe');
                    words[i] = words[i].replace(/Æ/g, 'Ae');
                    var uppercase = is_uppercase(words[i]);
                    words[i] = accentify(words[i], uppercase).join("|"); // Returns each word accentified.
                    words[i] = words[i].replace(/Ae/g, 'Æ');
                }
            }
            var output = words.join('');
            output = output.replace(/\n/g, "
").replace(/\s\s*/g, " "); // Linebreaks, multiple spaces.
            $("#output").html(output);
        }
    });
});

<|endoftext|>


<commit_before>var matchdep = require('matchdep')
    , fs = require('fs')
    , q = require('q')
    , request = require('request')
    , services = [
        'introduction.md',
        'substitutions_reference.md',
        'inbound_domains_api.md',
        'metrics_api.md',
        'message_events_api.md',
        'recipient_list_api.md',
        'relay_webhooks_api.md',
        'sending_domains_api.md',
        'subaccounts_api.md',
        'suppression_list_api.md',
        'templates_api.md',
        'tracking_domains_api.md',
        'transmissions_api.md',
        'webhooks_api.md',
        'smtp_api.md'
    ];

module.exports = function(grunt) {
    // Dynamically load any preexisting grunt tasks/modules
    matchdep.filterDev('grunt-*').forEach(grunt.loadNpmTasks);
    var cheerio = require('cheerio');

    // Configure existing grunt tasks and create custom ones
    grunt.initConfig({
        aglio: {
            build: {
                files:
                    services.reduce(function(obj, val, idx) {
                      var name = (val.split('.'))[0];
                      obj['aglio/'+ name +'.html'] = [ 'services/'+ val ];
                      return obj;
                    }, {})
            },
        },

        dom_munger: {
            main: {
                src: services.map(function(s) { var name = (s.split('.'))[0]; return 'aglio/'+ name +'.html'; }),
                options: {
                    callback: function($,file) {
                        // absolutify sub-section links
                        $('nav a[href^=#]').each(
                          function(idx, elt) {
                            var obj = $(elt);
                            var filename = (file.split('/'))[1];
                            var href = filename + obj.attr('href');
                            // Rename #top anchor so auto-expansion works as expected.
                            if (href == 'substitutions_reference.html#top') {
                                href = filename + '#substitutions-reference-top';
                            }
                            obj.attr('href', href);
                          }
                        );

                        var name = (file.split('.'))[0];
                        name = (name.split('/'))[1];
                        // Fix nav name, it's Overview for some reason
                        if (name == 'substitutions_reference') {
                            $('nav div.heading a[href^="substitutions_reference.html#"]').text('Substitutions Reference');
                        }
                        // save a copy of the fixed-up nav from the current page
                        // we'll use this in `copy`, below
                        grunt.option('dom_munger.getnav.'+ name, $('nav').html());

                        // don't write out file changes, we'll do that in `copy` too
                        return false;
                    }
                }
            }
        },

        copy: {
            main: {
                src: services.map(function(s) { var name = (s.split('.'))[0]; return 'aglio/'+ name +'.html'; }),
                dest: './',
                options: {
                    process: function(content, srcpath) {
                        // get the global nav we build and cache below
                        var allnav = grunt.option('copy.allnav');
                        if (allnav === undefined) {
                            // build and cache global nav if we haven't yet this run
                            allnav = '';
                            var names = services.map(function(s) { return (s.split('.'))[0]; });
                            for (var idx in names) {
                                var name = names[idx];
                                var html = grunt.option('dom_munger.getnav.'+ name);
                                if (html === undefined) {
                                    grunt.log.fatal('no nav html for ['+ name +'], run dom_munger before copy!');
                                }
                                allnav = allnav + html;
                            }
                            grunt.option('copy.allnav', allnav);
                        }

                        // get a DOM for our global nav
                        $ = cheerio.load(allnav);
                        var file = (srcpath.split('/'))[1];
                        // css selector for current nav
                        var curNav = 'div.heading a[href^="'+ file +'#"]';
                        // anchor from current nav
                        var anchor = (($(curNav).attr('href')).split('#'))[1];

                        // indicate current page w/in nav
                        // FIXME: style info doesn't belong in Grunt, put this elsewhere,
                        // perhaps a per-"service" external stylesheet
                        $(curNav).attr('style', 'font-weight:bold;background-color:#fa6423;color:#fff;');
                        allnav = $.html();

                        // replace single-page nav with the global nav we built above
                        content = content.replace(/]*>.*?<\/nav>/, ''+ allnav +'');

                        // auto-expand nav on page load
                        var collapse = '    var nav = document.querySelectorAll(\'nav .resource-group .heading a[href$="#'+
                            anchor +'"]\');\n    toggleCollapseNav({target: nav[0]});\n';
                        content = content.replace(/(window\.onload\s*=\s*function\s*\(\)\s*\{[^}]+)\}/, '$1'+ collapse +'}');

                        return content;
                    }
                }
            }
        },

        concat: {
            options: {
                banner: 'FORMAT: X-1A' + grunt.util.linefeed +
                    'HOST: https://api.sparkpost.com/api/v1' +
                    grunt.util.linefeed + grunt.util.linefeed
            },
            prod: {
                src: services.map(function(s) { return 'services/' + s; }),
                dest: 'apiary.apib'
            }
        },

        connect: {
            apiary: {
                options: {
                    port: 4000,
                    hostname: '0.0.0.0',
                    open: true,
                    middleware: function(connect) {
                        return [
                            require('connect-livereload')(),
                            connect.static('apiary-previews'),
                            connect.directory('apiary-previews')
                        ];
                    }
                }
            }
        },

        shell: {
            test: {
                command : function(file) {
                    if (file) {
                        file = './services/' + file;
                    } else {
                        file = 'apiary.apib';
                    }
                    return 'node ./bin/api-blueprint-validator ' + file;
                },
                options : {
                    stdout : true,
                    stderr: false,
                    failOnError : true
                }
            }
        },

        watch: {
            apiaryDocs: {
                files: [ 'services/*.md', 'Gruntfile.js' ],
                tasks: [ 'generate-apiary-preview' ],
                options: {
                    livereload: true
                }
            }
        }
    });

    /**
     * Generates an apiary preview for an .md file
     * @param file The .md file
     * @returns {*|promise}
     */
    function generatePreview(file) {
        var deferred = q.defer();

        var blueprint = 'FORMAT: X-1A' +
            grunt.util.linefeed +
            'HOST: https://api.sparkpost.com/api/v1' +
            grunt.util.linefeed + grunt.util.linefeed +
            '# SparkPost API v1' +
            grunt.util.linefeed +
            fs.readFileSync('./services/' + file, 'utf-8');
        var embedOptions = { apiBlueprint: blueprint };

        var body = '\
<!DOCTYPE html>\n\
\n\
\n\
  <meta charset="UTF-8">\n\
  <title>' + file + '</title>\n\
\n\
\n\
  \n\
  \n\
\n\
\
';

        var output = file.split('\.')[0] + '.html';

        fs.writeFile('./apiary-previews/' + output, body, function(err) {
            if (err) {
                grunt.log.error('There was an error trying to write to ' + output, err);
                return deferred.reject(err);
            }
            return deferred.resolve();
        });

        return deferred.promise;
    }

    // grunt generate-apiary-preview - creates apiary previews for all meta
    grunt.registerTask('generate-apiary-preview', 'Creates preview files for all md files in services', function() {
        var done = this.async();
        try {
            fs.mkdirSync('./apiary-previews');
        } catch(e){}

        fs.readdir('./services', function(err, files) {
            q.all(files.map(generatePreview)).then(done, done);
        });
    });

    // grunt testFiles - runs apiary-blueprint-validator on individual blueprint files
    grunt.registerTask('testFiles', 'Validates individual blueprint files', services.map(function(s) {
        return 'shell:test:' + s;
    }));

    //grunt preview - creates a live-reloaded preview of the docs, Apiary-style
    grunt.registerTask('preview', 'View the apiary generated HTML files in the browser with all that live-reload goodness', [
        'generate-apiary-preview',
        'connect:apiary',
        'watch:apiaryDocs'
    ]);

    // grunt test - runs apiary-blueprint-validator on combined apiary.apib file
    grunt.registerTask('test', [ 'shell:test' ]);

    // grunt compile - concatenates all the individual blueprint files and validates it
    grunt.registerTask('compile', [ 'concat:prod', 'test' ]);

    // register default grunt command as grunt test
    grunt.registerTask('default', [ 'testFiles' ]);
};
<commit_msg>generate `index.html` instead of `introduction.html`<commit_after>var matchdep = require('matchdep')
    , fs = require('fs')
    , q = require('q')
    , request = require('request')
    , services = [
        'introduction.md',
        'substitutions_reference.md',
        'inbound_domains_api.md',
        'metrics_api.md',
        'message_events_api.md',
        'recipient_list_api.md',
        'relay_webhooks_api.md',
        'sending_domains_api.md',
        'subaccounts_api.md',
        'suppression_list_api.md',
        'templates_api.md',
        'tracking_domains_api.md',
        'transmissions_api.md',
        'webhooks_api.md',
        'smtp_api.md'
    ];

function _md2html(obj, val, idx) {
    var name = (val.split('.'))[0];
    if (val === 'introduction.md') {
        name = 'index';
    }
    obj['aglio/'+ name +'.html'] = [ 'services/'+ val ];
    return obj;
}

function sectionName(md) {
    var name = (md.split('.'))[0];
    if (name === 'introduction') {
        name = 'index';
    }
    return name
}

function htmlFile(md) {
    var name = sectionName(md);
    return 'aglio/'+ name +'.html';
}

module.exports = function(grunt) {
    // Dynamically load any preexisting grunt tasks/modules
    matchdep.filterDev('grunt-*').forEach(grunt.loadNpmTasks);
    var cheerio = require('cheerio');

    // Configure existing grunt tasks and create custom ones
    grunt.initConfig({
        aglio: {
            build: {
                files: services.reduce(_md2html, {})
            },
        },

        dom_munger: {
            main: {
                src: services.map(htmlFile),
                options: {
                    callback: function($,file) {
                        // absolutify sub-section links
                        $('nav a[href^=#]').each(
                          function(idx, elt) {
                            var obj = $(elt);
                            var filename = (file.split('/'))[1];
                            var href = filename + obj.attr('href');
                            // Rename #top anchor so auto-expansion works as expected.
                            if (href == 'substitutions_reference.html#top') {
                                href = filename + '#substitutions-reference-top';
                            }
                            obj.attr('href', href);
                          }
                        );

                        var name = (file.split('.'))[0];
                        name = (name.split('/'))[1];
                        // Fix nav name, it's Overview for some reason
                        if (name == 'substitutions_reference') {
                            $('nav div.heading a[href^="substitutions_reference.html#"]').text('Substitutions Reference');
                        }
                        // save a copy of the fixed-up nav from the current page
                        // we'll use this in `copy`, below
                        grunt.option('dom_munger.getnav.'+ name, $('nav').html());

                        // don't write out file changes, we'll do that in `copy` too
                        return false;
                    }
                }
            }
        },

        copy: {
            main: {
                src: services.map(htmlFile),
                dest: './',
                options: {
                    process: function(content, srcpath) {
                        // get the global nav we build and cache below
                        var allnav = grunt.option('copy.allnav');
                        if (allnav === undefined) {
                            // build and cache global nav if we haven't yet this run
                            allnav = '';
                            var names = services.map(sectionName);
                            for (var idx in names) {
                                var name = names[idx];
                                var html = grunt.option('dom_munger.getnav.'+ name);
                                if (html === undefined) {
                                    grunt.log.fatal('no nav html for ['+ name +'], run dom_munger before copy!');
                                }
                                allnav = allnav + html;
                            }
                            grunt.option('copy.allnav', allnav);
                        }

                        // get a DOM for our global nav
                        $ = cheerio.load(allnav);
                        var file = (srcpath.split('/'))[1];
                        // css selector for current nav
                        var curNav = 'div.heading a[href^="'+ file +'#"]';
                        // anchor from current nav
                        var anchor = (($(curNav).attr('href')).split('#'))[1];

                        // indicate current page w/in nav
                        // FIXME: style info doesn't belong in Grunt, put this elsewhere,
                        // perhaps a per-"service" external stylesheet
                        $(curNav).attr('style', 'font-weight:bold;background-color:#fa6423;color:#fff;');
                        allnav = $.html();

                        // replace single-page nav with the global nav we built above
                        content = content.replace(/]*>.*?<\/nav>/, ''+ allnav +'');

                        // auto-expand nav on page load
                        var collapse = '    var nav = document.querySelectorAll(\'nav .resource-group .heading a[href$="#'+
                            anchor +'"]\');\n    toggleCollapseNav({target: nav[0]});\n';
                        content = content.replace(/(window\.onload\s*=\s*function\s*\(\)\s*\{[^}]+)\}/, '$1'+ collapse +'}');

                        return content;
                    }
                }
            }
        },

        concat: {
            options: {
                banner: 'FORMAT: X-1A' + grunt.util.linefeed +
                    'HOST: https://api.sparkpost.com/api/v1' +
                    grunt.util.linefeed + grunt.util.linefeed
            },
            prod: {
                src: services.map(function(s) { return 'services/' + s; }),
                dest: 'apiary.apib'
            }
        },

        connect: {
            apiary: {
                options: {
                    port: 4000,
                    hostname: '0.0.0.0',
                    open: true,
                    middleware: function(connect) {
                        return [
                            require('connect-livereload')(),
                            connect.static('apiary-previews'),
                            connect.directory('apiary-previews')
                        ];
                    }
                }
            }
        },

        shell: {
            test: {
                command : function(file) {
                    if (file) {
                        file = './services/' + file;
                    } else {
                        file = 'apiary.apib';
                    }
                    return 'node ./bin/api-blueprint-validator ' + file;
                },
                options : {
                    stdout : true,
                    stderr: false,
                    failOnError : true
                }
            }
        },

        watch: {
            apiaryDocs: {
                files: [ 'services/*.md', 'Gruntfile.js' ],
                tasks: [ 'generate-apiary-preview' ],
                options: {
                    livereload: true
                }
            }
        }
    });

    /**
     * Generates an apiary preview for an .md file
     * @param file The .md file
     * @returns {*|promise}
     */
    function generatePreview(file) {
        var deferred = q.defer();

        var blueprint = 'FORMAT: X-1A' +
            grunt.util.linefeed +
            'HOST: https://api.sparkpost.com/api/v1' +
            grunt.util.linefeed + grunt.util.linefeed +
            '# SparkPost API v1' +
            grunt.util.linefeed +
            fs.readFileSync('./services/' + file, 'utf-8');
        var embedOptions = { apiBlueprint: blueprint };

        var body = '\
<!DOCTYPE html>\n\
\n\
\n\
  <meta charset="UTF-8">\n\
  <title>' + file + '</title>\n\
\n\
\n\
  \n\
  \n\
\n\
\
';

        var output = file.split('\.')[0] + '.html';

        fs.writeFile('./apiary-previews/' + output, body, function(err) {
            if (err) {
                grunt.log.error('There was an error trying to write to ' + output, err);
                return deferred.reject(err);
            }
            return deferred.resolve();
        });

        return deferred.promise;
    }

    // grunt generate-apiary-preview - creates apiary previews for all meta
    grunt.registerTask('generate-apiary-preview', 'Creates preview files for all md files in services', function() {
        var done = this.async();
        try {
            fs.mkdirSync('./apiary-previews');
        } catch(e){}

        fs.readdir('./services', function(err, files) {
            q.all(files.map(generatePreview)).then(done, done);
        });
    });

    // grunt testFiles - runs apiary-blueprint-validator on individual blueprint files
    grunt.registerTask('testFiles', 'Validates individual blueprint files', services.map(function(s) {
        return 'shell:test:' + s;
    }));

    //grunt preview - creates a live-reloaded preview of the docs, Apiary-style
    grunt.registerTask('preview', 'View the apiary generated HTML files in the browser with all that live-reload goodness', [
        'generate-apiary-preview',
        'connect:apiary',
        'watch:apiaryDocs'
    ]);

    // grunt test - runs apiary-blueprint-validator on combined apiary.apib file
    grunt.registerTask('test', [ 'shell:test' ]);

    // grunt compile - concatenates all the individual blueprint files and validates it
    grunt.registerTask('compile', [ 'concat:prod', 'test' ]);

    // register default grunt command as grunt test
    grunt.registerTask('default', [ 'testFiles' ]);
};
<|endoftext|>


<commit_before>module.exports = function (grunt) {
    /*
    Install Grunt:
    -------------------
        npm install -g grunt-cli
        npm install -g grunt-init
        npm init (reads existing package.json file)

    Install Grunt Prerequisites:
    ---------------------
        ./_install_grunt_prerequisites.sh

    Gem Prerequisites:
    -----------------
        gem install sass
        gem install compass
        gem install image_optim
    */

    // Print the execution time for the tasks
    require('time-grunt')(grunt);

    // NPM tasks
    require('load-grunt-tasks')(grunt, [
        'grunt-*',
        '!grunt-template-jasmine-istanbul',
        '!grunt-template-jasmine-requirejs'
    ]);

    // Grunt init
    grunt.initConfig({

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

        build: {
            src: './src',
            release: './.release'
        },

        // Connect webserver, used to test DOM elements via Jasmine / PhantomJS
        connect: {
            server: {
                options: {
                    // Port to listen on
                    port: 1337
                }
            }
        },

        jasmine: {
             // run tests
            run: {
                src: [
                    '<%= build.src %>/**/*.js'
                ],
                options: {
                    host: 'http://127.0.0.1:1337/',
                    specs: [
                        'specs/**/*.js'
                    ],
                    helpers: [
                        'specs/helpers/*Helper.js',
                        'vendors/sinon/sinon.js'
                    ],
                    template: require('grunt-template-jasmine-requirejs'),
                    templateOptions: {
                        requireConfig: {
                            baseUrl: '<%= build.src %>/',
                            mainConfigFile: '<%= build.src %>/main.js'
                        }
                    }
                }
            },

            // code coverage
            istanbul: {
                src: [
                    '<%= build.src %>/**/*.js'
                ],
                options: {
                    specs: [
                        'specs/**/*Spec.js'
                    ],
                    helpers: [
                        'specs/helpers/*Helper.js',
                        'vendors/sinon/sinon.js'
                    ],
                    template: require('grunt-template-jasmine-istanbul'),
                    templateOptions: {
                        coverage: 'bin/coverage/coverage.json',
                        report: [
                            {
                                type: 'html',
                                options: {
                                    dir: 'bin/coverage/html'
                                }
                            },
                            {
                                type: 'text-summary'
                            }
                        ],
                        replace: false, // disable src replacing with template by instrumented sources
                        template: require('grunt-template-jasmine-requirejs'),
                        templateOptions: {
                            requireConfig: {
                                baseUrl: '<%= build.src %>/', // source base url.
                                config: {
                                    // grunt.config.get() is being evaluated at this point is unavailable
                                    // paths of sources being instrumented, should be same as jasmine
                                    instrumented: {
                                        src: grunt.file.expand('<%= build.src %>/*.js')
                                    }
                                },
                                // Callback to read the paths of the sources being instrumented
                                // Redirects requests to the proper locations
                                // @todo: clean code
                                callback: function () {
                                    define('instrumented', ['module'], function (module) {
                                        return module.config().src;
                                    });

                                    require(['instrumented'], function (instrumented) {
                                        var oldLoad = requirejs.load;
                                        requirejs.load = function (context, moduleName, url) {
                                            // normalize paths
                                            if ('./' === url.substring(0, 2)) {
                                                url = url.substring(2);
                                            } else
                                            if ('/' === url.substring(0, 1)) {
                                                url = url.substring(1);
                                            }

                                            // redirect
                                            if (-1 < instrumented.indexOf(url)) {
                                                url = './.grunt/grunt-contrib-jasmine/' + url;
                                            }

                                            return oldLoad.apply(this, [context, moduleName, url]);
                                        };
                                    });
                                }
                            }
                        }
                    }
                }
            }
        },

        jshint: {
            files: [
                '<%= build.src %>/**/*.js',
                'specs/**/*Spec.js',
                'Gruntfile.js'
            ],

            options: {
                boss: true,
                browser: true,
                curly: true,
                eqeqeq: true,
                eqnull: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,

                globals: {
                    // Env
                    console: true,

                    // Require / AMD
                    define: true,
                    module: true,
                    require: true,
                    requirejs: true,

                    // jQuery
                    $: true,
                    jQuery: true,

                    // Unit testing
                    afterEach: true,
                    beforeEach: true,
                    describe: true,
                    expect: true,
                    it: true,
                    sinon: true
                }
            }
        },

        requirejs: {
            compile: {
                options: {
                    baseUrl: '<%= build.src %>', // all modules are loaded relativly to this path.
                    fileExclusionRegExp: /^\.|release|node_modules|Gruntfile|\.md|package.json/,
                    findNestedDependencies: true,
                    include: 'main', // this is the trick for almond. Other files to include along with almond.
                    mainConfigFile: '<%= build.src %>/main.js', // main app config file
                    name: '../vendors/almond/almond', // path is relative to baseUrl. Targets 'name' AMD shim as the main module
                    optimize: 'none', // compression level
                    out: '<%= build.release %>/<%= pkg.name %>.min.js', // output compiled here

                    //Wrapping code, to avoid anyone accessing from the lobal scope.
                    wrap: {
                        start: "(function(global, define) {"+
                               "  var globalDefine = global.define;", // verifies amd is on the global scope

                        end:   "  var src = require('main');"+
                               "  if(typeof module !== 'undefined' && module.exports) {"+
                               "    module.exports = src;"+ // exports src from node
                               "  } else if(globalDefine) {"+
                               "    (function (define) {"+ // define src for AMD that already exists
                               "      define(function () { return src; });"+
                               "    }(globalDefine));"+
                               "  } else {"+
                               "    global['main'] = src;"+ // wire src to global after done
                               "  }"+
                               "}(this));"
                    }
                }
            }
        },

        compass: {
            dev: {
                options: {
                    sassDir: 'sass',
                    cssDir: 'css',
                    relativeAssets: true,
                    force: true,
                    assetCacheBuster: true,
                    outputStyle: 'nested'
                }
            },

            release: {
                options: {
                    sassDir: 'sass',
                    cssDir: '<%= build.release %>/css',
                    relativeAssets: true,
                    force: true,
                    outputStyle: 'compressed',
                    environment: 'production'
                }
            }
        },

        imagemin: {
            png: {
                options: {
                    // Can only be set on PNG. JPG is not supported.
                    optimizationLevel: 7
                },

                files: [
                    {
                        cwd: 'images',
                        dest: '<%= build.release %>/images',
                        expand: true,
                        ext: '.png',
                        src: [
                            '**/*.png'
                        ]
                    }
                ]
            },

            jpg: {
                options: {
                    progressive: true
                },

                files: [
                    {
                        cwd: 'images',
                        dest: '<%= build.release %>/images',
                        expand: true,
                        ext: '.jpg',
                        src: [
                            '**/*.jpg'
                        ]
                    }
                ]
            }
        },

        htmlmin: {
            release: {
                files: {
                    '<%= build.release %>/index.html': './index.html' // dest : src
                },

                options: {
                    collapseBooleanAttributes: true,
                    collapseWhitespace: true,
                    removeComments: true,
                    removeCommentsFromCDATA: true,
                    removeEmptyAttributes: true,
                    removeRedundantAttributes: true
                }
            }
        },

        // To enable 'watch' type `grunt watch`
        watch: {
            // watch js files and run jshint
            scripts: {
                files: [
                    '<%= jshint.files %>',
                    '<%= jasmine.run.options.specs %>'
                ],
                tasks: ['jshint'],
                options: {
                    spawn: false
                }
            },

            // watch sass files and compile them for dev
            compass: {
                files: ['<%= build.src %>/sass/{,*/}*.{scss,sass}'],
                tasks: ['compass:dev'],
                options: {
                    spawn: false
                }
            }
        },

        uglify: {
            release: {
                files: {
                    '<%= build.release %>/<%= pkg.name %>.min.js': '<%= build.release %>/<%= pkg.name %>.min.js' // dest : src (overrides the same file!))
                }
            },

            options: {
                sourceMap: false,
                banner: '/*! <%= pkg.name %>: version <%= pkg.version %>\n' +
                    '* Built on: <%= grunt.template.today("yyyy-mm-dd") %>\n' +
                    '* Author: <%= pkg.author %>\n' +
                    '* <%= pkg.description %>\n' +
                    '* Copyright (c) <%= grunt.template.today("yyyy") %> */',
            }
        },

        replace: {
            release: {
                src: '<%= build.release %>/index.html',
                overwrite: true,
                replacements: [{
                    from: 'src/main',
                    to: '<%= pkg.name %>.min'
                }]
            }
        },

        copy: {
            release: {
                expand: true,
                src: ['vendors/require/*'],
                dest: '<%= build.release %>/',
                filter: 'isFile'
            }
        }
    });

    // Default task
    grunt.registerTask('default', ['jshint', 'connect', 'jasmine', 'compass:dev']);

    // Unit testing task
    grunt.registerTask('test', ['connect', 'jasmine:run']);

    // Debug build task
    grunt.registerTask('debug', ['jshint', 'test', 'requirejs', 'compass:dev', 'imagemin', 'htmlmin', 'copy', 'replace:release']);

    // Release task
    grunt.registerTask('release', ['jshint', 'test', 'requirejs', 'compass:release', 'imagemin', 'htmlmin', 'uglify', 'copy', 'replace:release']);
};<commit_msg>modular loading tasks added<commit_after>module.exports = function (grunt) {
    /*
    Install Grunt:
    -------------------
        npm install -g grunt-cli
        npm install -g grunt-init
        npm init (reads existing package.json file)

    Install Grunt Prerequisites:
    ---------------------
        ./_install_grunt_prerequisites.sh

    Gem Prerequisites:
    -----------------
        gem install sass
        gem install compass
        gem install image_optim
    */

    // Print the execution time for the tasks
    require('time-grunt')(grunt);

    var loadConfig = require('load-grunt-config'),
        pkg = grunt.file.readJSON('package.json');

    loadConfig(grunt, {
        configPath: __dirname + '/grunt/tasks',
        config: {
            pkg: pkg,

            build: {
                src: './src',
                release: './.release',
                banner: require('fs').readFileSync(__dirname + '/grunt/banner.txt', 'utf8')
            }
        }
    });

    // load grunt folder tasks.
    grunt.loadTasks('grunt');

    // Unit testing task
    grunt.registerTask('test', [
        'connect',
        'jasmine:run'
    ]);

    // Default task
    grunt.registerTask('default', [
        'jshint:src',
        'test',
        'compass:dev',
        'clean:after_build'
    ]);

    // Debug build task
    grunt.registerTask('debug', [
        'jshint:src',
        'test',
        'requirejs',
        'compass:dev',
        'imagemin',
        'htmlmin',
        'copy',
        'replace:release',
        'clean:after_build'
    ]);

    // Release task
    grunt.registerTask('release', [
        'jshint:src',
        'test',
        'requirejs',
        'compass:release',
        'imagemin',
        'htmlmin',
        'uglify',
        'copy',
        'replace:release',
        'clean:after_build'
    ]);
};<|endoftext|>


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

        // Task configuration.
        clean: {
            dist: ['dist']
        },

        copy : {
            js_client : {
                cwd: 'src/',
                src : ['js/client/**/*.js', 'js/libs/**/*.js'],
                dest: 'dist/',
                expand: true
            },
            html : {
                cwd: 'src/',
                src : ['*.html'],
                dest : 'dist/',
                expand: true
            }
        },

        compass: {
            dist: {
                options: {
                    sassDir: 'src/sass',
                    cssDir: 'dist/css',
                    environment: 'production'
                }
            },
			dev: {
                options: {
                    sassDir: 'src/sass',
                    cssDir: 'dist/css'
                }
            }
        },

		browserify: {
            web: {
                dest: 'dist/js/app.js',
                src: ['js/main.js'],
                options: {
                    watch: true
                }
            }
        },

        watch: {
            sass: {
                files: ['src/sass/**/*.scss', 'src/css/**/*.css'],
                tasks: ['compass:dev']
            },
            html: {
                files: 'src/**/*.html',
                tasks: ['copy:html']
            },
            js: {
                files: 'src/js/**/*.js',
                tasks: ['copy:js']
            }
        },

        connect: {
            server: {
                options: {
                    port: 8080,
                    base: 'dist'
                }
            }
        }

    });
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-browserify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('bootstrap-sass');

    grunt.registerTask('build-prod', ['clean', 'copy', 'compass:dist']);
    grunt.registerTask('build-dev', ['clean', 'copy', 'compass:dev']);
    grunt.registerTask('default',['build-prod']);
    grunt.registerTask('dev', ['build-dev', 'connect:server', 'watch']);
    grunt.registerTask('jenkins',['']);
}
<commit_msg>Fixed issue with JS files in watch task<commit_after>module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        // Task configuration.
        clean: {
            dist: ['dist']
        },

        copy : {
            js_client : {
                cwd: 'src/',
                src : ['js/client/**/*.js', 'js/libs/**/*.js'],
                dest: 'dist/',
                expand: true
            },
            html : {
                cwd: 'src/',
                src : ['*.html'],
                dest : 'dist/',
                expand: true
            }
        },

        compass: {
            dist: {
                options: {
                    sassDir: 'src/sass',
                    cssDir: 'dist/css',
                    environment: 'production'
                }
            },
			dev: {
                options: {
                    sassDir: 'src/sass',
                    cssDir: 'dist/css'
                }
            }
        },

		browserify: {
            web: {
                dest: 'dist/js/app.js',
                src: ['js/main.js'],
                options: {
                    watch: true
                }
            }
        },

        watch: {
            sass: {
                files: ['src/sass/**/*.scss', 'src/css/**/*.css'],
                tasks: ['compass:dev']
            },
            html: {
                files: 'src/**/*.html',
                tasks: ['copy:html']
            },
            js_client: {
                files: 'src/js/client/**/*.js',
                tasks: ['copy:js_client']
            }
        },

        connect: {
            server: {
                options: {
                    port: 8080,
                    base: 'dist'
                }
            }
        }

    });
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-browserify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('bootstrap-sass');

    grunt.registerTask('build-prod', ['clean', 'copy', 'compass:dist']);
    grunt.registerTask('build-dev', ['clean', 'copy', 'compass:dev']);
    grunt.registerTask('default',['build-prod']);
    grunt.registerTask('dev', ['build-dev', 'connect:server', 'watch']);
    grunt.registerTask('jenkins',['']);
}
<|endoftext|>


<commit_before>var testServer = require('./test/setupServer');

var MOCHA_TIMEOUT_S = 10,
	MOCHA_TIMEOUT_MS = MOCHA_TIMEOUT_S * 1000,
	MOCHA_OPTIONS = {
		reporter: 'spec',
		timeout: MOCHA_TIMEOUT_MS
	};

module.exports = function(grunt) {
	grunt.loadNpmTasks('grunt-mocha-test');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-exec');

	grunt.initConfig({
		exec: {
			coverage: {
				command: 'istanbul cover _mocha -- -t ' + MOCHA_TIMEOUT_MS + ' --root src/ test/'
			},
			coveralls: {
				command: 'istanbul cover _mocha --report lcovonly -- -t ' + MOCHA_TIMEOUT_MS + ' --root src/ test/'
			}
		},
		clean: {
			coverage: {
				src: ['coverage/']
			}
		},
		watch: {
			common: {
				files: ['src/**/*.js', 'test/**/*.js', 'Gruntfile.js'],
				tasks: ['test']
			}
		},
		jshint: {
			all: ['src/**/*.js', 'test/**/*.js']
		},
		mochaTest: {
			staticScraper: {
				src: 'test/StaticScraper.js',
				options: MOCHA_OPTIONS
			},
			dynamicScraper: {
				src: 'test/DynamicScraper.js',
				options: MOCHA_OPTIONS
			},
			scraperPromise: {
				src: 'test/ScraperPromise.js',
				options: MOCHA_OPTIONS
			},
			router: {
				src: 'test/Router.js',
				options: MOCHA_OPTIONS
			},
			all: {
				src: ['test/StaticScraper.js', 'test/DynamicScraper.js', 'test/ScraperPromise.js', 'test/Router.js'],
				options: MOCHA_OPTIONS
			}
		}
	});

	var server;

	grunt.registerTask('serve', 'Starts express testing server', function() {
		server = testServer(grunt);
	});

	grunt.registerTask('unserve', function() {
		if (server) {
			server.close();
		}
	});

	grunt.registerTask('serve-and-test', ['serve', 'mochaTest:all', 'unserve']);

	grunt.registerTask('coverage', ['clean', 'jshint', 'serve', 'exec:coverage', 'unserve']);
	grunt.registerTask('coveralls', ['clean', 'jshint', 'serve', 'exec:coveralls', 'unserve']);

	grunt.registerTask('test', ['jshint', 'serve-and-test']);

	grunt.registerTask('watch-all', ['serve', 'watch', 'unserve']);
};<commit_msg>Added relative path to _mocha, in the exec:coveralls target.<commit_after>var testServer = require('./test/setupServer');

var MOCHA_TIMEOUT_S = 10,
	MOCHA_TIMEOUT_MS = MOCHA_TIMEOUT_S * 1000,
	MOCHA_OPTIONS = {
		reporter: 'spec',
		timeout: MOCHA_TIMEOUT_MS
	};

module.exports = function(grunt) {
	grunt.loadNpmTasks('grunt-mocha-test');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-exec');

	grunt.initConfig({
		exec: {
			coverage: {
				command: 'istanbul cover _mocha -- -t ' + MOCHA_TIMEOUT_MS + ' --root src/ test/'
			},
			coveralls: {
				command: 'istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t ' + MOCHA_TIMEOUT_MS + ' --root src/ test/'
			}
		},
		clean: {
			coverage: {
				src: ['coverage/']
			}
		},
		watch: {
			common: {
				files: ['src/**/*.js', 'test/**/*.js', 'Gruntfile.js'],
				tasks: ['test']
			}
		},
		jshint: {
			all: ['src/**/*.js', 'test/**/*.js']
		},
		mochaTest: {
			staticScraper: {
				src: 'test/StaticScraper.js',
				options: MOCHA_OPTIONS
			},
			dynamicScraper: {
				src: 'test/DynamicScraper.js',
				options: MOCHA_OPTIONS
			},
			scraperPromise: {
				src: 'test/ScraperPromise.js',
				options: MOCHA_OPTIONS
			},
			router: {
				src: 'test/Router.js',
				options: MOCHA_OPTIONS
			},
			all: {
				src: ['test/StaticScraper.js', 'test/DynamicScraper.js', 'test/ScraperPromise.js', 'test/Router.js'],
				options: MOCHA_OPTIONS
			}
		}
	});

	var server;

	grunt.registerTask('serve', 'Starts express testing server', function() {
		server = testServer(grunt);
	});

	grunt.registerTask('unserve', function() {
		if (server) {
			server.close();
		}
	});

	grunt.registerTask('serve-and-test', ['serve', 'mochaTest:all', 'unserve']);

	grunt.registerTask('coverage', ['clean', 'jshint', 'serve', 'exec:coverage', 'unserve']);
	grunt.registerTask('coveralls', ['clean', 'jshint', 'serve', 'exec:coveralls', 'unserve']);

	grunt.registerTask('test', ['jshint', 'serve-and-test']);

	grunt.registerTask('watch-all', ['serve', 'watch', 'unserve']);
};<|endoftext|>


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

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    manifest: grunt.file.readJSON('source/manifest.json'),
    compress: {
      main: {
        options: {
          archive: 'GeocachingUtils_<%= manifest.version %>.zip'
        },
        files: [
          {
            src: ['build/**']
          }
        ]
      }
    },
    copy: {
      main: {
        expand: true,
        cwd: 'source',
        src: '**',
        dest: 'build',
      },
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        eqnull: true,
        browser: true,
        esnext: true,
        bitwise: true,
        globals: {
          jQuery: true
        },
        ignores: [
          'build/js/lib/**/*.js'
        ]
      },
      all: ['build/**/*.js']
    },
    uglify: {
      all: {
        files: [{
            expand: true,
            cwd: 'build/',
            src: ['**/*.js', '!**/*.min.js'],
            dest: 'build/',
            ext: '.js'
        }]
      }
    },
    clean: {
      build: ['build/'],
      release: ['GeocachingUtils_*.zip']
    }
  });

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

  grunt.registerTask('cleanUp', ['clean'])
  grunt.registerTask('build', ['cleanUp', 'copy', 'jshint']);
  grunt.registerTask('default', ['build', 'uglify', 'compress']);
};<commit_msg>renamed "main" to "build" and removed a wrong comma<commit_after>module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    manifest: grunt.file.readJSON('source/manifest.json'),
    compress: {
      main: {
        options: {
          archive: 'GeocachingUtils_<%= manifest.version %>.zip'
        },
        files: [
          {
            src: ['build/**']
          }
        ]
      }
    },
    copy: {
      build: {
        expand: true,
        cwd: 'source',
        src: '**',
        dest: 'build',
      }
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        eqnull: true,
        browser: true,
        esnext: true,
        bitwise: true,
        globals: {
          jQuery: true
        },
        ignores: [
          'build/js/lib/**/*.js'
        ]
      },
      all: ['build/**/*.js']
    },
    uglify: {
      all: {
        files: [{
            expand: true,
            cwd: 'build/',
            src: ['**/*.js', '!**/*.min.js'],
            dest: 'build/',
            ext: '.js'
        }]
      }
    },
    clean: {
      build: ['build/'],
      release: ['GeocachingUtils_*.zip']
    }
  });

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

  grunt.registerTask('cleanUp', ['clean'])
  grunt.registerTask('build', ['cleanUp', 'copy', 'jshint']);
  grunt.registerTask('default', ['build', 'uglify', 'compress']);
};<|endoftext|>


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

  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-gh-pages');

  grunt.initConfig({
    'connect': {
      demo: {
        options: {
          open: {
            target: 'http://localhost:8000/'
          },
          keepalive: true
        }
      }
    },
    'gh-pages': {
      src: [
        'index.html',
        'bower_components/**/*'
      ]
    }
  });

  grunt.registerTask('serve', ['connect']);
  grunt.registerTask('deploy', ['gh-pages']);
};
<commit_msg>Configure missed files in deploy task<commit_after>module.exports = function (grunt) {
  'use strict';

  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-gh-pages');

  grunt.initConfig({
    'connect': {
      demo: {
        options: {
          open: {
            target: 'http://localhost:8000/'
          },
          keepalive: true
        }
      }
    },
    'gh-pages': {
      src: [
        'index.html',
        'bootstrap-rating.js',
        'bootstrap-rating.css',
        'bower_components/**/*'
      ]
    }
  });

  grunt.registerTask('serve', ['connect']);
  grunt.registerTask('deploy', ['gh-pages']);
};
<|endoftext|>


<commit_before>'use strict'

var path = require('path')

module.exports = function (grunt) {

  grunt.initConfig({
    clean: [ 'snippets/*' ],
    wrap: {
      files: {
        dest: 'snippets',
        src: [ 'templates/*.js' ]
      },
      header: 'sublime/snippet-header.txt',
      footer: 'sublime/snippet-footer.txt'
    }
  })

  grunt.loadNpmTasks('grunt-contrib-clean')

  grunt.registerTask('wrap', 'Wraps source files with specified header and footer', function () {
    var data = grunt.config('wrap')
    var files = grunt.file.expand(data.files.src)
    var dest = path.resolve(grunt.template.process(data.files.dest))
    var rawHeader = grunt.file.read(data.header)
    var rawFooter = grunt.file.read(data.footer)
    var sep = grunt.util.linefeed

    files.forEach(function (f) {
      var header = grunt.template.process(rawHeader, {
        data: {
          fileName: f,
          date: grunt.template.today('dd mmmm yyyy')
        }
      })
      var footer = grunt.template.process(rawFooter, {
        data: {
          trigger: path.basename(f, path.extname(f, '.js'))
        }
      })

      var file = path.join(dest, path.basename(f, path.extname(f, '.js')) + '.sublime-snippet')
      var contents = grunt.file.read(f)

      grunt.file.write(file, header + sep + contents + sep + footer)

      var displayF = path.join(data.files.dest, path.relative(dest, file))
      grunt.log.write('Creating file ' + displayF.cyan + '... ')
      grunt.log.ok()
    })

  })
}
<commit_msg>register default grunt task<commit_after>'use strict'

var path = require('path')

module.exports = function (grunt) {

  grunt.initConfig({
    clean: [ 'snippets/*' ],
    wrap: {
      files: {
        dest: 'snippets',
        src: [ 'templates/*.js' ]
      },
      header: 'sublime/snippet-header.txt',
      footer: 'sublime/snippet-footer.txt'
    }
  })

  grunt.loadNpmTasks('grunt-contrib-clean')

  grunt.registerTask('default', [ 'clean', 'wrap' ])

  grunt.registerTask('wrap', 'Wraps source files with specified header and footer', function () {
    var data = grunt.config('wrap')
    var files = grunt.file.expand(data.files.src)
    var dest = path.resolve(grunt.template.process(data.files.dest))
    var rawHeader = grunt.file.read(data.header)
    var rawFooter = grunt.file.read(data.footer)
    var sep = grunt.util.linefeed

    files.forEach(function (f) {
      var header = grunt.template.process(rawHeader, {
        data: {
          fileName: f,
          date: grunt.template.today('dd mmmm yyyy')
        }
      })
      var footer = grunt.template.process(rawFooter, {
        data: {
          trigger: path.basename(f, path.extname(f, '.js'))
        }
      })

      var file = path.join(dest, path.basename(f, path.extname(f, '.js')) + '.sublime-snippet')
      var contents = grunt.file.read(f)

      grunt.file.write(file, header + sep + contents + sep + footer)

      var displayF = path.join(data.files.dest, path.relative(dest, file))
      grunt.log.write('Creating file ' + displayF.cyan + '... ')
      grunt.log.ok()
    })

  })
}
<|endoftext|>