<commit_before>// Generated on 2014-12-03 using
// generator-webapp 0.5.1
'use strict';

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

module.exports = function (grunt) {

    // Time how long tasks take. Can help when optimizing build times
    require('time-grunt')(grunt);

    // Load grunt tasks automatically
    require('load-grunt-tasks')(grunt, {pattern: ['grunt-*', 'assemble']});

    // Configurable paths
    var config = {
        app:        './app',
        dist:       './dist',
        tpl:        './app/templates',
        pages:      './app/templates/pages',
        partials:   './app/templates/partials',
        vendor:     './bower_components',
        expand:     true,
    };

    // Rewrite snippets
    var rewriteRulesSnippet = require('grunt-connect-rewrite/lib/utils').rewriteRequest;

    // Set environment
    grunt.config('env', grunt.option('env') || process.env.GRUNT_ENV || 'development');

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

        // Project settings
        config:   config,
        pkg:      grunt.file.readJSON('package.json'),
        versions: grunt.file.readJSON('./data/versions.json'),
        banner:   '/*! phpMyFAQ - http://www.phpmyfaq.de/ - Copyright (c) 2001-2015 Thorsten Rinne - compiled <%= grunt.template.today("yyyy-mm-dd") %> */\n',

        // Fetch external data for downloads
        curl: {
            getVersions: {
                src: 'http://api.phpmyfaq.de/versions',
                dest: './data/versions.json'
            },
            getStableInfo: {
                src: 'http://download.phpmyfaq.de/info/<%= versions.stable %>',
                dest: './data/stable.json'
            },
            getDevelopmentInfo: {
                src: 'http://download.phpmyfaq.de/info/<%= versions.development %>',
                dest: './data/development.json'
            }
        },

        // Watches files for changes and runs tasks based on the changed files
        watch: {
            assemble: {
                files: [
                    './app/templates/pages/**/*',
                    './app/templates/partials/**/*',
                    './app/templates/**/*'
                ],
                tasks: ['assemble'],
                options: {
                    spawn: false
                }
            },
            bower: {
                files: ['bower.json'],
                tasks: ['wiredep']
            },
            js: {
                files: ['<%= config.app %>/scripts/{,*/}*.js'],
                tasks: ['jshint'],
                options: {
                    livereload: true
                }
            },
            jstest: {
                files: ['test/spec/{,*/}*.js'],
                tasks: ['test:watch']
            },
            gruntfile: {
                files: ['Gruntfile.js']
            },
            less: {
                files: ['<%= config.app %>/less/{,*/}*.less'],
                tasks: ['less:development', 'newer:copy:styles', 'autoprefixer']
            },
            styles: {
                files: ['<%= config.app %>/assets/css/{,*/}*.css'],
                tasks: ['newer:copy:styles', 'autoprefixer']
            },
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    '<%= config.app %>/assets/css/{,*/}*.css',
                    '<%= config.app %>/images/{,*/}*'
                ]
            }
        },

        // Assemble
        assemble: {
            options: {
                flatten: true,
                data: ['./data/' + grunt.config('env') + '/*.{json,yml}', './data/*.{json,yml}', 'package.json'],
                plugins: [
                    'assemble-contrib-permalinks'
                ],
                helpers: [
                    'handlebars-helper-compose',
                    'handlebars-helper-moment',
                    'handlebars-helper-inarray',
                    './app/templates/helpers/*.js'
                ],
                assets: './dest/public',
                partials: [
                    './app/templates/partials/*.hbs',
                    './app/templates/components/*.hbs'
                ],
                layoutdir: './app/templates/layouts/',
                layout: 'default.hbs',
                sitemap: {
                    homepage: '<%= pkg.url %>',
                    changefreq: 'daily',
                    priority: '0.8',
                    robot: true
                },
                permalinks: {
                    structure: ':basename/index.html'
                },
                compose: {
                    cwd: '<%= config.devblog %>'
                }
            },
            pages: {
                files: [
                    {
                        src: './app/templates/pages/*.{hbs,md}',
                        dest: './dist/'
                    }
                ]
            },
            docs: {
                src: ['./app/templates/pages/docs/*.{hbs,md}'],
                dest: './dist/docs/'
            },
            news: {
                src: ['./app/templates/pages/news/*.{hbs,md}'],
                dest: './dist/news/'
            },
            security: {
                src: ['./app/templates/pages/security/*.{hbs,md}'],
                dest: './dist/security/'
            }
        },

        // The actual grunt server settings
        connect: {
            options: {
                port: 9000,
                open: true,
                livereload: 35729,
                // Change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            rules: [
                {
                    from: '(^((?!css|html|js|images|fonts|\/$).)*$)',
                    to: '$1.html'
                }
            ],
            livereload: {
                options: {
                    base: './',
                    middleware: function (connect, options) {
                        var middlewares = [];

                        // RewriteRules support
                        middlewares.push(rewriteRulesSnippet);

                        if (!Array.isArray(options.base)) {
                            options.base = [options.base];
                        }

                        var directory = options.directory || options.base[options.base.length - 1];
                        options.base.forEach(function() {
                            // Serve static files.
                            middlewares.push(connect.static('.tmp'));
                            middlewares.push(connect().use('/bower_components', connect.static('./bower_components')));
                            middlewares.push(connect.static(config.app));
                            middlewares.push(connect.static(config.dist));
                        });

                        // Make directory browse-able.
                        middlewares.push(connect.directory(directory));

                        return middlewares;
                    }
                }
            },
            test: {
                options: {
                    open: false,
                    port: 9001,
                    middleware: function (connect) {
                        return [
                            connect.static('.tmp'),
                            connect.static('test'),
                            connect().use('/bower_components', connect.static('./bower_components')),
                            connect.static(config.app)
                        ];
                    }
                }
            },
            dist: {
                options: {
                    base: '<%= config.dist %>',
                    livereload: false
                }
            }
        },

        // Empties folders to start fresh
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= config.dist %>/*',
                        '!<%= config.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },

        // Make sure code styles are up to par and there are no obvious mistakes
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: require('jshint-stylish')
            },
            all: [
                'Gruntfile.js',
                '<%= config.app %>/scripts/{,*/}*.js',
                '!<%= config.app %>/scripts/vendor/*',
                'test/spec/{,*/}*.js'
            ]
        },

        // Mocha testing framework configuration options
        mocha: {
            all: {
                options: {
                    run: true,
                    urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
                }
            }
        },

        // Add vendor prefixed styles
        autoprefixer: {
            options: {
                browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.app %>/assets/css',
                    src: '{,*/}*.css',
                    dest: '<%= config.app %>/assets/css/'
                }]
            }
        },

        // Automatically inject Bower components into the HTML file
        wiredep: {
            app: {
                ignorePath: /^\/|\.\.\//,
                src: ['<%= config.app %>/*.html'],
                exclude: ['bower_components/bootstrap/dist/js/bootstrap.js']
            }
        },

        // Renames files for browser caching purposes
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= config.dist %>/assets/js/{,*/}*.js',
                        '<%= config.dist %>/assets/css/{,*/}*.css',
                        '<%= config.dist %>/images/{,*/}*.*',
                        '<%= config.dist %>/assets/fonts/{,*/}*.*',
                        '<%= config.dist %>/*.{ico,png}'
                    ]
                }
            }
        },

        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            options: {
                dest: '<%= config.dist %>'
            },
            html: '<%= config.app %>/index.html'
        },

        // Performs rewrites based on rev and the useminPrepare configuration
        usemin: {
            options: {
                assetsDirs: [
                    '<%= config.dist %>/assets',
                    '<%= config.dist %>/images'
                ]
            },
            html: ['<%= config.dist %>/{,*/}*.html'],
            css: ['<%= config.dist %>/assets/css/{,*/}*.css']
        },

        // The following *-min tasks produce minified files in the dist folder
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.app %>/images',
                    src: '{,*/}*.{gif,jpeg,jpg,png}',
                    dest: '<%= config.dist %>/images'
                }]
            }
        },

        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= config.dist %>/images'
                }]
            }
        },

        htmlmin: {
            dist: {
                options: {
                    collapseBooleanAttributes: true,
                    collapseWhitespace: true,
                    conservativeCollapse: true,
                    removeAttributeQuotes: true,
                    removeCommentsFromCDATA: true,
                    removeEmptyAttributes: true,
                    removeOptionalTags: true,
                    removeRedundantAttributes: true,
                    useShortDoctype: true
                },
                files: [{
                    expand: true,
                    cwd: '<%= config.dist %>',
                    src: '{,*/}*.html',
                    dest: '<%= config.dist %>'
                }]
            }
        },

        // Concats vendor files
        concat: {
            options: {
                banner: '<%= banner %>',
                stripBanners: true
            },
            dist: {
                src: [
                    'bower_components/jquery/dist/jquery.min.js',
                    'bower_components/retinajs/dist/retina.min.js',
                    'bower_components/bootstrap/dist/js/bootstrap.min.js',
                    'bower_components/handlebars/handlebars.min.js'
                ],
                dest: '<%= config.app %>/assets/js/vendor.js'
            }
        },
        // Copies remaining files to places other tasks can use
        copy: {
            dist: {
                files: [
                    {
                        expand: true,
                        dot: true,
                        cwd: '<%= config.app %>',
                        dest: '<%= config.dist %>',
                        src: [
                            '*.{ico,png,txt}',
                            'images/{,*/}*.webp',
                            '{,*/}*.html',
                            'styles/fonts/{,*/}*.*'
                        ]
                    },
                    {
                        src: '<%= config.app %>/.htaccess',
                        dest: '<%= config.dist %>/.htaccess'
                    },
                    {
                        expand: true,
                        dot: true,
                        cwd: 'bower_components/font-awesome/',
                        src: 'fonts/*',
                        dest: '<%= config.dist %>/assets'
                    }
                ]
            },
            styles: {
                expand: true,
                dot: true,
                cwd: '<%= config.app %>/assets/css',
                dest: '<%= config.dist %>/assets/css',
                src: '{,*/}*.css'
            },
            javascripts: {
                expand: true,
                dot: true,
                cwd: '<%= config.app %>/assets/js',
                dest: '<%= config.dist %>/assets/js',
                src: '{,*/}*.js'
            }
        },

        // Generates a custom Modernizr build that includes only the tests you
        // reference in your app
        modernizr: {
            dist: {
                devFile: 'bower_components/modernizr/modernizr.js',
                outputFile: '<%= config.dist %>/assets/js/modernizr.js',
                files: {
                    src: [
                        '<%= config.dist %>/assets/js/{,*/}*.js',
                        '<%= config.dist %>/assets/css/{,*/}*.css',
                        '!<%= config.dist %>/assets/js/*'
                    ]
                },
                uglify: true
            }
        },

        // LESS stuff
        less: {
            development: {
                options: {
                    paths: ['styles']
                },
                files: {
                    '<%= config.app %>/assets/css/main.css': '<%= config.app %>/less/*.less',
                    '<%= config.dist %>/assets/css/main.css': '<%= config.app %>/less/*.less'
                }
            },
            production: {
                options: {
                    paths: ['styles'],
                    cleancss: true
                },
                files: {
                    '<%= config.app %>/assets/css/main.css': 'app/less/*.less'
                }
            }
        },

        // Run some tasks in parallel to speed up build process
        concurrent: {
            server: [
                'less:development',
                'concat',
                'copy:styles'
            ],
            test: [
                'less:development',
                'copy:styles'
            ],
            dist: [
                'less:production',
                'concat',
                'copy:styles',
                'copy:javascripts',
                'imagemin',
                'svgmin'
            ]
        },

        // Deployment via FTP
        'ftp-deploy': {
            build: {
                auth: {
                    host: 'www.phpmyfaq.de',
                    port: 21,
                    authKey: 'production'
                },
                src: '<%= config.dist %>',
                dest: '/staging.phpmyfaq.de'
            }
        }

    });

    grunt.registerTask('serve', 'start the server and preview your app, --allow-remote for remote access', function (target) {
        if (grunt.option('allow-remote')) {
            grunt.config.set('connect.options.hostname', '0.0.0.0');
        }
        if (target === 'dist') {
            return grunt.task.run(['build', 'connect:dist:keepalive']);
        }

        grunt.task.run([
            'clean:server',
            'fetchVersions',
            'fetchDownloadInfos',
            'wiredep',
            'concurrent:server',
            'autoprefixer',
            'assemble',
            'configureRewriteRules',
            'connect:livereload',
            'watch'
        ]);
    });

    grunt.registerTask('test', function (target) {
        if (target !== 'watch') {
            grunt.task.run([
                'clean:server',
                'concurrent:test',
                'autoprefixer'
            ]);
        }

        grunt.task.run([
            'assemble',
            'configureRewriteRules',
            'connect:test',
            'mocha'
        ]);
    });

    grunt.registerTask('build', [
        'clean:dist',
        'fetchVersions',
        'fetchDownloadInfos',
        'assemble',
        'wiredep',
        'useminPrepare',
        'concurrent:dist',
        'autoprefixer',
        'copy:dist',
        'modernizr',
        'usemin',
        'htmlmin'
    ]);

    grunt.registerTask('default', [
        'newer:jshint',
        'build'
    ]);

    grunt.registerTask('fetchVersions', [
        'curl:getVersions'
    ]);

    grunt.registerTask('fetchDownloadInfos', [
        'curl:getStableInfo',
        'curl:getDevelopmentInfo'
    ]);

    grunt.registerTask('deploy', [
        'newer:jshint',
        'build',
        'ftp-deploy'
    ]);

};
<commit_msg>Fixed JSHint issue<commit_after>// Generated on 2014-12-03 using
// generator-webapp 0.5.1
'use strict';

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

module.exports = function (grunt) {

    // Time how long tasks take. Can help when optimizing build times
    require('time-grunt')(grunt);

    // Load grunt tasks automatically
    require('load-grunt-tasks')(grunt, {pattern: ['grunt-*', 'assemble']});

    // Configurable paths
    var config = {
        app:        './app',
        dist:       './dist',
        tpl:        './app/templates',
        pages:      './app/templates/pages',
        partials:   './app/templates/partials',
        vendor:     './bower_components',
        expand:     true
    };

    // Rewrite snippets
    var rewriteRulesSnippet = require('grunt-connect-rewrite/lib/utils').rewriteRequest;

    // Set environment
    grunt.config('env', grunt.option('env') || process.env.GRUNT_ENV || 'development');

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

        // Project settings
        config:   config,
        pkg:      grunt.file.readJSON('package.json'),
        versions: grunt.file.readJSON('./data/versions.json'),
        banner:   '/*! phpMyFAQ - http://www.phpmyfaq.de/ - Copyright (c) 2001-2015 Thorsten Rinne - compiled <%= grunt.template.today("yyyy-mm-dd") %> */\n',

        // Fetch external data for downloads
        curl: {
            getVersions: {
                src: 'http://api.phpmyfaq.de/versions',
                dest: './data/versions.json'
            },
            getStableInfo: {
                src: 'http://download.phpmyfaq.de/info/<%= versions.stable %>',
                dest: './data/stable.json'
            },
            getDevelopmentInfo: {
                src: 'http://download.phpmyfaq.de/info/<%= versions.development %>',
                dest: './data/development.json'
            }
        },

        // Watches files for changes and runs tasks based on the changed files
        watch: {
            assemble: {
                files: [
                    './app/templates/pages/**/*',
                    './app/templates/partials/**/*',
                    './app/templates/**/*'
                ],
                tasks: ['assemble'],
                options: {
                    spawn: false
                }
            },
            bower: {
                files: ['bower.json'],
                tasks: ['wiredep']
            },
            js: {
                files: ['<%= config.app %>/scripts/{,*/}*.js'],
                tasks: ['jshint'],
                options: {
                    livereload: true
                }
            },
            jstest: {
                files: ['test/spec/{,*/}*.js'],
                tasks: ['test:watch']
            },
            gruntfile: {
                files: ['Gruntfile.js']
            },
            less: {
                files: ['<%= config.app %>/less/{,*/}*.less'],
                tasks: ['less:development', 'newer:copy:styles', 'autoprefixer']
            },
            styles: {
                files: ['<%= config.app %>/assets/css/{,*/}*.css'],
                tasks: ['newer:copy:styles', 'autoprefixer']
            },
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    '<%= config.app %>/assets/css/{,*/}*.css',
                    '<%= config.app %>/images/{,*/}*'
                ]
            }
        },

        // Assemble
        assemble: {
            options: {
                flatten: true,
                data: ['./data/' + grunt.config('env') + '/*.{json,yml}', './data/*.{json,yml}', 'package.json'],
                plugins: [
                    'assemble-contrib-permalinks'
                ],
                helpers: [
                    'handlebars-helper-compose',
                    'handlebars-helper-moment',
                    'handlebars-helper-inarray',
                    './app/templates/helpers/*.js'
                ],
                assets: './dest/public',
                partials: [
                    './app/templates/partials/*.hbs',
                    './app/templates/components/*.hbs'
                ],
                layoutdir: './app/templates/layouts/',
                layout: 'default.hbs',
                sitemap: {
                    homepage: '<%= pkg.url %>',
                    changefreq: 'daily',
                    priority: '0.8',
                    robot: true
                },
                permalinks: {
                    structure: ':basename/index.html'
                },
                compose: {
                    cwd: '<%= config.devblog %>'
                }
            },
            pages: {
                files: [
                    {
                        src: './app/templates/pages/*.{hbs,md}',
                        dest: './dist/'
                    }
                ]
            },
            docs: {
                src: ['./app/templates/pages/docs/*.{hbs,md}'],
                dest: './dist/docs/'
            },
            news: {
                src: ['./app/templates/pages/news/*.{hbs,md}'],
                dest: './dist/news/'
            },
            security: {
                src: ['./app/templates/pages/security/*.{hbs,md}'],
                dest: './dist/security/'
            }
        },

        // The actual grunt server settings
        connect: {
            options: {
                port: 9000,
                open: true,
                livereload: 35729,
                // Change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            rules: [
                {
                    from: '(^((?!css|html|js|images|fonts|\/$).)*$)',
                    to: '$1.html'
                }
            ],
            livereload: {
                options: {
                    base: './',
                    middleware: function (connect, options) {
                        var middlewares = [];

                        // RewriteRules support
                        middlewares.push(rewriteRulesSnippet);

                        if (!Array.isArray(options.base)) {
                            options.base = [options.base];
                        }

                        var directory = options.directory || options.base[options.base.length - 1];
                        options.base.forEach(function() {
                            // Serve static files.
                            middlewares.push(connect.static('.tmp'));
                            middlewares.push(connect().use('/bower_components', connect.static('./bower_components')));
                            middlewares.push(connect.static(config.app));
                            middlewares.push(connect.static(config.dist));
                        });

                        // Make directory browse-able.
                        middlewares.push(connect.directory(directory));

                        return middlewares;
                    }
                }
            },
            test: {
                options: {
                    open: false,
                    port: 9001,
                    middleware: function (connect) {
                        return [
                            connect.static('.tmp'),
                            connect.static('test'),
                            connect().use('/bower_components', connect.static('./bower_components')),
                            connect.static(config.app)
                        ];
                    }
                }
            },
            dist: {
                options: {
                    base: '<%= config.dist %>',
                    livereload: false
                }
            }
        },

        // Empties folders to start fresh
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= config.dist %>/*',
                        '!<%= config.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },

        // Make sure code styles are up to par and there are no obvious mistakes
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: require('jshint-stylish')
            },
            all: [
                'Gruntfile.js',
                '<%= config.app %>/scripts/{,*/}*.js',
                '!<%= config.app %>/scripts/vendor/*',
                'test/spec/{,*/}*.js'
            ]
        },

        // Mocha testing framework configuration options
        mocha: {
            all: {
                options: {
                    run: true,
                    urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
                }
            }
        },

        // Add vendor prefixed styles
        autoprefixer: {
            options: {
                browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.app %>/assets/css',
                    src: '{,*/}*.css',
                    dest: '<%= config.app %>/assets/css/'
                }]
            }
        },

        // Automatically inject Bower components into the HTML file
        wiredep: {
            app: {
                ignorePath: /^\/|\.\.\//,
                src: ['<%= config.app %>/*.html'],
                exclude: ['bower_components/bootstrap/dist/js/bootstrap.js']
            }
        },

        // Renames files for browser caching purposes
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= config.dist %>/assets/js/{,*/}*.js',
                        '<%= config.dist %>/assets/css/{,*/}*.css',
                        '<%= config.dist %>/images/{,*/}*.*',
                        '<%= config.dist %>/assets/fonts/{,*/}*.*',
                        '<%= config.dist %>/*.{ico,png}'
                    ]
                }
            }
        },

        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            options: {
                dest: '<%= config.dist %>'
            },
            html: '<%= config.app %>/index.html'
        },

        // Performs rewrites based on rev and the useminPrepare configuration
        usemin: {
            options: {
                assetsDirs: [
                    '<%= config.dist %>/assets',
                    '<%= config.dist %>/images'
                ]
            },
            html: ['<%= config.dist %>/{,*/}*.html'],
            css: ['<%= config.dist %>/assets/css/{,*/}*.css']
        },

        // The following *-min tasks produce minified files in the dist folder
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.app %>/images',
                    src: '{,*/}*.{gif,jpeg,jpg,png}',
                    dest: '<%= config.dist %>/images'
                }]
            }
        },

        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= config.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= config.dist %>/images'
                }]
            }
        },

        htmlmin: {
            dist: {
                options: {
                    collapseBooleanAttributes: true,
                    collapseWhitespace: true,
                    conservativeCollapse: true,
                    removeAttributeQuotes: true,
                    removeCommentsFromCDATA: true,
                    removeEmptyAttributes: true,
                    removeOptionalTags: true,
                    removeRedundantAttributes: true,
                    useShortDoctype: true
                },
                files: [{
                    expand: true,
                    cwd: '<%= config.dist %>',
                    src: '{,*/}*.html',
                    dest: '<%= config.dist %>'
                }]
            }
        },

        // Concats vendor files
        concat: {
            options: {
                banner: '<%= banner %>',
                stripBanners: true
            },
            dist: {
                src: [
                    'bower_components/jquery/dist/jquery.min.js',
                    'bower_components/retinajs/dist/retina.min.js',
                    'bower_components/bootstrap/dist/js/bootstrap.min.js',
                    'bower_components/handlebars/handlebars.min.js'
                ],
                dest: '<%= config.app %>/assets/js/vendor.js'
            }
        },
        // Copies remaining files to places other tasks can use
        copy: {
            dist: {
                files: [
                    {
                        expand: true,
                        dot: true,
                        cwd: '<%= config.app %>',
                        dest: '<%= config.dist %>',
                        src: [
                            '*.{ico,png,txt}',
                            'images/{,*/}*.webp',
                            '{,*/}*.html',
                            'styles/fonts/{,*/}*.*'
                        ]
                    },
                    {
                        src: '<%= config.app %>/.htaccess',
                        dest: '<%= config.dist %>/.htaccess'
                    },
                    {
                        expand: true,
                        dot: true,
                        cwd: 'bower_components/font-awesome/',
                        src: 'fonts/*',
                        dest: '<%= config.dist %>/assets'
                    }
                ]
            },
            styles: {
                expand: true,
                dot: true,
                cwd: '<%= config.app %>/assets/css',
                dest: '<%= config.dist %>/assets/css',
                src: '{,*/}*.css'
            },
            javascripts: {
                expand: true,
                dot: true,
                cwd: '<%= config.app %>/assets/js',
                dest: '<%= config.dist %>/assets/js',
                src: '{,*/}*.js'
            }
        },

        // Generates a custom Modernizr build that includes only the tests you
        // reference in your app
        modernizr: {
            dist: {
                devFile: 'bower_components/modernizr/modernizr.js',
                outputFile: '<%= config.dist %>/assets/js/modernizr.js',
                files: {
                    src: [
                        '<%= config.dist %>/assets/js/{,*/}*.js',
                        '<%= config.dist %>/assets/css/{,*/}*.css',
                        '!<%= config.dist %>/assets/js/*'
                    ]
                },
                uglify: true
            }
        },

        // LESS stuff
        less: {
            development: {
                options: {
                    paths: ['styles']
                },
                files: {
                    '<%= config.app %>/assets/css/main.css': '<%= config.app %>/less/*.less',
                    '<%= config.dist %>/assets/css/main.css': '<%= config.app %>/less/*.less'
                }
            },
            production: {
                options: {
                    paths: ['styles'],
                    cleancss: true
                },
                files: {
                    '<%= config.app %>/assets/css/main.css': 'app/less/*.less'
                }
            }
        },

        // Run some tasks in parallel to speed up build process
        concurrent: {
            server: [
                'less:development',
                'concat',
                'copy:styles'
            ],
            test: [
                'less:development',
                'copy:styles'
            ],
            dist: [
                'less:production',
                'concat',
                'copy:styles',
                'copy:javascripts',
                'imagemin',
                'svgmin'
            ]
        },

        // Deployment via FTP
        'ftp-deploy': {
            build: {
                auth: {
                    host: 'www.phpmyfaq.de',
                    port: 21,
                    authKey: 'production'
                },
                src: '<%= config.dist %>',
                dest: '/staging.phpmyfaq.de'
            }
        }

    });

    grunt.registerTask('serve', 'start the server and preview your app, --allow-remote for remote access', function (target) {
        if (grunt.option('allow-remote')) {
            grunt.config.set('connect.options.hostname', '0.0.0.0');
        }
        if (target === 'dist') {
            return grunt.task.run(['build', 'connect:dist:keepalive']);
        }

        grunt.task.run([
            'clean:server',
            'fetchVersions',
            'fetchDownloadInfos',
            'wiredep',
            'concurrent:server',
            'autoprefixer',
            'assemble',
            'configureRewriteRules',
            'connect:livereload',
            'watch'
        ]);
    });

    grunt.registerTask('test', function (target) {
        if (target !== 'watch') {
            grunt.task.run([
                'clean:server',
                'concurrent:test',
                'autoprefixer'
            ]);
        }

        grunt.task.run([
            'assemble',
            'configureRewriteRules',
            'connect:test',
            'mocha'
        ]);
    });

    grunt.registerTask('build', [
        'clean:dist',
        'fetchVersions',
        'fetchDownloadInfos',
        'assemble',
        'wiredep',
        'useminPrepare',
        'concurrent:dist',
        'autoprefixer',
        'copy:dist',
        'modernizr',
        'usemin',
        'htmlmin'
    ]);

    grunt.registerTask('default', [
        'newer:jshint',
        'build'
    ]);

    grunt.registerTask('fetchVersions', [
        'curl:getVersions'
    ]);

    grunt.registerTask('fetchDownloadInfos', [
        'curl:getStableInfo',
        'curl:getDevelopmentInfo'
    ]);

    grunt.registerTask('deploy', [
        'newer:jshint',
        'build',
        'ftp-deploy'
    ]);

};
<|endoftext|>


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

  require('load-grunt-tasks')(grunt);

  // Project Configuration
  grunt.initConfig({
    release: {
      options: {
        bump: true,
        file: 'package.json',
        add: true,
        commit: true,
        tag: true,
        push: true,
        pushTags: true,
        npm: false,
        npmtag: true,
        tagName: 'v<%= version %>',
        commitMessage: 'New release v<%= version %>',
        tagMessage: 'Version <%= version %>',
        github: {
          repo: 'bitpay/copay',
          usernameVar: 'GITHUB_USERNAME', //ENVIRONMENT VARIABLE that contains Github username
          passwordVar: 'GITHUB_PASSWORD' //ENVIRONMENT VARIABLE that contains Github password
        }
      }
    },
    shell: {
      prod: {
        options: {
          stdout: false,
          stderr: false
        },
        command: 'node ./util/build.js'
      },
      dev: {
        options: {
          stdout: true,
          stderr: true
        },
        command: 'node ./util/build.js -d'
      }
    },
    watch: {
      options: {
        dateFormat: function(time) {
          grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString());
          grunt.log.writeln('Waiting for more changes...');
        },
      },
      readme: {
        files: ['README.md'],
        tasks: ['markdown']
      },
      scripts: {
        files: [
          'js/models/*.js',
          'plugins/*.js',
          'js/*.js',
        ],
        tasks: ['shell:dev']
      },
      css: {
        files: ['css/src/*.css'],
        tasks: ['cssmin:copay']
      },
      main: {
        files: [
          'js/init.js',
          'js/app.js',
          'js/directives.js',
          'js/filters.js',
          'js/routes.js',
          'js/mobile.js',
          'js/services/*.js',
          'js/controllers/*.js'
        ],
        tasks: ['concat:main']
      },
      config: {
        files: ['config.js'],
        tasks: ['shell:dev', 'concat:main']
      },
      test: {
        files: ['test/models/*.js'],
        tasks: ['mochaTest']
      }
    },
    mochaTest: {
      tests: {
        options: {
          require: 'setup/node.js',
          reporter: 'spec',
          mocha: require('mocha')
        },
        src: [
          'test/*.js',
        ]
      }
    },
    markdown: {
      all: {
        files: [{
          expand: true,
          src: 'README.md',
          dest: '.',
          ext: '.html'
        }]
      }
    },
    concat: {
      vendors: {
        src: [
          'lib/mousetrap/mousetrap.min.js',
          'js/shell.js', // shell must be loaded before moment due to the way moment loads in a commonjs env
          'lib/moment/min/moment.min.js',
          'lib/qrcode-generator/js/qrcode.js',
          'lib/underscore/underscore.js',
          'lib/bitcore.js',
          'lib/file-saver/FileSaver.js',
          'lib/socket.io-client/socket.io.js',
          'lib/sjcl.js',
          'lib/ios-imagefile-megapixel/megapix-image.js',
          'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js',
          'lib/zeroclipboard/ZeroClipboard.min.js'
        ],
        dest: 'lib/vendors.js'
      },
      angular: {
        src: [
          'lib/angular/angular.min.js',
          'lib/angular-route/angular-route.min.js',
          'lib/angular-moment/angular-moment.js',
          'lib/angular-qrcode/qrcode.js',
          'lib/ng-idle/angular-idle.min.js',
          'lib/angular-foundation/mm-foundation.min.js',
          'lib/angular-foundation/mm-foundation-tpls.min.js',
          'lib/angular-gettext/dist/angular-gettext.min.js',
          'lib/angular-load/angular-load.min.js'
          // If you add libs here, remember to add it too to karma.conf
        ],
        dest: 'lib/angularjs-all.js'
      },
      main: {
        src: [
          'js/app.js',
          'js/directives.js',
          'js/filters.js',
          'js/routes.js',
          'js/services/*.js',
          'js/controllers/*.js',
          'js/translations.js',
          'js/mobile.js', // PLACEHOLDER: CORDOVA SRIPT
          'js/init.js',
        ],
        dest: 'js/copayMain.js'
      }
    },
    cssmin: {
      copay: {
        files: {
          'css/copay.min.css': ['css/src/*.css'],
        }
      },
      vendors: {
        files: {
          'css/vendors.min.css': ['css/foundation.min.css', 'css/foundation-icons.css', 'lib/angular/angular-csp.css']
        }
      }
    },
    uglify: {
      options: {
        mangle: false
      },
      prod: {
        files: {
          'js/copayMain.js': ['js/copayMain.js'],
          'lib/angularjs-all.js': ['lib/angularjs-all.js'],
          'lib/vendors.js': ['lib/vendors.js']
        }
      }
    },
    nggettext_extract: {
      pot: {
        files: {
          'po/template.pot': ['index.html', 'views/*.html', 'views/**/*.html']
        }
      },
    },
    nggettext_compile: {
      all: {
        options: {
          module: 'copayApp'
        },
        files: {
          'js/translations.js': ['po/*.po']
        }
      },
    },
    jsdoc: {
      dist: {
        src: ['js/models/*.js', 'plugins/*.js'],
        options: {
          destination: 'doc',
          configure: 'jsdoc.conf.json',
          template: './node_modules/grunt-jsdoc/node_modules/ink-docstrap/template',
          theme: 'flatly'
        }
      }
    }
  });

  grunt.registerTask('default', ['shell:dev', 'nggettext_compile', 'concat', 'cssmin']);
  grunt.registerTask('prod', ['shell:prod', 'nggettext_compile', 'concat', 'cssmin', 'uglify']);
  grunt.registerTask('translate', ['nggettext_extract']);
  grunt.registerTask('docs', ['jsdoc']);
};
<commit_msg>ignore if copaybundle and copaymain were modified when grunt is watching<commit_after>module.exports = function(grunt) {

  require('load-grunt-tasks')(grunt);

  // Project Configuration
  grunt.initConfig({
    release: {
      options: {
        bump: true,
        file: 'package.json',
        add: true,
        commit: true,
        tag: true,
        push: true,
        pushTags: true,
        npm: false,
        npmtag: true,
        tagName: 'v<%= version %>',
        commitMessage: 'New release v<%= version %>',
        tagMessage: 'Version <%= version %>',
        github: {
          repo: 'bitpay/copay',
          usernameVar: 'GITHUB_USERNAME', //ENVIRONMENT VARIABLE that contains Github username
          passwordVar: 'GITHUB_PASSWORD' //ENVIRONMENT VARIABLE that contains Github password
        }
      }
    },
    shell: {
      prod: {
        options: {
          stdout: false,
          stderr: false
        },
        command: 'node ./util/build.js'
      },
      dev: {
        options: {
          stdout: true,
          stderr: true
        },
        command: 'node ./util/build.js -d'
      }
    },
    watch: {
      options: {
        dateFormat: function(time) {
          grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString());
          grunt.log.writeln('Waiting for more changes...');
        },
      },
      readme: {
        files: ['README.md'],
        tasks: ['markdown']
      },
      scripts: {
        files: [
          'js/models/*.js',
          'plugins/*.js',
          'js/*.js',
          '!js/copayBundle.js',
          '!js/copayMain.js'
        ],
        tasks: ['shell:dev']
      },
      css: {
        files: ['css/src/*.css'],
        tasks: ['cssmin:copay']
      },
      main: {
        files: [
          'js/init.js',
          'js/app.js',
          'js/directives.js',
          'js/filters.js',
          'js/routes.js',
          'js/mobile.js',
          'js/services/*.js',
          'js/controllers/*.js'
        ],
        tasks: ['concat:main']
      },
      config: {
        files: ['config.js'],
        tasks: ['shell:dev', 'concat:main']
      },
      test: {
        files: ['test/models/*.js'],
        tasks: ['mochaTest']
      }
    },
    mochaTest: {
      tests: {
        options: {
          require: 'setup/node.js',
          reporter: 'spec',
          mocha: require('mocha')
        },
        src: [
          'test/*.js',
        ]
      }
    },
    markdown: {
      all: {
        files: [{
          expand: true,
          src: 'README.md',
          dest: '.',
          ext: '.html'
        }]
      }
    },
    concat: {
      vendors: {
        src: [
          'lib/mousetrap/mousetrap.min.js',
          'js/shell.js', // shell must be loaded before moment due to the way moment loads in a commonjs env
          'lib/moment/min/moment.min.js',
          'lib/qrcode-generator/js/qrcode.js',
          'lib/underscore/underscore.js',
          'lib/bitcore.js',
          'lib/file-saver/FileSaver.js',
          'lib/socket.io-client/socket.io.js',
          'lib/sjcl.js',
          'lib/ios-imagefile-megapixel/megapix-image.js',
          'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js',
          'lib/zeroclipboard/ZeroClipboard.min.js'
        ],
        dest: 'lib/vendors.js'
      },
      angular: {
        src: [
          'lib/angular/angular.min.js',
          'lib/angular-route/angular-route.min.js',
          'lib/angular-moment/angular-moment.js',
          'lib/angular-qrcode/qrcode.js',
          'lib/ng-idle/angular-idle.min.js',
          'lib/angular-foundation/mm-foundation.min.js',
          'lib/angular-foundation/mm-foundation-tpls.min.js',
          'lib/angular-gettext/dist/angular-gettext.min.js',
          'lib/angular-load/angular-load.min.js'
          // If you add libs here, remember to add it too to karma.conf
        ],
        dest: 'lib/angularjs-all.js'
      },
      main: {
        src: [
          'js/app.js',
          'js/directives.js',
          'js/filters.js',
          'js/routes.js',
          'js/services/*.js',
          'js/controllers/*.js',
          'js/translations.js',
          'js/mobile.js', // PLACEHOLDER: CORDOVA SRIPT
          'js/init.js',
        ],
        dest: 'js/copayMain.js'
      }
    },
    cssmin: {
      copay: {
        files: {
          'css/copay.min.css': ['css/src/*.css'],
        }
      },
      vendors: {
        files: {
          'css/vendors.min.css': ['css/foundation.min.css', 'css/foundation-icons.css', 'lib/angular/angular-csp.css']
        }
      }
    },
    uglify: {
      options: {
        mangle: false
      },
      prod: {
        files: {
          'js/copayMain.js': ['js/copayMain.js'],
          'lib/angularjs-all.js': ['lib/angularjs-all.js'],
          'lib/vendors.js': ['lib/vendors.js']
        }
      }
    },
    nggettext_extract: {
      pot: {
        files: {
          'po/template.pot': ['index.html', 'views/*.html', 'views/**/*.html']
        }
      },
    },
    nggettext_compile: {
      all: {
        options: {
          module: 'copayApp'
        },
        files: {
          'js/translations.js': ['po/*.po']
        }
      },
    },
    jsdoc: {
      dist: {
        src: ['js/models/*.js', 'plugins/*.js'],
        options: {
          destination: 'doc',
          configure: 'jsdoc.conf.json',
          template: './node_modules/grunt-jsdoc/node_modules/ink-docstrap/template',
          theme: 'flatly'
        }
      }
    }
  });

  grunt.registerTask('default', ['shell:dev', 'nggettext_compile', 'concat', 'cssmin']);
  grunt.registerTask('prod', ['shell:prod', 'nggettext_compile', 'concat', 'cssmin', 'uglify']);
  grunt.registerTask('translate', ['nggettext_extract']);
  grunt.registerTask('docs', ['jsdoc']);
};
<|endoftext|>


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

    var userhome = require('userhome');

    // display execution time of each task
    require('time-grunt')(grunt);

    // load all grunt tasks automatically
    require('load-grunt-tasks')(grunt);

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

    var cfg = {
        exampleDir: 'demo',
        demoRepoDir: 'hippo-theme-demo',
        tmpDir: '.tmp'
    };
    cfg.tmpRepoDir = userhome(cfg.tmpDir, cfg.exampleDir, cfg.demoRepoDir);

    // project configuration
    grunt.initConfig({
        // configuration
        cfg: cfg,
        userhome: userhome,

        // compile less files for the app and modules
        less: {
            src: {
                files: {
                    'dist/css/main.css': 'src/less/main.less'
                }
            }
        },

        // clean target (distribution) folder
        clean: {
            dist: [ 'dist/**/*' ],
            demo: ['<%= cfg.exampleDir %>' ]
        },

        // copy files
        copy: {
            main: {
                expand: true,
                cwd: 'src',
                src: ['!**/*.spec.js'],
                dest: 'dist/'
            },

            demo: {
                files: [
                    {
                        expand: true,
                        cwd: 'dist',
                        src: [
                            '**/*',
                        ],
                        dest: '<%= cfg.exampleDir %>/components/hippo-theme/dist'
                    },
                    {
                        expand: true,
                        src: [
                            'components/**/*',
                            '!components/font-awesome/src/**/*'
                        ],
                        dest: '<%= cfg.exampleDir %>/'
                    },
                    {
                        expand: true,
                        cwd: 'src/demo',
                        src: [
                            '**/*',
                        ],
                        dest: '<%= cfg.exampleDir %>/'
                    }
                ]
            },

            toDemoRepo: {
                files: [
                    {
                        expand: true,
                        cwd: '<%= cfg.exampleDir %>',
                        src: [
                            '**/*',
                        ],
                        dest: '<%= cfg.tmpRepoDir %>'
                    }
                ]
            }
        },

        // watch
        watch: {
            js: {
                options: {
                    livereload: true
                },
                files: [
                    'src/**/*.js',
                    '!**/*.spec.js'
                ],
                tasks: [
                    'clean:dist',
                    'copy:demo',
                    'concat:dist',
                    'uglify:dist',
                    'copy:demo'
                ]
            }
        },

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

        // testing with karma
        karma: {
            options: {
                //logLevel: 'debug',
                configFile: 'karma.conf.js',
                autoWatch: true
            },

            single: {
                singleRun: true
            },

            continuous: {
                singleRun: false
            }
        },

        connect: {
            options: {
                port: 9000,
                livereload: 35729,
                hostname: '0.0.0.0'
            },
            example: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, '')
                        ];
                    }
                }
            }
        },

        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>/<%= cfg.exampleDir %>/'
            }
        },

        concat: {
            dist: {
                src: [
                    'src/js/main.js',
                    'src/shared/chart/chart.js',
                    'src/shared/divider/divider.js',
                    'src/shared/focus-me/focus-me.js',
                    'src/shared/map/map.js',
                    'src/shared/panel-default/panel-default.js',
                    'src/shared/responsive/responsive.js',
                    'src/shared/select-box/select-box.js',
                    'src/shared/urlparser/urlparser.js',
                    'src/shared/tree/tree.js'
                ],
                dest: 'dist/js/main.js'
            }
        },

        uglify: {
            dist: {
                files: {
                    'dist/js/main.min.js': ['dist/js/main.js']
                }
            }
        },

        cssmin: {
            options: {
                report: 'min'
            },
            dist: {
                files: {
                    'dist/css/main.min.css': ['dist/css/main.css']
                }
            }
        },

        lintspaces: {
            less: {
                src: [
                    'src/**/*.less'
                ],
                options: {
                    indentation: 'spaces',
                    spaces: 4,
                    ignores: ['js-comments']
                }
            }
        },

        shell: {
            options: {
                stdout: true,
                stderr: true
            },
            cloneDemo: {
                command: 'rm -R <%= userhome(cfg.tmpDir) %> && mkdir -p <%= cfg.tmpRepoDir %> && cd <%= cfg.tmpRepoDir %> && git clone git@github.com:onehippo/hippo-theme-demo.git .'
            },

            commitDemo: {
                command: [
                    'echo <%= cfg.tmpRepoDir %>',
                    'git add .',
                    'git commit -m "New build"'
                ].join('&&'),
                options: {
                    execOptions: {
                        cwd: '<%= cfg.tmpRepoDir %>'
                    }
                }
            },

            pushDemo: {
                command: 'git push origin gh-pages',
                options: {
                    execOptions: {
                        cwd: '<%= cfg.tmpRepoDir %>'
                    }
                }
            }
        },

        // ngdocs
        ngdocs: {
            options: {
                dest: '<%= cfg.exampleDir %>/docs',
                scripts: ['angular.js'],
                html5Mode: false,
                startPage: '/api',
                title: 'Hippo Theme'
            },

            api: {
                title: 'API reference',
                src: ['src/shared/**/*.js'],
                api: true
            }
        },
    });

    // default
    grunt.registerTask('default', ['build:demo']);

    // build dist
    grunt.registerTask('build:dist', function (target) {
        var tasks = [
            'jshint',
            'karma:single',
            'clean:dist',
            'copy',
            'less',
            'concat:dist',
            'lintspaces:less',
            'uglify:dist',
            'cssmin:dist'
        ];

        grunt.task.run(tasks);
    });

    // build demo
    grunt.registerTask('build:demo', function (target) {
        var tasks = [
            'clean:demo',
            'build:dist',
            'copy:demo',
        ];

        grunt.task.run(tasks);
    });

    // server with example
    grunt.registerTask('server:demo', ['build:demo', 'open', 'connect:example', 'watch']);

    // test
    grunt.registerTask('test:unit', [
        'karma:single'
    ]);

    grunt.registerTask('test:unit:continuous', [
        'karma:continuous'
    ]);

    grunt.registerTask('publish', [
        'build:demo',
        'ngdocs',
        'shell:cloneDemo',
        'copy:toDemoRepo',
        'shell:commitDemo',
        'shell:pushDemo'
    ]);
};
<commit_msg>CMS7-7700 Bugfix - generate ngdocs for server<commit_after>'use strict';
module.exports = function (grunt) {

    var userhome = require('userhome');

    // display execution time of each task
    require('time-grunt')(grunt);

    // load all grunt tasks automatically
    require('load-grunt-tasks')(grunt);

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

    var cfg = {
        exampleDir: 'demo',
        demoRepoDir: 'hippo-theme-demo',
        tmpDir: '.tmp'
    };
    cfg.tmpRepoDir = userhome(cfg.tmpDir, cfg.exampleDir, cfg.demoRepoDir);

    // project configuration
    grunt.initConfig({
        // configuration
        cfg: cfg,
        userhome: userhome,

        // compile less files for the app and modules
        less: {
            src: {
                files: {
                    'dist/css/main.css': 'src/less/main.less'
                }
            }
        },

        // clean target (distribution) folder
        clean: {
            dist: [ 'dist/**/*' ],
            demo: ['<%= cfg.exampleDir %>' ]
        },

        // copy files
        copy: {
            main: {
                expand: true,
                cwd: 'src',
                src: ['!**/*.spec.js'],
                dest: 'dist/'
            },

            demo: {
                files: [
                    {
                        expand: true,
                        cwd: 'dist',
                        src: [
                            '**/*',
                        ],
                        dest: '<%= cfg.exampleDir %>/components/hippo-theme/dist'
                    },
                    {
                        expand: true,
                        src: [
                            'components/**/*',
                            '!components/font-awesome/src/**/*'
                        ],
                        dest: '<%= cfg.exampleDir %>/'
                    },
                    {
                        expand: true,
                        cwd: 'src/demo',
                        src: [
                            '**/*',
                        ],
                        dest: '<%= cfg.exampleDir %>/'
                    }
                ]
            },

            toDemoRepo: {
                files: [
                    {
                        expand: true,
                        cwd: '<%= cfg.exampleDir %>',
                        src: [
                            '**/*',
                        ],
                        dest: '<%= cfg.tmpRepoDir %>'
                    }
                ]
            }
        },

        // watch
        watch: {
            js: {
                options: {
                    livereload: true
                },
                files: [
                    'src/**/*.js',
                    '!**/*.spec.js'
                ],
                tasks: [
                    'clean:dist',
                    'copy:demo',
                    'concat:dist',
                    'uglify:dist',
                    'copy:demo'
                ]
            }
        },

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

        // testing with karma
        karma: {
            options: {
                //logLevel: 'debug',
                configFile: 'karma.conf.js',
                autoWatch: true
            },

            single: {
                singleRun: true
            },

            continuous: {
                singleRun: false
            }
        },

        connect: {
            options: {
                port: 9000,
                livereload: 35729,
                hostname: '0.0.0.0'
            },
            example: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, '')
                        ];
                    }
                }
            }
        },

        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>/<%= cfg.exampleDir %>/'
            }
        },

        concat: {
            dist: {
                src: [
                    'src/js/main.js',
                    'src/shared/chart/chart.js',
                    'src/shared/divider/divider.js',
                    'src/shared/focus-me/focus-me.js',
                    'src/shared/map/map.js',
                    'src/shared/panel-default/panel-default.js',
                    'src/shared/responsive/responsive.js',
                    'src/shared/select-box/select-box.js',
                    'src/shared/urlparser/urlparser.js',
                    'src/shared/tree/tree.js'
                ],
                dest: 'dist/js/main.js'
            }
        },

        uglify: {
            dist: {
                files: {
                    'dist/js/main.min.js': ['dist/js/main.js']
                }
            }
        },

        cssmin: {
            options: {
                report: 'min'
            },
            dist: {
                files: {
                    'dist/css/main.min.css': ['dist/css/main.css']
                }
            }
        },

        lintspaces: {
            less: {
                src: [
                    'src/**/*.less'
                ],
                options: {
                    indentation: 'spaces',
                    spaces: 4,
                    ignores: ['js-comments']
                }
            }
        },

        shell: {
            options: {
                stdout: true,
                stderr: true
            },
            cloneDemo: {
                command: 'rm -R <%= userhome(cfg.tmpDir) %> && mkdir -p <%= cfg.tmpRepoDir %> && cd <%= cfg.tmpRepoDir %> && git clone git@github.com:onehippo/hippo-theme-demo.git .'
            },

            commitDemo: {
                command: [
                    'echo <%= cfg.tmpRepoDir %>',
                    'git add .',
                    'git commit -m "New build"'
                ].join('&&'),
                options: {
                    execOptions: {
                        cwd: '<%= cfg.tmpRepoDir %>'
                    }
                }
            },

            pushDemo: {
                command: 'git push origin gh-pages',
                options: {
                    execOptions: {
                        cwd: '<%= cfg.tmpRepoDir %>'
                    }
                }
            }
        },

        // ngdocs
        ngdocs: {
            options: {
                dest: '<%= cfg.exampleDir %>/docs',
                scripts: ['angular.js'],
                html5Mode: false,
                startPage: '/api',
                title: 'Hippo Theme'
            },

            api: {
                title: 'API reference',
                src: ['src/shared/**/*.js'],
                api: true
            }
        },
    });

    // default
    grunt.registerTask('default', ['build:demo']);

    // build dist
    grunt.registerTask('build:dist', function (target) {
        var tasks = [
            'jshint',
            'karma:single',
            'clean:dist',
            'copy',
            'less',
            'concat:dist',
            'lintspaces:less',
            'uglify:dist',
            'cssmin:dist'
        ];

        grunt.task.run(tasks);
    });

    // build demo
    grunt.registerTask('build:demo', function (target) {
        var tasks = [
            'clean:demo',
            'build:dist',
            'copy:demo',
        ];

        grunt.task.run(tasks);
    });

    // server with example
    grunt.registerTask('server:demo', ['build:demo', 'ngdocs', 'open', 'connect:example', 'watch']);

    // test
    grunt.registerTask('test:unit', [
        'karma:single'
    ]);

    grunt.registerTask('test:unit:continuous', [
        'karma:continuous'
    ]);

    grunt.registerTask('publish', [
        'build:demo',
        'ngdocs',
        'shell:cloneDemo',
        'copy:toDemoRepo',
        'shell:commitDemo',
        'shell:pushDemo'
    ]);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		sass: {
            options: {
                sourcemap: 'none'
            },
			dist: {
				files: [{
					expand: true,
					cwd: 'resources/styles',
				  src: '*.scss',
					dest: 'resources/styles',
					ext: '.css'
				}]
			}
		},

        postcss: {
            options: {
                processors: [
                    require('autoprefixer-core')({browsers: 'last 2 versions'}), // add vendor prefixes
                ]
            },
            dist: {
                src: 'resources/styles/**/*.css'
            }
        },

		sitemap: {
			dist: {
				pattern: ['*.html', 'easy/*.html', '!**/google*.html'], // this will exclude 'google*.html'
				siteRoot: './'
			}
		},
		robotstxt: {
            dist: {
                dest: './',
                policy: [
                    {
                        ua: 'googlebot',
                        disallow: '/resources/'
                    },
                    {
                        ua: 'googlebot-news',
                        allow: 'http://blog.tsuru.io/'
                    },
                    {
                        ua: 'googlebot-third',
                        allow: ['http://docs.tsuru.io/']
                    },
                    {
                        sitemap: ['http://tsuru.io/sitemap.xml', 'http://docs.tsuru.io/sitemap.xml']
                    },
                    {
                        crawldelay: 100
                    },
                    {
                        host: 'tsuru.io'
                    }
                ]
            }
        },
		watch: {
			css: {
				files: '**/*.scss',
				tasks: ['sass', 'postcss']
			},
			html: {
				files: ['*.html', 'easy/*.html', '!**/google*.html'],
				tasks: ['sitemap']
			}
		},
	});
	grunt.loadNpmTasks('grunt-contrib-sass');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-sitemap');
    grunt.loadNpmTasks('grunt-robots-txt');
	grunt.loadNpmTasks('grunt-postcss');

	grunt.registerTask('map',['sitemap', 'robotstxt']);
	grunt.registerTask('default',['watch']);
};
<commit_msg>Configures sass task to compress css<commit_after>module.exports = function(grunt) {
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		sass: {
            options: {
                sourcemap: 'none',
                style: 'compressed'
            },
			dist: {
				files: [{
					expand: true,
					cwd: 'resources/styles',
				  src: '*.scss',
					dest: 'resources/styles',
					ext: '.css'
				}]
			}
		},

        postcss: {
            options: {
                processors: [
                    require('autoprefixer-core')({browsers: 'last 2 versions'}), // add vendor prefixes
                ]
            },
            dist: {
                src: 'resources/styles/**/*.css'
            }
        },

		sitemap: {
			dist: {
				pattern: ['*.html', 'easy/*.html', '!**/google*.html'], // this will exclude 'google*.html'
				siteRoot: './'
			}
		},
		robotstxt: {
            dist: {
                dest: './',
                policy: [
                    {
                        ua: 'googlebot',
                        disallow: '/resources/'
                    },
                    {
                        ua: 'googlebot-news',
                        allow: 'http://blog.tsuru.io/'
                    },
                    {
                        ua: 'googlebot-third',
                        allow: ['http://docs.tsuru.io/']
                    },
                    {
                        sitemap: ['http://tsuru.io/sitemap.xml', 'http://docs.tsuru.io/sitemap.xml']
                    },
                    {
                        crawldelay: 100
                    },
                    {
                        host: 'tsuru.io'
                    }
                ]
            }
        },
		watch: {
			css: {
				files: '**/*.scss',
				tasks: ['sass', 'postcss']
			},
			html: {
				files: ['*.html', 'easy/*.html', '!**/google*.html'],
				tasks: ['sitemap']
			}
		},
	});
	grunt.loadNpmTasks('grunt-contrib-sass');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-sitemap');
    grunt.loadNpmTasks('grunt-robots-txt');
	grunt.loadNpmTasks('grunt-postcss');

	grunt.registerTask('map',['sitemap', 'robotstxt']);
	grunt.registerTask('default',['watch']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
    grunt.initConfig({
      uglify: {
        build: {
          files: {
            'public/js/min.js':
                [
                    'bower_components/jquery/dist/jquery.js',
                    'bower_components/angular/angular.js',
                    'bower_components/bootstrap/dist/js/bootstrap.js'
                ]
          }
        }
      },
      cssmin: {
        options: {
          shorthandCompacting: false,
          roundingPrecision: -1
        },
        target: {
          files: {
            'public/css/min.css':
            [
                'bower_components/bootstrap/dist/css/bootstrap.css',
                'bower_components/bootstrap/dist/css/bootstrap-theme.css',
            ]
          }
        }
      },
        copy: {
          main: {
            files: [
              {
                expand: true,
                flatten: true,
                src: ['bower_components/bootstrap/dist/fonts/*'],
                dest: 'public/fonts',
                filter: 'isFile'
               },
            ],
          },
        },
    connect: {
        server: {
            options: {
                keepalive: true,
                livereload: true,
                port: 8000,
                base: 'public/',
            }
        }
    },
    watch: {
      scripts: {
        files: ['public/**/*.js'],
        files: ['public/**/*.css'],
        tasks: ['build'],
        options: {
          spawn: false,
        },
      },
    },
    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.registerTask('build', ["uglify", "cssmin", "copy"]);
    grunt.registerTask('default', ["build", "connect", "watch"]);
}
<commit_msg>Add todo to only watch non-built source files<commit_after>module.exports = function(grunt) {
    grunt.initConfig({
      uglify: {
        build: {
          files: {
            'public/js/min.js':
                [
                    'bower_components/jquery/dist/jquery.js',
                    'bower_components/angular/angular.js',
                    'bower_components/bootstrap/dist/js/bootstrap.js'
                ]
          }
        }
      },
      cssmin: {
        options: {
          shorthandCompacting: false,
          roundingPrecision: -1
        },
        target: {
          files: {
            'public/css/min.css':
            [
                'bower_components/bootstrap/dist/css/bootstrap.css',
                'bower_components/bootstrap/dist/css/bootstrap-theme.css',
            ]
          }
        }
      },
        copy: {
          main: {
            files: [
              {
                expand: true,
                flatten: true,
                src: ['bower_components/bootstrap/dist/fonts/*'],
                dest: 'public/fonts',
                filter: 'isFile'
               },
            ],
          },
        },
    connect: {
        server: {
            options: {
                keepalive: true,
                livereload: true,
                port: 8000,
                base: 'public/',
            }
        }
    },

    // TODO: Only watch source files (no built files like public/css/min.css). Maybe separate these source files out into their own directory like public/src.
    watch: {
      scripts: {
        files: ['public/**/*.js'],
        files: ['public/**/*.css'],
        tasks: ['build'],
        options: {
          spawn: false,
        },
      },
    },
    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.registerTask('build', ["uglify", "cssmin", "copy"]);
    grunt.registerTask('default', ["build", "connect", "watch"]);
}
<|endoftext|>


<commit_before>// Generated on 2014-01-13 using generator-ember 0.8.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));
};

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

module.exports = function (grunt) {

	// show elapsed time at the end
	require('time-grunt')(grunt);
	// load all grunt tasks
	require('load-grunt-tasks')(grunt);

	// configurable paths
	var appConfig = {
		app: 'src',
		demo: 'demo',
		docs: 'docs',
		dist: 'dist',
		site: '.tmp/dist'
	};

	grunt.initConfig({
		pkg: grunt.file.readJSON("package.json"),
		config: appConfig,
		banner: [
			'/**',
			' *  <%= pkg.title || pkg.name %> v<%= pkg.version %>',
			' *  <%= pkg.description %>',
			' *  <%= pkg.homepage %>',
			' *  Made by <%= pkg.author %>',
			' */\n'
		].join('\n'),

		watch: {
			templates: {
				files: '<%= config.app %>/templates/**/*.hbs',
				tasks: ['emberTemplates:app']
			},
			scripts: {
				files: ['<%= config.app %>/scripts/{,*/}*.js'],
				tasks: ['neuter:app']
			},
			demoTemplates: {
				files: '<%= config.demo %>/templates/**/*.hbs',
				tasks: ['emberTemplates:demo']
			},
			demoStyles: {
				files: ['<%= config.demo %>/styles/{,*/}*.{scss,sass,css}'],
				tasks: ['compass:demo']
			},
			demoScripts: {
				files: ['<%= config.demo %>/scripts/{,*/}*.js'],
				tasks: ['neuter:demo']
			},
			demoReplace: {
				files: ['<%= config.demo %>/*.html'],
				tasks: ['replace:demo']
			},
			livereload: {
				options: {
					livereload: LIVERELOAD_PORT
				},
				files: [
					'.tmp/scripts/*.js',
					'.tmp/*.html',
					'.tmp/styles/{,*/}*.css',
					'<%= config.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'
			},

			demo: {
				options: {
					middleware: function (connect) {
						return [
							lrSnippet,
							mountFolder(connect, '.tmp'),
							mountFolder(connect, '.'),
							mountFolder(connect, appConfig.demo)
						];
					}
				}
			},

			test: {
				options: {
					port: 9001,
					middleware: function (connect) {
						return [
							mountFolder(connect, 'test'),
							mountFolder(connect, '.tmp')
						];
					}
				}
			},

			site: {
				options: {
					port: 9002,
					middleware: function (connect) {
						return [
							mountFolder(connect, appConfig.site)
						];
					}
				}
			},

		},

		open: {
			demo: {
				path: 'http://localhost:<%= connect.demo.options.port %>',
				 app: 'Google Chrome'
			},
			test: {
				path: 'http://localhost:<%= connect.test.options.port %>',
				 app: 'Google Chrome'
			}
		},

		clean: {
			main: {
				files: [{
					dot: true,
					src: [
						'.tmp/**'
					]
				}]
			},
			publish: {
				files: [{
					dot: true,
					src: [
						'.grunt/**'
					]
				}]
			}
		},

		symlink: {
			demo: {
				src: 'vendor',
				dest: '.tmp/vendor'
			},
			test: {
				src: 'vendor',
				dest: 'test/vendor'
			}
		},

		jshint: {
			options: {
				jshintrc: '.jshintrc',
				reporter: require('jshint-stylish')
			},
			all: [
				'Gruntfile.js',
				'{<%= config.app %>,<%= config.demo %>}/scripts/{,*/}*.js',
				'!{<%= config.app %>,<%= config.demo %>}/scripts/vendor/*',
				'test/spec/{,*/}*.js'
			]
		},

		qunit: {
			all: {
				options: {
					urls: [
						'http://localhost:<%= connect.test.options.port %>/index.html'
					]
				}
			}
		},

		compass: {
			options: {
				sassDir: '<%= config.demo %>/styles',
				cssDir: '.tmp/styles',
				generatedImagesDir: '.tmp/images/generated',
				imagesDir: '<%= config.demo %>/images',
				javascriptsDir: '<%= config.demo %>/scripts',
				fontsDir: '<%= config.demo %>/styles/fonts',
				importPath: 'vendor',
				httpImagesPath: '/images',
				httpGeneratedImagesPath: '/images/generated',
				httpFontsPath: '/styles/fonts',
				relativeAssets: false,
				//sourcemap: true
			},
			dist: {
				options: {
					environment: 'production',
					//sourcemap: false,
					debugInfo: false

				}
			},
			demo: {
				options: {
					debugInfo: true
				}
			}
		},
		// not used since Uglify task does concat,
		// but still available if needed
		/*concat: {
			dist: {}
		},*/

		// Uglify for dist
		uglify: {
			min: {
				options: {
					banner: '<%= banner %>'
				},
				files: {
					'<%= config.dist %>/scripts/ember-topcoat-components.min.js': [
						'.tmp/scripts/app-templates.js',
						'.tmp/scripts/app-scripts.js'
					]
				}
			},
			max: {
				options: {
					banner: '<%= banner %>',
					beautify: true
				},
				files: {
					'<%= config.dist %>/scripts/ember-topcoat-components.js': [
						'.tmp/scripts/app-templates.js',
						'.tmp/scripts/app-scripts.js'
					]
				}
			}
		},

		rev: {
			site: {
				files: {
					src: [
						'<%= config.site %>/scripts/{,*/}*.js',
						'<%= config.site %>/styles/{,*/}*.css',
						'<%= config.site %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
						'<%= config.site %>/styles/fonts/*'
					]
				}
			}
		},

		useminPrepare: {
			html: '.tmp/index.html',
			options: {
				dest: '<%= config.site %>'
			}
		},

		usemin: {
			html: ['<%= config.site %>/{,*/}*.html'],
			css: ['<%= config.site %>/styles/{,*/}*.css'],
			options: {
				dirs: [
					'<%= config.site %>'
				],
				assetDirs: [
					'vendor'
				]
			}
		},

		imagemin: {
			dist: {
				files: [{
					expand: true,
					cwd: '<%= config.demo %>/images',
					src: '{,*/}*.{png,jpg,jpeg}',
					dest: '<%= config.site %>/images'
				}]
			}
		},
		svgmin: {
			dist: {
				files: [{
					expand: true,
					cwd: '<%= config.demo %>/images',
					src: '{,*/}*.svg',
					dest: '<%= config.site %>/images'
				}]
			}
		},
		cssmin: {
			dist: {
				files: {
					'<%= config.site %>/styles/main.css': [
						'.tmp/styles/{,*/}*.css',
						'<%= config.demo %>/styles/{,*/}*.css'
					]
				}
			}
		},
		htmlmin: {
			dist: {
				options: {
					/*removeCommentsFromCDATA: true,
					// https://github.com/config/grunt-usemin/issues/44
					//collapseWhitespace: true,
					collapseBooleanAttributes: true,
					removeAttributeQuotes: true,
					removeRedundantAttributes: true,
					useShortDoctype: true,
					removeEmptyAttributes: true,
					removeOptionalTags: true*/
				},
				files: [{
					expand: true,
					cwd: '<%= config.demo %>',
					src: '*.html',
					dest: '<%= config.site %>'
				}]
			}
		},

		replace: {
			demo: {
				options: {
					variables: {
						ember: 'vendor/ember/ember.js'
					}
				},
				files: [{
					src: '<%= config.demo %>/index.html',
					dest: '.tmp/index.html'
				}]
			},
			site: {
				options: {
					variables: {
						ember: 'vendor/ember/ember.prod.js'
					}
				},
				files: [{
					src: '<%= config.demo %>/index.html',
					dest: '.tmp/index.html'
				}]
			}
		},

		// Put files not handled in other tasks here
		copy: {
			dist: {
				files: [{
					expand: true,
					dot: true,
					cwd: '<%= config.demo %>',
					dest: '<%= config.site %>',
					src: [
						'*.{ico,txt}',
						'.htaccess',
						'images/{,*/}*.{webp,gif}',
						'styles/fonts/*'
					]
				}, {
					expand: true,
					cwd: 'vendor',
					dest: '<%= config.site %>/vendor',
					src: [
						'topcoat/css/*.min.css',
						'topcoat/font/*.otf'
					]
				}]
			}
		},

		concurrent: {
			demo: [
				'emberTemplates',
				'compass:demo'
			],
			test: [
				'emberTemplates:app'
			],
			dist: [
				'emberTemplates',
				'compass:dist',
				'imagemin',
				'svgmin',
				'htmlmin'
			]
		},

		emberTemplates: {
			options: {
				templateName: function (sourceFile) {
					// Get rid of '{subfolder}/templates/' at the beginning
					return sourceFile.replace(/[^\.]*\/templates\//, '');
				},
				templateRegistration: function (name, contents) {
					contents = contents.replace(/[\t]+/g, ' ');
					return 'Em.TEMPLATES[\'' + name + '\'] = ' + contents + ';';
				},
			},
			app: {
				files: {
					'.tmp/scripts/app-templates.js': '<%= config.app %>/templates/{,*/}*.hbs'
				}
			},
			demo: {
				files: {
					'.tmp/scripts/demo-templates.js': '<%= config.demo %>/templates/{,*/}*.hbs'
				}
			}
		},
		neuter: {
			app: {
				src: '<%= config.app %>/scripts/tc.js',
				dest: '.tmp/scripts/app-scripts.js'
			},

			demo: {
				src: '<%= config.demo %>/scripts/app.js',
				dest: '.tmp/scripts/demo-scripts.js'
			}
		},

		'gh-pages': {
			options: {
				base: '.tmp/dist'
			},
			src: ['**']
		}

	});

	// Currently only the targets 'demo' and 'test' are supported
	grunt.registerTask('server', function (target) {

		var tasks = [];

		target = target || 'demo';

		tasks.push(
			'clean:main',
			'replace:demo',
			'concurrent:' + target,
			'neuter:app'
		);

		if (target === 'demo') {
			tasks.push('neuter:demo');
		}

		tasks.push(
			'symlink:' + target,
			'connect:' + target,
			'open:' + target,
			'watch'
		);

		grunt.task.run(tasks);

	});

	grunt.registerTask('test', [
		'clean:main',
		'replace:app',
		'concurrent:test',
		'neuter:app',
		'connect:test',
		'qunit'
	]);

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

	grunt.registerTask('publish', [
		'clean:main',
		'build',
		'gh-pages',
		'clean:publish'
	]);

	grunt.registerTask('default', [
		'jshint',
		'test',
		'build'
	]);
};
<commit_msg>Added images to Gruntfile Topcoat copy<commit_after>// Generated on 2014-01-13 using generator-ember 0.8.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));
};

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

module.exports = function (grunt) {

	// show elapsed time at the end
	require('time-grunt')(grunt);
	// load all grunt tasks
	require('load-grunt-tasks')(grunt);

	// configurable paths
	var appConfig = {
		app: 'src',
		demo: 'demo',
		docs: 'docs',
		dist: 'dist',
		site: '.tmp/dist'
	};

	grunt.initConfig({
		pkg: grunt.file.readJSON("package.json"),
		config: appConfig,
		banner: [
			'/**',
			' *  <%= pkg.title || pkg.name %> v<%= pkg.version %>',
			' *  <%= pkg.description %>',
			' *  <%= pkg.homepage %>',
			' *  Made by <%= pkg.author %>',
			' */\n'
		].join('\n'),

		watch: {
			templates: {
				files: '<%= config.app %>/templates/**/*.hbs',
				tasks: ['emberTemplates:app']
			},
			scripts: {
				files: ['<%= config.app %>/scripts/{,*/}*.js'],
				tasks: ['neuter:app']
			},
			demoTemplates: {
				files: '<%= config.demo %>/templates/**/*.hbs',
				tasks: ['emberTemplates:demo']
			},
			demoStyles: {
				files: ['<%= config.demo %>/styles/{,*/}*.{scss,sass,css}'],
				tasks: ['compass:demo']
			},
			demoScripts: {
				files: ['<%= config.demo %>/scripts/{,*/}*.js'],
				tasks: ['neuter:demo']
			},
			demoReplace: {
				files: ['<%= config.demo %>/*.html'],
				tasks: ['replace:demo']
			},
			livereload: {
				options: {
					livereload: LIVERELOAD_PORT
				},
				files: [
					'.tmp/scripts/*.js',
					'.tmp/*.html',
					'.tmp/styles/{,*/}*.css',
					'<%= config.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'
			},

			demo: {
				options: {
					middleware: function (connect) {
						return [
							lrSnippet,
							mountFolder(connect, '.tmp'),
							mountFolder(connect, '.'),
							mountFolder(connect, appConfig.demo)
						];
					}
				}
			},

			test: {
				options: {
					port: 9001,
					middleware: function (connect) {
						return [
							mountFolder(connect, 'test'),
							mountFolder(connect, '.tmp')
						];
					}
				}
			},

			site: {
				options: {
					port: 9002,
					middleware: function (connect) {
						return [
							mountFolder(connect, appConfig.site)
						];
					}
				}
			},

		},

		open: {
			demo: {
				path: 'http://localhost:<%= connect.demo.options.port %>',
				 app: 'Google Chrome'
			},
			test: {
				path: 'http://localhost:<%= connect.test.options.port %>',
				 app: 'Google Chrome'
			}
		},

		clean: {
			main: {
				files: [{
					dot: true,
					src: [
						'.tmp/**'
					]
				}]
			},
			publish: {
				files: [{
					dot: true,
					src: [
						'.grunt/**'
					]
				}]
			}
		},

		symlink: {
			demo: {
				src: 'vendor',
				dest: '.tmp/vendor'
			},
			test: {
				src: 'vendor',
				dest: 'test/vendor'
			}
		},

		jshint: {
			options: {
				jshintrc: '.jshintrc',
				reporter: require('jshint-stylish')
			},
			all: [
				'Gruntfile.js',
				'{<%= config.app %>,<%= config.demo %>}/scripts/{,*/}*.js',
				'!{<%= config.app %>,<%= config.demo %>}/scripts/vendor/*',
				'test/spec/{,*/}*.js'
			]
		},

		qunit: {
			all: {
				options: {
					urls: [
						'http://localhost:<%= connect.test.options.port %>/index.html'
					]
				}
			}
		},

		compass: {
			options: {
				sassDir: '<%= config.demo %>/styles',
				cssDir: '.tmp/styles',
				generatedImagesDir: '.tmp/images/generated',
				imagesDir: '<%= config.demo %>/images',
				javascriptsDir: '<%= config.demo %>/scripts',
				fontsDir: '<%= config.demo %>/styles/fonts',
				importPath: 'vendor',
				httpImagesPath: '/images',
				httpGeneratedImagesPath: '/images/generated',
				httpFontsPath: '/styles/fonts',
				relativeAssets: false,
				//sourcemap: true
			},
			dist: {
				options: {
					environment: 'production',
					//sourcemap: false,
					debugInfo: false

				}
			},
			demo: {
				options: {
					debugInfo: true
				}
			}
		},
		// not used since Uglify task does concat,
		// but still available if needed
		/*concat: {
			dist: {}
		},*/

		// Uglify for dist
		uglify: {
			min: {
				options: {
					banner: '<%= banner %>'
				},
				files: {
					'<%= config.dist %>/scripts/ember-topcoat-components.min.js': [
						'.tmp/scripts/app-templates.js',
						'.tmp/scripts/app-scripts.js'
					]
				}
			},
			max: {
				options: {
					banner: '<%= banner %>',
					beautify: true
				},
				files: {
					'<%= config.dist %>/scripts/ember-topcoat-components.js': [
						'.tmp/scripts/app-templates.js',
						'.tmp/scripts/app-scripts.js'
					]
				}
			}
		},

		rev: {
			site: {
				files: {
					src: [
						'<%= config.site %>/scripts/{,*/}*.js',
						'<%= config.site %>/styles/{,*/}*.css',
						'<%= config.site %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
						'<%= config.site %>/styles/fonts/*'
					]
				}
			}
		},

		useminPrepare: {
			html: '.tmp/index.html',
			options: {
				dest: '<%= config.site %>'
			}
		},

		usemin: {
			html: ['<%= config.site %>/{,*/}*.html'],
			css: ['<%= config.site %>/styles/{,*/}*.css'],
			options: {
				dirs: [
					'<%= config.site %>'
				],
				assetDirs: [
					'vendor'
				]
			}
		},

		imagemin: {
			dist: {
				files: [{
					expand: true,
					cwd: '<%= config.demo %>/images',
					src: '{,*/}*.{png,jpg,jpeg}',
					dest: '<%= config.site %>/images'
				}]
			}
		},
		svgmin: {
			dist: {
				files: [{
					expand: true,
					cwd: '<%= config.demo %>/images',
					src: '{,*/}*.svg',
					dest: '<%= config.site %>/images'
				}]
			}
		},
		cssmin: {
			dist: {
				files: {
					'<%= config.site %>/styles/main.css': [
						'.tmp/styles/{,*/}*.css',
						'<%= config.demo %>/styles/{,*/}*.css'
					]
				}
			}
		},
		htmlmin: {
			dist: {
				options: {
					/*removeCommentsFromCDATA: true,
					// https://github.com/config/grunt-usemin/issues/44
					//collapseWhitespace: true,
					collapseBooleanAttributes: true,
					removeAttributeQuotes: true,
					removeRedundantAttributes: true,
					useShortDoctype: true,
					removeEmptyAttributes: true,
					removeOptionalTags: true*/
				},
				files: [{
					expand: true,
					cwd: '<%= config.demo %>',
					src: '*.html',
					dest: '<%= config.site %>'
				}]
			}
		},

		replace: {
			demo: {
				options: {
					variables: {
						ember: 'vendor/ember/ember.js'
					}
				},
				files: [{
					src: '<%= config.demo %>/index.html',
					dest: '.tmp/index.html'
				}]
			},
			site: {
				options: {
					variables: {
						ember: 'vendor/ember/ember.prod.js'
					}
				},
				files: [{
					src: '<%= config.demo %>/index.html',
					dest: '.tmp/index.html'
				}]
			}
		},

		// Put files not handled in other tasks here
		copy: {
			dist: {
				files: [{
					expand: true,
					dot: true,
					cwd: '<%= config.demo %>',
					dest: '<%= config.site %>',
					src: [
						'*.{ico,txt}',
						'.htaccess',
						'images/{,*/}*.{webp,gif}',
						'styles/fonts/*'
					]
				}, {
					expand: true,
					cwd: 'vendor',
					dest: '<%= config.site %>/vendor',
					src: [
						'topcoat/css/*.min.css',
						'topcoat/font/*.otf',
						'topcoat/img/*.svg'
					]
				}]
			}
		},

		concurrent: {
			demo: [
				'emberTemplates',
				'compass:demo'
			],
			test: [
				'emberTemplates:app'
			],
			dist: [
				'emberTemplates',
				'compass:dist',
				'imagemin',
				'svgmin',
				'htmlmin'
			]
		},

		emberTemplates: {
			options: {
				templateName: function (sourceFile) {
					// Get rid of '{subfolder}/templates/' at the beginning
					return sourceFile.replace(/[^\.]*\/templates\//, '');
				},
				templateRegistration: function (name, contents) {
					contents = contents.replace(/[\t]+/g, ' ');
					return 'Em.TEMPLATES[\'' + name + '\'] = ' + contents + ';';
				},
			},
			app: {
				files: {
					'.tmp/scripts/app-templates.js': '<%= config.app %>/templates/{,*/}*.hbs'
				}
			},
			demo: {
				files: {
					'.tmp/scripts/demo-templates.js': '<%= config.demo %>/templates/{,*/}*.hbs'
				}
			}
		},
		neuter: {
			app: {
				src: '<%= config.app %>/scripts/tc.js',
				dest: '.tmp/scripts/app-scripts.js'
			},

			demo: {
				src: '<%= config.demo %>/scripts/app.js',
				dest: '.tmp/scripts/demo-scripts.js'
			}
		},

		'gh-pages': {
			options: {
				base: '.tmp/dist'
			},
			src: ['**']
		}

	});

	// Currently only the targets 'demo' and 'test' are supported
	grunt.registerTask('server', function (target) {

		var tasks = [];

		target = target || 'demo';

		tasks.push(
			'clean:main',
			'replace:demo',
			'concurrent:' + target,
			'neuter:app'
		);

		if (target === 'demo') {
			tasks.push('neuter:demo');
		}

		tasks.push(
			'symlink:' + target,
			'connect:' + target,
			'open:' + target,
			'watch'
		);

		grunt.task.run(tasks);

	});

	grunt.registerTask('test', [
		'clean:main',
		'replace:app',
		'concurrent:test',
		'neuter:app',
		'connect:test',
		'qunit'
	]);

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

	grunt.registerTask('publish', [
		'clean:main',
		'build',
		'gh-pages',
		'clean:publish'
	]);

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


<commit_before>'use strict';
var webpack = require('webpack');
var path = require('path');
var _ = require('underscore');

module.exports = function(grunt) {
  var webpackConfig = require(path.join(__dirname, "webpack.config.js"));
  var isDebug = "prod" !== process.env["m"];
  var wCfg = webpackConfig;
  if (!isDebug && wCfg.plugins) {
    if (wCfg.watch) {
      wCfg.watch = false;
    }

    if (wCfg.devtool) {
      delete wCfg.devtool;
    }

    var plugins = [
      new webpack.DefinePlugin({
        'process.env': {
          'NODE_ENV': '"production"'
        }
      }),

      new webpack.optimize.UglifyJsPlugin({
        mangle: {
          except: ['$super', '$', 'exports', 'require']
        },
        compress: {
          warnings: false
        },
        output: {
          comments:false
        }
      })
    ];

    wCfg.plugins = wCfg.plugins.concat(plugins);

  }

  if (isDebug && wCfg.jshint) {
    wCfg.jshint["devel"] = true;
  }

  // jshint-opts
  var jshintOpts = _.defaults({node:true}, require(path.join(__dirname, "jshintrc.js")));

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    jshint: {
      options: jshintOpts,
      src: ['Gruntfile.js', 'webpack.config.js']
    },

    express: {
      run: {
        options: {
          script: __dirname + '/server.js',
          port: 5000,
          delay:1000
        }
      }
    },

    webpack: {
      serv: wCfg
    }

  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-express-server');
  grunt.loadNpmTasks('grunt-webpack');

  // Default task.
  grunt.registerTask('default',
                     isDebug ? ['jshint', 'express:run', 'webpack:serv'] : ['jshint', 'webpack:serv']);

};
<commit_msg>reduce size<commit_after>'use strict';
var webpack = require('webpack');
var path = require('path');
var _ = require('underscore');

module.exports = function(grunt) {
  var webpackConfig = require(path.join(__dirname, "webpack.config.js"));
  var isDebug = "prod" !== process.env["m"];
  var wCfg = webpackConfig;
  if (!isDebug && wCfg.plugins) {
    if (wCfg.watch) {
      wCfg.watch = false;
    }

    if (wCfg.devtool) {
      delete wCfg.devtool;
    }

    var plugins = [
      new webpack.DefinePlugin({
        'process.env': {
          'NODE_ENV': '"production"'
        }
      }),

      new webpack.optimize.UglifyJsPlugin({
        mangle: true,
        compress: {
          warnings: false
        },
        output: {
          comments:false,
          space_colon: false
        }
      })
    ];

    wCfg.plugins = wCfg.plugins.concat(plugins);

  }

  if (isDebug && wCfg.jshint) {
    wCfg.jshint["devel"] = true;
  }

  // jshint-opts
  var jshintOpts = _.defaults({node:true}, require(path.join(__dirname, "jshintrc.js")));

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    jshint: {
      options: jshintOpts,
      src: ['Gruntfile.js', 'webpack.config.js']
    },

    express: {
      run: {
        options: {
          script: __dirname + '/server.js',
          port: 5000,
          delay:1000
        }
      }
    },

    webpack: {
      serv: wCfg
    }

  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-express-server');
  grunt.loadNpmTasks('grunt-webpack');

  // Default task.
  grunt.registerTask('default',
                     isDebug ? ['jshint', 'express:run', 'webpack:serv'] : ['jshint', 'webpack:serv']);

};
<|endoftext|>