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

    require('load-grunt-tasks')(grunt);
    require('time-grunt')(grunt);
    grunt.task.loadTasks('tasks');

    var LIVERELOAD_PORT = 35729;
    var lrSnippet = require('connect-livereload')({
        port: LIVERELOAD_PORT
    });
    var mountFolder = function (connect, dir) {
        return connect.static(require('path').resolve(dir));
    };
    var modRewrite = require('connect-modrewrite');
    var rewriteRules = [
        '!\\.html|\\.xml|\\images|\\.js|\\.css|\\.png|\\.jpg|\\.woff|\\.ttf|\\.svg|\\.ico /index.html [L]'
    ];

    var readConfigJson = function() {
        var _ = require('lodash');

        var isCustomEndpoint = _.findIndex(process.argv, function (val) {
            return val === 'ngconstant:custom';
        }) > -1;

        var buildId;
        var idx = _.findIndex(process.argv, function (val) {
            return val.substring(0, '--build-id='.length) === '--build-id=';
        });
        buildId = idx > -1 ? process.argv[idx].substring('--build-id='.length) : undefined;
        if (buildId !== undefined) {
            buildId = buildId.replace('.', '-');
        } else if (isCustomEndpoint) {
            grunt.fail.fatal('Unable to find --build-id=myfeature. ngconstant:custom only works with arg --build-id.');
        }
        var id = buildId === '' ? 'secxbrl' : 'secxbrl-' + buildId;
        grunt.log.writeln('Report editor will be setup to run against backend: ' + id);
        var config = grunt.file.readJSON('config.json');
        config.custom = {};
        if (buildId) {
            config.custom.buildId = id;
        }
        return config;
    };

    // Project configuration.
    grunt.initConfig({
        config: readConfigJson(),
        watch: {
            less: {
                files:  ['app/**/*.less'],
                tasks: ['less']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    'app/**/*.html',
                    '{.tmp,app}/styles/{,*/}*.css',
                    '{.tmp,app}/**/*.js',
                    'app/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },
        //Connect
        connect: {
            options: {
                port: grunt.option('port') || 9000,
                hostname: '0.0.0.0'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            modRewrite(rewriteRules),
                            mountFolder(connect, 'app'),
                            mountFolder(connect, '')
                        ];
                    }
                }
            },
            dist: {
                options: {
                    keepalive: false,
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            modRewrite(rewriteRules),
                            mountFolder(connect, 'dist')
                        ];
                    }
                }
            },
            'dist-dev': {
                options: {
                    keepalive: false,
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            modRewrite(rewriteRules),
                            mountFolder(connect, 'app'),
                            mountFolder(connect, '')
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                url: 'http://localhost:<%= connect.options.port %>'
            }
        },
        less: {
            dist: {
                options: {
                },
                files: {
                    'app/styles/index.css': ['app/styles/index.less']
                }
            }
        },
        peg: {
            options: { trackLineAndColumn: true },
            excelGrammar : {
                src: 'pegjs/excelGrammar.pegjs',
                dest: 'app/modules/excel-parser.js',
                angular: {
                    module: 'excel-parser',
                    factory: 'ExcelParser'
                }
            },
            formulaGrammar : {
                src: 'pegjs/formulaGrammar.pegjs',
                dest: 'app/modules/formula-parser.js',
                angular: {
                    module: 'formula-parser',
                    factory: 'FormulaParser'
                }
            }
        },
        'swagger-js-codegen': {
            options: {
                apis: [
                    {
                        swagger: 'swagger/reports.json',
                        moduleName: 'report-api',
                        className: 'ReportAPI',
                        fileName: 'report-api.js',
                        angularjs: true
                    },
                    {
                        swagger: 'swagger/session.json',
                        moduleName: 'session-api',
                        className: 'SessionAPI',
                        fileName: 'session-api.js',
                        angularjs: true
                    },
                    {
                        swagger: 'swagger/queries.json',
                        moduleName: 'queries-api',
                        className: 'QueriesAPI',
                        fileName: 'queries-api.js',
                        angularjs: true
                    }
                ],
                dest: 'app/modules'
            },
            all: {}
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: ['.tmp', 'dist/*', '!/.git*']
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            src: ['Gruntfile.js',
                  'app/**/*.js',
                  'tasks/**/*.js',
                  'tests/**/*.js'
            ]
        },
        karma: {
            options: {
                configFile: './karma.conf.js'
            },
            dev: {
                options: {
                    files: [
                        'bower_components/angular/angular.js',
                        'bower_components/angular-mocks-1.2.9/angular-mocks.js',
                        'bower_components/ngprogress-lite/ngprogress-lite.js',
                        'bower_components/angular-ui-router/release/angular-ui-router.js',
                        'bower_components/angular-sanitize/angular-sanitize.js',
                        'bower_components/angular-ui-bootstrap-bower/ui-bootstrap.js',
                        'bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.js',
                        'bower_components/angular-cache/dist/angular-cache.js',
                        'bower_components/layoutmodel-renderer-angular/app/directive/layoutmodel.js',
                        'bower_components/layoutmodel-renderer-angular/app/directive/layoutmodeltemplate.js',
                        'bower_components/flexy-layout/flexy-layout.debug.js',
                        'bower_components/angular-ui-router/release/angular-ui-router.js',
                        'bower_components/angular-ui-tree/dist/angular-ui-tree.js',

                        'app/constants.js',
                        'app/modules/report-api.js',
                        'app/modules/session-api.js',
                        'app/modules/queries-api.js',
                        'app/modules/api.js',
                        'app/modules/excel-parser.js',
                        'app/modules/formula-parser.js',
                        'app/modules/report-api.js',
                        'app/modules/report-model.js',
                        'app/modules/rules-model.js',
                        'app/app.js',
                        'app/modules/excel-parser.js',
                        'app/modules/session-model.js',
                        'app/modules/rules-model.js',
                        'app/modules/filter-model.js',
                        'app/modules/ui/api-status.js',
                        'app/modules/ui/forms.js',
                        'app/modules/ui/account.js',
                        'app/modules/ui/resize.js',
                        'app/modules/formula-parser.js',

                        'app/report/taxonomy/taxonomy.js',
                        'app/report/taxonomy/concept/overview/overview.js',

                        'tests/unit/karma.start.js',
                        'app/**/*-test.js'
                    ]
                }
            }
        },
        coveralls: {
            options: {
                'coverage_dir': 'coverage'
            }
        },
        protractor: {
            travis: 'tests/e2e/config/protractor-travis-nosaucelabs-conf.js',
            local: 'tests/e2e/config/protractor-conf.js'
        },
        ngconstant: {
            options: {
                space: '    '
            },
            server: {
                dest: 'app/constants.js',
                name: 'constants',
                wrap: '/*jshint quotmark:double */\n"use strict";\n\n<%= __ngModule %>',
                constants: {
                    'APPNAME': 'report-editor',
                    'API_URL': '//<%= config.server.api %>/v1',
                    'REGISTRATION_URL': '<%= config.server.registration %>',
                    'ACCOUNT_URL': '<%= config.server.account %>',
                    'DEBUG': true
                }
            },
            test: {
                dest: 'app/constants.js',
                name: 'constants',
                wrap: '/*jshint quotmark:double */\n"use strict";\n\n<%= __ngModule %>',
                constants: {
                    'APPNAME': 'report-editor',
                    'API_URL': '//<%= config.test.api %>/v1',
                    'REGISTRATION_URL': '<%= config.test.registration %>',
                    'ACCOUNT_URL': '<%= config.test.account %>',
                    'DEBUG': true
                }
            },
            beta: {
                dest: 'app/constants.js',
                name: 'constants',
                wrap: '/*jshint quotmark:double */\n"use strict";\n\n<%= __ngModule %>',
                constants: {
                    'APPNAME': 'report-editor',
                    'API_URL': '//<%= config.beta.api %>/v1',
                    'REGISTRATION_URL': '<%= config.beta.registration %>',
                    'ACCOUNT_URL': '<%= config.beta.account %>',
                    'DEBUG': false
                }
            },
            prod: {
                dest: 'app/constants.js',
                name: 'constants',
                wrap: '/*jshint quotmark:double */\n"use strict";\n\n<%= __ngModule %>',
                constants: {
                    'APPNAME': 'report-editor',
                    'API_URL': '//<%= config.prod.api %>/v1',
                    'REGISTRATION_URL': '<%= config.prod.registration %>',
                    'ACCOUNT_URL': '<%= config.prod.account %>',
                    'DEBUG': false
                }
            },
            custom: {
                dest: 'app/constants.js',
                name: 'constants',
                wrap: '/*jshint quotmark:double */\n"use strict";\n\n<%= __ngModule %>',
                constants: {
                    'APPNAME': 'report-editor',
                    'API_URL': '//<%= config.custom.buildId %>.28.io/v1',
                    'REGISTRATION_URL': 'http://<%= config.custom.buildId %>.s3-website-us-east-1.amazonaws.com/auth',
                    'ACCOUNT_URL': 'http://<%= config.custom.buildId %>.s3-website-us-east-1.amazonaws.com/account/info',
                    'DEBUG': true
                }
            }
        },
        s3: {
            options: {
                access: 'public-read',
                maxOperations: 5,
                gzip: true,
                gzipExclude: ['.jpg', '.jpeg', '.png', '.xml', '.json', '.pdf', '.txt', '.ico']
            },
            prod: {
                bucket: 'reports.secxbrl.info',
                upload: [{
                    src: 'dist/**/*',
                    dest: '',
                    rel: 'dist/',
                }]
            }
        },
        jsonlint: {
            all: {
                src: [
                    'package.json',
                    'config.json',
                    'bower.json',
                    '.bowerrc',
                    'swagger/*'
                ]
            }
        },
        useminPrepare: {
            html: [ 'app/**/*.html' ],
            css: 'app/styles/**/*.css',
            options: {
                dest: 'dist'
            }
        },
        usemin: {
            html: [ 'dist/*.html' ],
            css: 'dist/styles/**/*.css',
            options: {
                dirs: ['dist']
            }
        },
        ngmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/concat/scripts',
                    src: '*.js',
                    dest: '.tmp/concat/scripts'
                }]
            }
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'app/images',
                    src: '*.{png,jpg,jpeg,svg}',
                    dest: 'dist/images'
                }]
            }
        },
        htmlmin: {
            dist: {
                options: {},
                files: [{
                    expand: true,
                    cwd: 'app',
                    src: [ '**/*.html'],
                    dest: 'dist'
                }]
            }
        },
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: 'app',
                    dest: 'dist',
                    src: [
                        '*.{ico,png,txt}',
                        'images/**/*.{png,jpg,jpeg,gif,webp,svg}',
                    ]
                }, {
                    expand: true,
                    cwd: 'bower_components/font-awesome/fonts',
                    dest: 'dist/fonts',
                    src: ['*']
                }, {
                    expand: true,
                    cwd: '.tmp/concat/scripts',
                    dest: 'dist/scripts',
                    src: ['*']
                }]
            }
        },
        concurrent: {
            server: [],
            test: [],
            dist: [
                'less',
                'imagemin',
                'htmlmin'
            ]
        },
        rev: {
            dist: {
                files: {
                    src: [
                        'dist/scripts/**/*.js',
                        'dist/styles/**/*.css',
                        'dist/images/**/*.{png,jpg,jpeg,gif,webp,svg}',
                        'dist/styles/fonts/*'
                    ]
                }
            }
        },
        uglify: {
            options: {
                //sourceMap: true,
                //sourceMapIncludeSources: true
            }
        }
    });

    grunt.registerTask('deploy', function() {
        if(process.env.TRAVIS_BRANCH === 'master' && process.env.TRAVIS_PULL_REQUEST === 'false') {
            grunt.task.run(['s3:prod']);
        }
    });

    grunt.registerTask('e2e', function(){
        var target = process.env.TRAVIS_JOB_NUMBER ? 'travis' : 'local';
        grunt.task.run([
            'webdriver',
            'connect:dist',
            'protractor:' + target
        ]);
    });

    grunt.registerTask('e2e-dev', function(){
        var target = process.env.TRAVIS_JOB_NUMBER ? 'travis' : 'local';
        grunt.task.run([
            'webdriver',
            'connect:dist-dev',
            'protractor:' + target
        ]);
    });

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

        grunt.task.run([
            'clean:server',
            'peg',
            'swagger-js-codegen',
            'less',
            'concurrent:server',
            'connect:livereload',
            'open',
            'watch'
        ]);
    });

    grunt.registerTask('build', function () {
        //var env = (target ? target : 'server');

        grunt.task.run([
            'ngconstant:server',
            'clean:dist',
            'less',
            'peg',
            'swagger-js-codegen',
            'useminPrepare',
            'concurrent:dist',
            'concat',
            'copy',
            'ngmin',
            'cssmin',
            'uglify',
            'rev',
            'usemin'
        ]);
    });

    grunt.registerTask('test', ['build', 'karma', 'e2e']);
    grunt.registerTask('default', ['jsonlint', 'jshint', 'test', 'deploy']);
};
<commit_msg>added missing " !== undefined"<commit_after>module.exports = function (grunt) {
    'use strict';

    require('load-grunt-tasks')(grunt);
    require('time-grunt')(grunt);
    grunt.task.loadTasks('tasks');

    var LIVERELOAD_PORT = 35729;
    var lrSnippet = require('connect-livereload')({
        port: LIVERELOAD_PORT
    });
    var mountFolder = function (connect, dir) {
        return connect.static(require('path').resolve(dir));
    };
    var modRewrite = require('connect-modrewrite');
    var rewriteRules = [
        '!\\.html|\\.xml|\\images|\\.js|\\.css|\\.png|\\.jpg|\\.woff|\\.ttf|\\.svg|\\.ico /index.html [L]'
    ];

    var readConfigJson = function() {
        var _ = require('lodash');

        var isCustomEndpoint = _.findIndex(process.argv, function (val) {
            return val === 'ngconstant:custom';
        }) > -1;

        var buildId;
        var idx = _.findIndex(process.argv, function (val) {
            return val.substring(0, '--build-id='.length) === '--build-id=';
        });
        buildId = idx > -1 ? process.argv[idx].substring('--build-id='.length) : undefined;
        if (buildId !== undefined) {
            buildId = buildId.replace('.', '-');
        } else if (isCustomEndpoint) {
            grunt.fail.fatal('Unable to find --build-id=myfeature. ngconstant:custom only works with arg --build-id.');
        }
        var id = buildId === '' ? 'secxbrl' : 'secxbrl-' + buildId;
        grunt.log.writeln('Report editor will be setup to run against backend: ' + id);
        var config = grunt.file.readJSON('config.json');
        config.custom = {};
        if (buildId !== undefined) {
            config.custom.buildId = id;
        }
        return config;
    };

    // Project configuration.
    grunt.initConfig({
        config: readConfigJson(),
        watch: {
            less: {
                files:  ['app/**/*.less'],
                tasks: ['less']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    'app/**/*.html',
                    '{.tmp,app}/styles/{,*/}*.css',
                    '{.tmp,app}/**/*.js',
                    'app/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },
        //Connect
        connect: {
            options: {
                port: grunt.option('port') || 9000,
                hostname: '0.0.0.0'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            modRewrite(rewriteRules),
                            mountFolder(connect, 'app'),
                            mountFolder(connect, '')
                        ];
                    }
                }
            },
            dist: {
                options: {
                    keepalive: false,
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            modRewrite(rewriteRules),
                            mountFolder(connect, 'dist')
                        ];
                    }
                }
            },
            'dist-dev': {
                options: {
                    keepalive: false,
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            modRewrite(rewriteRules),
                            mountFolder(connect, 'app'),
                            mountFolder(connect, '')
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                url: 'http://localhost:<%= connect.options.port %>'
            }
        },
        less: {
            dist: {
                options: {
                },
                files: {
                    'app/styles/index.css': ['app/styles/index.less']
                }
            }
        },
        peg: {
            options: { trackLineAndColumn: true },
            excelGrammar : {
                src: 'pegjs/excelGrammar.pegjs',
                dest: 'app/modules/excel-parser.js',
                angular: {
                    module: 'excel-parser',
                    factory: 'ExcelParser'
                }
            },
            formulaGrammar : {
                src: 'pegjs/formulaGrammar.pegjs',
                dest: 'app/modules/formula-parser.js',
                angular: {
                    module: 'formula-parser',
                    factory: 'FormulaParser'
                }
            }
        },
        'swagger-js-codegen': {
            options: {
                apis: [
                    {
                        swagger: 'swagger/reports.json',
                        moduleName: 'report-api',
                        className: 'ReportAPI',
                        fileName: 'report-api.js',
                        angularjs: true
                    },
                    {
                        swagger: 'swagger/session.json',
                        moduleName: 'session-api',
                        className: 'SessionAPI',
                        fileName: 'session-api.js',
                        angularjs: true
                    },
                    {
                        swagger: 'swagger/queries.json',
                        moduleName: 'queries-api',
                        className: 'QueriesAPI',
                        fileName: 'queries-api.js',
                        angularjs: true
                    }
                ],
                dest: 'app/modules'
            },
            all: {}
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: ['.tmp', 'dist/*', '!/.git*']
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            src: ['Gruntfile.js',
                  'app/**/*.js',
                  'tasks/**/*.js',
                  'tests/**/*.js'
            ]
        },
        karma: {
            options: {
                configFile: './karma.conf.js'
            },
            dev: {
                options: {
                    files: [
                        'bower_components/angular/angular.js',
                        'bower_components/angular-mocks-1.2.9/angular-mocks.js',
                        'bower_components/ngprogress-lite/ngprogress-lite.js',
                        'bower_components/angular-ui-router/release/angular-ui-router.js',
                        'bower_components/angular-sanitize/angular-sanitize.js',
                        'bower_components/angular-ui-bootstrap-bower/ui-bootstrap.js',
                        'bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.js',
                        'bower_components/angular-cache/dist/angular-cache.js',
                        'bower_components/layoutmodel-renderer-angular/app/directive/layoutmodel.js',
                        'bower_components/layoutmodel-renderer-angular/app/directive/layoutmodeltemplate.js',
                        'bower_components/flexy-layout/flexy-layout.debug.js',
                        'bower_components/angular-ui-router/release/angular-ui-router.js',
                        'bower_components/angular-ui-tree/dist/angular-ui-tree.js',

                        'app/constants.js',
                        'app/modules/report-api.js',
                        'app/modules/session-api.js',
                        'app/modules/queries-api.js',
                        'app/modules/api.js',
                        'app/modules/excel-parser.js',
                        'app/modules/formula-parser.js',
                        'app/modules/report-api.js',
                        'app/modules/report-model.js',
                        'app/modules/rules-model.js',
                        'app/app.js',
                        'app/modules/excel-parser.js',
                        'app/modules/session-model.js',
                        'app/modules/rules-model.js',
                        'app/modules/filter-model.js',
                        'app/modules/ui/api-status.js',
                        'app/modules/ui/forms.js',
                        'app/modules/ui/account.js',
                        'app/modules/ui/resize.js',
                        'app/modules/formula-parser.js',

                        'app/report/taxonomy/taxonomy.js',
                        'app/report/taxonomy/concept/overview/overview.js',

                        'tests/unit/karma.start.js',
                        'app/**/*-test.js'
                    ]
                }
            }
        },
        coveralls: {
            options: {
                'coverage_dir': 'coverage'
            }
        },
        protractor: {
            travis: 'tests/e2e/config/protractor-travis-nosaucelabs-conf.js',
            local: 'tests/e2e/config/protractor-conf.js'
        },
        ngconstant: {
            options: {
                space: '    '
            },
            server: {
                dest: 'app/constants.js',
                name: 'constants',
                wrap: '/*jshint quotmark:double */\n"use strict";\n\n<%= __ngModule %>',
                constants: {
                    'APPNAME': 'report-editor',
                    'API_URL': '//<%= config.server.api %>/v1',
                    'REGISTRATION_URL': '<%= config.server.registration %>',
                    'ACCOUNT_URL': '<%= config.server.account %>',
                    'DEBUG': true
                }
            },
            test: {
                dest: 'app/constants.js',
                name: 'constants',
                wrap: '/*jshint quotmark:double */\n"use strict";\n\n<%= __ngModule %>',
                constants: {
                    'APPNAME': 'report-editor',
                    'API_URL': '//<%= config.test.api %>/v1',
                    'REGISTRATION_URL': '<%= config.test.registration %>',
                    'ACCOUNT_URL': '<%= config.test.account %>',
                    'DEBUG': true
                }
            },
            beta: {
                dest: 'app/constants.js',
                name: 'constants',
                wrap: '/*jshint quotmark:double */\n"use strict";\n\n<%= __ngModule %>',
                constants: {
                    'APPNAME': 'report-editor',
                    'API_URL': '//<%= config.beta.api %>/v1',
                    'REGISTRATION_URL': '<%= config.beta.registration %>',
                    'ACCOUNT_URL': '<%= config.beta.account %>',
                    'DEBUG': false
                }
            },
            prod: {
                dest: 'app/constants.js',
                name: 'constants',
                wrap: '/*jshint quotmark:double */\n"use strict";\n\n<%= __ngModule %>',
                constants: {
                    'APPNAME': 'report-editor',
                    'API_URL': '//<%= config.prod.api %>/v1',
                    'REGISTRATION_URL': '<%= config.prod.registration %>',
                    'ACCOUNT_URL': '<%= config.prod.account %>',
                    'DEBUG': false
                }
            },
            custom: {
                dest: 'app/constants.js',
                name: 'constants',
                wrap: '/*jshint quotmark:double */\n"use strict";\n\n<%= __ngModule %>',
                constants: {
                    'APPNAME': 'report-editor',
                    'API_URL': '//<%= config.custom.buildId %>.28.io/v1',
                    'REGISTRATION_URL': 'http://<%= config.custom.buildId %>.s3-website-us-east-1.amazonaws.com/auth',
                    'ACCOUNT_URL': 'http://<%= config.custom.buildId %>.s3-website-us-east-1.amazonaws.com/account/info',
                    'DEBUG': true
                }
            }
        },
        s3: {
            options: {
                access: 'public-read',
                maxOperations: 5,
                gzip: true,
                gzipExclude: ['.jpg', '.jpeg', '.png', '.xml', '.json', '.pdf', '.txt', '.ico']
            },
            prod: {
                bucket: 'reports.secxbrl.info',
                upload: [{
                    src: 'dist/**/*',
                    dest: '',
                    rel: 'dist/',
                }]
            }
        },
        jsonlint: {
            all: {
                src: [
                    'package.json',
                    'config.json',
                    'bower.json',
                    '.bowerrc',
                    'swagger/*'
                ]
            }
        },
        useminPrepare: {
            html: [ 'app/**/*.html' ],
            css: 'app/styles/**/*.css',
            options: {
                dest: 'dist'
            }
        },
        usemin: {
            html: [ 'dist/*.html' ],
            css: 'dist/styles/**/*.css',
            options: {
                dirs: ['dist']
            }
        },
        ngmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/concat/scripts',
                    src: '*.js',
                    dest: '.tmp/concat/scripts'
                }]
            }
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'app/images',
                    src: '*.{png,jpg,jpeg,svg}',
                    dest: 'dist/images'
                }]
            }
        },
        htmlmin: {
            dist: {
                options: {},
                files: [{
                    expand: true,
                    cwd: 'app',
                    src: [ '**/*.html'],
                    dest: 'dist'
                }]
            }
        },
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: 'app',
                    dest: 'dist',
                    src: [
                        '*.{ico,png,txt}',
                        'images/**/*.{png,jpg,jpeg,gif,webp,svg}',
                    ]
                }, {
                    expand: true,
                    cwd: 'bower_components/font-awesome/fonts',
                    dest: 'dist/fonts',
                    src: ['*']
                }, {
                    expand: true,
                    cwd: '.tmp/concat/scripts',
                    dest: 'dist/scripts',
                    src: ['*']
                }]
            }
        },
        concurrent: {
            server: [],
            test: [],
            dist: [
                'less',
                'imagemin',
                'htmlmin'
            ]
        },
        rev: {
            dist: {
                files: {
                    src: [
                        'dist/scripts/**/*.js',
                        'dist/styles/**/*.css',
                        'dist/images/**/*.{png,jpg,jpeg,gif,webp,svg}',
                        'dist/styles/fonts/*'
                    ]
                }
            }
        },
        uglify: {
            options: {
                //sourceMap: true,
                //sourceMapIncludeSources: true
            }
        }
    });

    grunt.registerTask('deploy', function() {
        if(process.env.TRAVIS_BRANCH === 'master' && process.env.TRAVIS_PULL_REQUEST === 'false') {
            grunt.task.run(['s3:prod']);
        }
    });

    grunt.registerTask('e2e', function(){
        var target = process.env.TRAVIS_JOB_NUMBER ? 'travis' : 'local';
        grunt.task.run([
            'webdriver',
            'connect:dist',
            'protractor:' + target
        ]);
    });

    grunt.registerTask('e2e-dev', function(){
        var target = process.env.TRAVIS_JOB_NUMBER ? 'travis' : 'local';
        grunt.task.run([
            'webdriver',
            'connect:dist-dev',
            'protractor:' + target
        ]);
    });

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

        grunt.task.run([
            'clean:server',
            'peg',
            'swagger-js-codegen',
            'less',
            'concurrent:server',
            'connect:livereload',
            'open',
            'watch'
        ]);
    });

    grunt.registerTask('build', function () {
        //var env = (target ? target : 'server');

        grunt.task.run([
            'ngconstant:server',
            'clean:dist',
            'less',
            'peg',
            'swagger-js-codegen',
            'useminPrepare',
            'concurrent:dist',
            'concat',
            'copy',
            'ngmin',
            'cssmin',
            'uglify',
            'rev',
            'usemin'
        ]);
    });

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


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

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-zip');

    grunt.initConfig({
        less: {
            dev: {
                options: {
                    sourceMap: true,
                    sourceMapFilename: 'styles/css/style.css.map'
                },
                files: {
                    'styles/css/style.css': 'styles/less/main.less'
                }
            }
        },
        watch: {
            less: {
                files: ['styles/**/*.less'],
                tasks: ['less'],
            },
            js: {
                files: ['js/**/*.js'],
                tasks: ['jshint'],
            }
        },
        jshint: {
          files: [
            'Gruntfile.js',
            'js/**/*.js',
            '!js/lib/**/*.js',
          ],
        },
        zip: {
          'dist.zip': [
            'fonts/**/*',
            'images/**/*',
            'js/**/*',
            'styles/css/**/*',
            'background.js',
            'index.html',
            'manifest.json']
        }
    });

    grunt.registerTask('default', ['less', 'jshint']);
};
<commit_msg>Added "dist" grunt task<commit_after>module.exports = function(grunt) {
    'use strict';

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-zip');

    grunt.initConfig({
        less: {
            dev: {
                options: {
                    sourceMap: true,
                    sourceMapFilename: 'styles/css/style.css.map'
                },
                files: {
                    'styles/css/style.css': 'styles/less/main.less'
                }
            }
        },
        watch: {
            less: {
                files: ['styles/**/*.less'],
                tasks: ['less'],
            },
            js: {
                files: ['js/**/*.js'],
                tasks: ['jshint'],
            }
        },
        jshint: {
          files: [
            'Gruntfile.js',
            'js/**/*.js',
            '!js/lib/**/*.js',
          ],
        },
        zip: {
          'dist.zip': [
            'fonts/**/*',
            'images/**/*',
            'js/**/*',
            'styles/css/**/*',
            'background.js',
            'index.html',
            'manifest.json']
        }
    });

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


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

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        src: 'src/<%= pkg.name %>.js',
        dest: 'build/<%= pkg.name %>-<%= pkg.version %>.min.js'
      }
    },
    jasmine: {
      src: "src/**/*.js",
      options: {
        specs: "spec/**/*_spec.js",
        vendor: [
          "vendor/jquery/jquery-1.10.2.min.js",
          "vendor/spin.min.js",
          "vendor/jquery.spin.js",
          "vendor/jasmine-jquery.1.5.91.js"
        ],
        keepRunner: true
      }
    },
    jshint: {
      // define the files to lint
      files: ['gruntfile.js', 'src/**/*.js', 'spec/**/*.js'],
      // configure JSHint (documented at http://www.jshint.com/docs/)
      options: {
          // more options here if you want to override JSHint defaults
        globals: {
          jQuery: true,
          console: true,
          module: true
        }
      }
    }
  });

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

  // Default task(s).
  // grunt.registerTask('test', ['jshint', 'jasmine']);
  grunt.registerTask('test', ['jasmine']);
  grunt.registerTask('clean', 'jshint');
  grunt.registerTask('default', ['test']);

};
<commit_msg>make jshnt default when running tests<commit_after>module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        src: 'src/<%= pkg.name %>.js',
        dest: 'build/<%= pkg.name %>-<%= pkg.version %>.min.js'
      }
    },
    jasmine: {
      src: "src/**/*.js",
      options: {
        specs: "spec/**/*_spec.js",
        vendor: [
          "vendor/jquery/jquery-1.10.2.min.js",
          "vendor/spin.min.js",
          "vendor/jquery.spin.js",
          "vendor/jasmine-jquery.1.5.91.js"
        ],
        keepRunner: true
      }
    },
    jshint: {
      // define the files to lint
      files: ['gruntfile.js', 'src/**/*.js', 'spec/**/*.js'],
      // configure JSHint (documented at http://www.jshint.com/docs/)
      options: {
          // more options here if you want to override JSHint defaults
        globals: {
          jQuery: true,
          console: true,
          module: true
        }
      }
    }
  });

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

  // Default task(s).
  grunt.registerTask('test', ['jshint', 'jasmine']);
  grunt.registerTask('clean', 'jshint');
  grunt.registerTask('default', ['test']);

};
<|endoftext|>


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

    grunt.loadNpmTasks('grunt-contrib-copy');
    require("load-grunt-tasks")(grunt);

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

        clean: {
            dist: ["dist"]
        },

        copy: {
            main: {
                files: [
                    {
                        expand: true,
                        dot: true,
                        cwd: 'src',
                        dest: 'dist',
                        src: [
                            '**'

                        ]
                    }
                ]
            }
        }
    });

    grunt.registerTask("default", [
        "clean",
        "copy"
    ]);
};<commit_msg>added grunt-release<commit_after>module.exports = function (grunt) {
    "use strict";

    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-release');
    require("load-grunt-tasks")(grunt);

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

        clean: {
            dist: ["dist"]
        },

        copy: {
            main: {
                files: [
                    {
                        expand: true,
                        dot: true,
                        cwd: 'src',
                        dest: 'dist',
                        src: [
                            '**'

                        ]
                    }
                ]
            }
        }
    });

    grunt.registerTask("default", [
        "clean",
        "copy"
    ]);
};<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

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

  // Project Configuration
  grunt.initConfig({
    exec: {
      appConfig: {
        command: 'node ./util/buildAppConfig.js'
      },
      coinbase: {
        command: 'node ./util/coinbase.js'
      },
      clean: {
        command: 'rm -Rf bower_components node_modules'
      },
      cordovaclean: {
        command: 'make -C cordova clean'
      },
      osx: {
        command: 'webkitbuilds/build-osx.sh sign'
      },
      coveralls: {
        command: 'cat  coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js'
      },
      chrome: {
        command: 'make -C chrome-app '
      },
      wp: {
        command: 'make -C cordova wp',
      },
      ios: {
        command: 'make -C cordova ios',
      },
      xcode: {
        command: 'open cordova/project-ios/platforms/ios/*.xcodeproj',
      },
      android: {
        command: 'make -C cordova android',
      },
      androidrun: {
        command: 'make -C cordova androidrun',
      },
      androidbuild: {
        command: 'cd cordova/project && cordova build android --release',
      },
      androidsign: {
        command: 'rm -f cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk  cordova/project/platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play && ../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk ',
        stdin: true,
      },
      desktopsign: {
        cmd: 'gpg -u 1112CFA1 --output webkitbuilds/Copay-linux.zip.sig --detach-sig webkitbuilds/Copay-linux.zip && gpg -u 1112CFA1 --output webkitbuilds/Copay-win.exe.sig --detach-sig webkitbuilds/Copay-win.exe'
      },
      desktopverify: {
        cmd: 'gpg --verify webkitbuilds/Copay-linux.zip.sig webkitbuilds/Copay-linux.zip && gpg --verify webkitbuilds/Copay-win.exe.sig webkitbuilds/Copay-win.exe'
      },
    },
    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...');
        },
      },
      css: {
        files: ['src/css/*.css'],
        tasks: ['concat:css']
      },
      sass: {
        files: ['src/sass/*.scss'],
        tasks: ['sass', 'concat:css']
      },
      main: {
        files: [
          'src/js/init.js',
          'src/js/app.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/routes.js',
          'src/js/services/*.js',
          'src/js/models/*.js',
          'src/js/controllers/**/*.js'
        ],
        tasks: ['concat:js']
      }
    },
    sass: {
      dist: {
        options: {
          style: 'compact',
          sourcemap: 'none'
        },
        files: [{
          expand: true,
          src: ['src/sass/*.scss'],
          dest: './',
          ext: '.css'
        }]
      }
    },
    concat: {
      options: {
        sourceMap: false,
        sourceMapStyle: 'link' // embed, link, inline
      },
      angular: {
        src: [
          'bower_components/qrcode-generator/js/qrcode.js',
          'bower_components/qrcode-decoder-js/lib/qrcode-decoder.js',
          'bower_components/moment/min/moment-with-locales.js',
          'bower_components/angular-moment/angular-moment.js',
          'bower_components/ng-lodash/build/ng-lodash.js',
          'bower_components/angular-qrcode/angular-qrcode.js',
          'bower_components/angular-gettext/dist/angular-gettext.js',
          'bower_components/ng-csv/build/ng-csv.js',
          'bower_components/ionic-toast/dist/ionic-toast.bundle.min.js',
          'bower_components/angular-clipboard/angular-clipboard.js',
          'bower_components/angular-mocks/angular-mocks.js',
          'angular-pbkdf2/angular-pbkdf2.js',
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js'
        ],
        dest: 'public/lib/angular.js'
      },
      js: {
        src: [
          'src/js/app.js',
          'src/js/routes.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/models/*.js',
          'src/js/services/*.js',
          'src/js/controllers/**/*.js',
          'src/js/translations.js',
          'src/js/appConfig.js',
          'src/js/coinbase.js',
          'src/js/init.js',
          'src/js/trezor-url.js',
          'bower_components/trezor-connect/login.js'
        ],
        dest: 'public/js/copay.js'
      },
      css: {
        src: ['src/sass/*.css', 'src/css/*.css'],
        dest: 'public/css/copay.css'
      }
    },
    uglify: {
      options: {
        mangle: false
      },
      prod: {
        files: {
          'public/js/copay.js': ['public/js/copay.js'],
          'public/lib/angular.js': ['public/lib/angular.js']
        }
      }
    },
    nggettext_extract: {
      pot: {
        files: {
          'i18n/po/template.pot': [
            'public/index.html',
            'public/views/**/*.html',
            'src/js/routes.js',
            'src/js/services/*.js',
            'src/js/controllers/**/*.js'
          ]
        }
      },
    },
    nggettext_compile: {
      all: {
        options: {
          module: 'copayApp'
        },
        files: {
          'src/js/translations.js': ['i18n/po/*.po']
        }
      },
    },
    copy: {
      ionic_fonts: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/fonts/ionicons.*',
        dest: 'public/fonts/'
      },
      ionic_js: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/js/ionic.bundle.min.js',
        dest: 'public/lib/'
      },
      ionic_css: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/css/ionic.min.css',
        dest: 'public/css/'
      },
      linux: {
        files: [{
          expand: true,
          cwd: 'webkitbuilds/',
          src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],
          dest: 'webkitbuilds/Copay/linux64/',
          flatten: true,
          filter: 'isFile'
        }],
      }
    },
    karma: {
      unit: {
        configFile: 'test/karma.conf.js'
      },
      prod: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    },
    nwjs: {
      options: {
        appName: 'Copay',
        platforms: ['win64', 'osx64', 'linux64'],
        buildDir: './webkitbuilds',
        version: '0.16.0',
        macIcns: './public/img/icons/icon.icns',
        exeIco: './public/img/icons/icon.ico'
      },
      src: ['./package.json', './public/**/*']
    },
    compress: {
      linux: {
        options: {
          archive: './webkitbuilds/Copay-linux.zip'
        },
        expand: true,
        cwd: './webkitbuilds/Copay/linux64/',
        src: ['**/*'],
        dest: 'copay-linux/'
      }
    },
    browserify: {
      dist: {
        files: {
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js'],
          'angular-pbkdf2/angular-pbkdf2.js': ['angular-pbkdf2/index.js']
        },
      }
    }
  });

  grunt.registerTask('default', ['nggettext_compile', 'exec:appConfig', 'exec:coinbase', 'browserify', 'sass', 'concat', 'copy:ionic_fonts', 'copy:ionic_js', 'copy:ionic_css']);
  grunt.registerTask('prod', ['default', 'uglify']);
  grunt.registerTask('translate', ['nggettext_extract']);
  grunt.registerTask('test', ['karma:unit']);
  grunt.registerTask('test-coveralls', ['browserify', 'karma:prod', 'exec:coveralls']);
  grunt.registerTask('desktop', ['prod', 'nwjs', 'copy:linux', 'compress:linux']);
  grunt.registerTask('osx', ['prod', 'nwjs', 'exec:osx']);
  grunt.registerTask('chrome', ['exec:chrome']);
  grunt.registerTask('wp', ['prod', 'exec:wp']);
  grunt.registerTask('wp-debug', ['default', 'exec:wp']);
  grunt.registerTask('ios', ['prod', 'exec:ios']);
  grunt.registerTask('ios-debug', ['default', 'exec:ios']);
  grunt.registerTask('ios-run', ['exec:xcode']);
  grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
  grunt.registerTask('android-debug', ['default', 'exec:android', 'exec:androidrun']);
  grunt.registerTask('android', ['prod', 'exec:android']);
  grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']);
  grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']);

};
<commit_msg>update gruntfile to monitor nested scss files<commit_after>'use strict';

module.exports = function(grunt) {

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

  // Project Configuration
  grunt.initConfig({
    exec: {
      appConfig: {
        command: 'node ./util/buildAppConfig.js'
      },
      coinbase: {
        command: 'node ./util/coinbase.js'
      },
      clean: {
        command: 'rm -Rf bower_components node_modules'
      },
      cordovaclean: {
        command: 'make -C cordova clean'
      },
      osx: {
        command: 'webkitbuilds/build-osx.sh sign'
      },
      coveralls: {
        command: 'cat  coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js'
      },
      chrome: {
        command: 'make -C chrome-app '
      },
      wp: {
        command: 'make -C cordova wp',
      },
      ios: {
        command: 'make -C cordova ios',
      },
      xcode: {
        command: 'open cordova/project-ios/platforms/ios/*.xcodeproj',
      },
      android: {
        command: 'make -C cordova android',
      },
      androidrun: {
        command: 'make -C cordova androidrun',
      },
      androidbuild: {
        command: 'cd cordova/project && cordova build android --release',
      },
      androidsign: {
        command: 'rm -f cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk  cordova/project/platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play && ../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk ',
        stdin: true,
      },
      desktopsign: {
        cmd: 'gpg -u 1112CFA1 --output webkitbuilds/Copay-linux.zip.sig --detach-sig webkitbuilds/Copay-linux.zip && gpg -u 1112CFA1 --output webkitbuilds/Copay-win.exe.sig --detach-sig webkitbuilds/Copay-win.exe'
      },
      desktopverify: {
        cmd: 'gpg --verify webkitbuilds/Copay-linux.zip.sig webkitbuilds/Copay-linux.zip && gpg --verify webkitbuilds/Copay-win.exe.sig webkitbuilds/Copay-win.exe'
      },
    },
    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...');
        },
      },
      css: {
        files: ['src/css/*.css'],
        tasks: ['concat:css']
      },
      sass: {
        files: ['src/sass/**/*.scss'],
        tasks: ['sass', 'concat:css']
      },
      main: {
        files: [
          'src/js/init.js',
          'src/js/app.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/routes.js',
          'src/js/services/*.js',
          'src/js/models/*.js',
          'src/js/controllers/**/*.js'
        ],
        tasks: ['concat:js']
      }
    },
    sass: {
      dist: {
        options: {
          style: 'compact',
          sourcemap: 'none'
        },
        files: [{
          expand: true,
          src: ['src/sass/*.scss'],
          dest: './',
          ext: '.css'
        }]
      }
    },
    concat: {
      options: {
        sourceMap: false,
        sourceMapStyle: 'link' // embed, link, inline
      },
      angular: {
        src: [
          'bower_components/qrcode-generator/js/qrcode.js',
          'bower_components/qrcode-decoder-js/lib/qrcode-decoder.js',
          'bower_components/moment/min/moment-with-locales.js',
          'bower_components/angular-moment/angular-moment.js',
          'bower_components/ng-lodash/build/ng-lodash.js',
          'bower_components/angular-qrcode/angular-qrcode.js',
          'bower_components/angular-gettext/dist/angular-gettext.js',
          'bower_components/ng-csv/build/ng-csv.js',
          'bower_components/ionic-toast/dist/ionic-toast.bundle.min.js',
          'bower_components/angular-clipboard/angular-clipboard.js',
          'bower_components/angular-mocks/angular-mocks.js',
          'angular-pbkdf2/angular-pbkdf2.js',
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js'
        ],
        dest: 'public/lib/angular.js'
      },
      js: {
        src: [
          'src/js/app.js',
          'src/js/routes.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/models/*.js',
          'src/js/services/*.js',
          'src/js/controllers/**/*.js',
          'src/js/translations.js',
          'src/js/appConfig.js',
          'src/js/coinbase.js',
          'src/js/init.js',
          'src/js/trezor-url.js',
          'bower_components/trezor-connect/login.js'
        ],
        dest: 'public/js/copay.js'
      },
      css: {
        src: ['src/sass/*.css', 'src/css/*.css'],
        dest: 'public/css/copay.css'
      }
    },
    uglify: {
      options: {
        mangle: false
      },
      prod: {
        files: {
          'public/js/copay.js': ['public/js/copay.js'],
          'public/lib/angular.js': ['public/lib/angular.js']
        }
      }
    },
    nggettext_extract: {
      pot: {
        files: {
          'i18n/po/template.pot': [
            'public/index.html',
            'public/views/**/*.html',
            'src/js/routes.js',
            'src/js/services/*.js',
            'src/js/controllers/**/*.js'
          ]
        }
      },
    },
    nggettext_compile: {
      all: {
        options: {
          module: 'copayApp'
        },
        files: {
          'src/js/translations.js': ['i18n/po/*.po']
        }
      },
    },
    copy: {
      ionic_fonts: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/fonts/ionicons.*',
        dest: 'public/fonts/'
      },
      ionic_js: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/js/ionic.bundle.min.js',
        dest: 'public/lib/'
      },
      ionic_css: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/css/ionic.min.css',
        dest: 'public/css/'
      },
      linux: {
        files: [{
          expand: true,
          cwd: 'webkitbuilds/',
          src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],
          dest: 'webkitbuilds/Copay/linux64/',
          flatten: true,
          filter: 'isFile'
        }],
      }
    },
    karma: {
      unit: {
        configFile: 'test/karma.conf.js'
      },
      prod: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    },
    nwjs: {
      options: {
        appName: 'Copay',
        platforms: ['win64', 'osx64', 'linux64'],
        buildDir: './webkitbuilds',
        version: '0.16.0',
        macIcns: './public/img/icons/icon.icns',
        exeIco: './public/img/icons/icon.ico'
      },
      src: ['./package.json', './public/**/*']
    },
    compress: {
      linux: {
        options: {
          archive: './webkitbuilds/Copay-linux.zip'
        },
        expand: true,
        cwd: './webkitbuilds/Copay/linux64/',
        src: ['**/*'],
        dest: 'copay-linux/'
      }
    },
    browserify: {
      dist: {
        files: {
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js'],
          'angular-pbkdf2/angular-pbkdf2.js': ['angular-pbkdf2/index.js']
        },
      }
    }
  });

  grunt.registerTask('default', ['nggettext_compile', 'exec:appConfig', 'exec:coinbase', 'browserify', 'sass', 'concat', 'copy:ionic_fonts', 'copy:ionic_js', 'copy:ionic_css']);
  grunt.registerTask('prod', ['default', 'uglify']);
  grunt.registerTask('translate', ['nggettext_extract']);
  grunt.registerTask('test', ['karma:unit']);
  grunt.registerTask('test-coveralls', ['browserify', 'karma:prod', 'exec:coveralls']);
  grunt.registerTask('desktop', ['prod', 'nwjs', 'copy:linux', 'compress:linux']);
  grunt.registerTask('osx', ['prod', 'nwjs', 'exec:osx']);
  grunt.registerTask('chrome', ['exec:chrome']);
  grunt.registerTask('wp', ['prod', 'exec:wp']);
  grunt.registerTask('wp-debug', ['default', 'exec:wp']);
  grunt.registerTask('ios', ['prod', 'exec:ios']);
  grunt.registerTask('ios-debug', ['default', 'exec:ios']);
  grunt.registerTask('ios-run', ['exec:xcode']);
  grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
  grunt.registerTask('android-debug', ['default', 'exec:android', 'exec:androidrun']);
  grunt.registerTask('android', ['prod', 'exec:android']);
  grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']);
  grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']);

};
<|endoftext|>


<commit_before>/*global module:false*/

var env = require("./.env.js"),
		s3 = require("./.s3.js");

module.exports = function (grunt) {

	var message = grunt.option('m');

  // Project configuration.
  grunt.initConfig({
		pkg: grunt.file.readJSON("package.json"),
		clean: [ "dist/" ],

		aws_s3: {
			release: {
				options: {
					accessKeyId: s3.accessKeyId,
					secretAccessKey: s3.secretAccessKey,
					bucket: env.s3.bucket,
					region: env.s3.region,
					sslEnabled: false
				},
				files: [
					{
						expand: true,
						dest: ".",
						cwd: "dist/",
						src: ["**"],
						action: "upload",
						differential: true
					}
				]
			}
		},

		push: {
			options: {
				tagName: "%VERSION%",
				commitMessage: "Release v%VERSION%" + (message ? ' - ' + message : '')
			}
		},

		shell: {
			build: {
				command: function (project) {
					return "cd ../" + project + "; grunt build;";
				}
			},
			bump: {
				command: function (project, release) {
					return "cd ../" + project + "; grunt bumpup:" + release;
				}
			}
		},

		"merge-copy": {
			release: {
				options: {
					destination: "dist/",
					directories: [ "../main/dist/", "../lab/dist/" ]
				}
			}
		}

  });

  // These plugins provide necessary tasks.

	grunt.loadNpmTasks("grunt-shell");
	grunt.loadNpmTasks("grunt-aws-s3");
	grunt.loadNpmTasks("grunt-merge-copy");
	grunt.loadNpmTasks("grunt-push-release");
	grunt.loadNpmTasks("grunt-contrib-clean");

  // Default task.

	grunt.registerTask("deploy:setup", ["clean", "shell:build:main", "shell:build:lab",  "merge-copy:release"]);
	grunt.registerTask("deploy:setup", ["clean", "shell:build:main", "shell:build:lab",  "merge-copy:release"]);

	grunt.registerTask("deploy:major", ["shell:bump:main:major", "deploy:setup", "push:major", "aws_s3:release"]);
	grunt.registerTask("deploy:minor", ["shell:bump:main:minor", "deploy:setup", "push:minor", "aws_s3:release"]);
	grunt.registerTask("deploy:patch", ["shell:bump:main:patch", "deploy:setup", "push:patch", "aws_s3:release"]);
	grunt.registerTask("deploy", ["deploy:patch"]);

};
<commit_msg>Whitespace cleanup and comments<commit_after>/*global module:false*/

var env = require("./.env.js"),
    s3 = require("./.s3.js");

module.exports = function (grunt) {

  var message = grunt.option('m');

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON("package.json"),
    clean: [ "dist/" ],

    aws_s3: {
      release: {
        options: {
          accessKeyId: s3.accessKeyId,
          secretAccessKey: s3.secretAccessKey,
          bucket: env.s3.bucket,
          region: env.s3.region,
          sslEnabled: false
        },
        files: [
          {
            expand: true,
            dest: ".",
            cwd: "dist/",
            src: ["**"],
            action: "upload",
            differential: true
          }
        ]
      }
    },

    push: {
      options: {
        tagName: "%VERSION%",
        commitMessage: "Release v%VERSION%" + (message ? ' - ' + message : '')
      }
    },

    shell: {
      build: {
        command: function (project) {
          return "cd ../" + project + "; grunt build;";
        }
      },
      bump: {
        command: function (project, release) {
          return "cd ../" + project + "; grunt bumpup:" + release;
        }
      }
    },

    "merge-copy": {
      release: {
        options: {
          destination: "dist/",
          directories: [ "../main/dist/", "../lab/dist/" ]
        }
      }
    }

  });

  // These plugins provide necessary tasks.

  grunt.loadNpmTasks("grunt-shell");
  grunt.loadNpmTasks("grunt-aws-s3");
  grunt.loadNpmTasks("grunt-merge-copy");
  grunt.loadNpmTasks("grunt-push-release");
  grunt.loadNpmTasks("grunt-contrib-clean");

  // Default task.

  // Setup tasks will clean the release directory, build the main
  // project then the lab project and merge the two into the release
  grunt.registerTask("deploy:setup", ["clean", "shell:build:main", "shell:build:lab",  "merge-copy:release"]);
  grunt.registerTask("deploy:setup", ["clean", "shell:build:main", "shell:build:lab",  "merge-copy:release"]);

  // Deploy tasks perform shell bumps for patch/minor/major versions,
  // then calls setup before pushing patch/minor/major versions and
  // then releasing the static page to AWS S3 bucket
  grunt.registerTask("deploy:major", ["shell:bump:main:major", "deploy:setup", "push:major", "aws_s3:release"]);
  grunt.registerTask("deploy:minor", ["shell:bump:main:minor", "deploy:setup", "push:minor", "aws_s3:release"]);
  grunt.registerTask("deploy:patch", ["shell:bump:main:patch", "deploy:setup", "push:patch", "aws_s3:release"]);
  grunt.registerTask("deploy", ["deploy:patch"]);

};
<|endoftext|>


<commit_before>'use strict';

/**
 * Livereload and connect variables
 */
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({
  port: LIVERELOAD_PORT
});
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

/**
 * Grunt module
 */
module.exports = function (grunt) {

  /**
   * Dynamically load npm tasks
   */
  require('load-grunt-tasks')(grunt);

  /**
   * Grunt config
   */
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    /**
     * Set project info
     */
    project: {
      src  : 'flexie',
      app  : 'demo',
      css  : '<%= project.app %>/css/flexie.css',
      scss : '<%= project.src %>/flexie-grid.scss'
    },

    /**
     * Project banner
     * Dynamically appended to CSS files
     * Inherits text from package.json
     */
    tag: {
      banner: '/**!\n' +
              ' * <%= pkg.name %>\n' +
              ' * <%= pkg.title %>\n' +
              ' * <%= pkg.url %>\n' +
              ' * @author <%= pkg.author %>\n' +
              ' * @version <%= pkg.version %>\n' +
              ' * Copyright <%= pkg.copyright %>. <%= pkg.license %> licensed.\n' +
              ' */\n'
    },

    /**
     * Connect port/livereload
     * https://github.com/gruntjs/grunt-contrib-connect
     * Starts a local webserver and injects
     * livereload snippet
     */
    connect: {
      options: {
        port: 9000,
        hostname: '*'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [lrSnippet, mountFolder(connect, 'demo')];
          }
        }
      }
    },

    /**
     * Compile Sass/SCSS files
     * https://github.com/gruntjs/grunt-contrib-sass
     * Compiles all Sass/SCSS files and appends project banner
     */
    sass: {
      dist: {
        options: {
          cacheLocation : '_tmp',
          sourcemap     : 'none',
          style         : 'expanded'
        },
        files: {
          '<%= project.css %>' : '<%= project.scss %>'
        }
      }
    },

    /**
     * Autoprefixer
     * Adds vendor prefixes automatically
     * https://github.com/nDmitry/grunt-autoprefixer
     */
    autoprefixer: {
      options: {
        browsers: [
          'last 2 version'
        ]
      },
      dist: {
        files: {
          '<%= project.css %>' : '<%= project.css %>'
        }
      }
    },

    /**
     * CSSMin
     * CSS minification
     * https://github.com/gruntjs/grunt-contrib-cssmin
     */
    cssmin: {
      combine: {
        options: {
          banner: '<%= tag.banner %>'
        },
        files: {
          '<%= project.css %>' : '<%= project.css %>'
        }
      }
    },

    /**
     * Opens the web server in the browser
     * https://github.com/jsoverson/grunt-open
     */
    open: {
      server: {
        path: 'http://localhost:<%= connect.options.port %>'
      }
    },

    /**
     * Runs tasks against changed watched files
     * https://github.com/gruntjs/grunt-contrib-watch
     * Watching development files and run concat/compile tasks
     * Livereload the browser once complete
     */
    watch: {
      sass: {
        files: '<%= project.src %>/{,*/}*.{scss,sass}',
        tasks: ['sass', 'autoprefixer']
      },
      livereload: {
        options: {
          livereload: LIVERELOAD_PORT
        },
        files: [
          '<%= project.app %>/{,*/}*.html',
          '<%= project.css %>'
        ]
      }
    }
  });

  /**
   * Default task
   * Run `grunt` on the command line
   */
  grunt.registerTask('default', [
    'sass',
    'autoprefixer',
    'cssmin',
    'connect:livereload',
    'open',
    'watch'
  ]);

};
<commit_msg>prefixed IE10 and 11<commit_after>'use strict';

/**
 * Livereload and connect variables
 */
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({
  port: LIVERELOAD_PORT
});
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

/**
 * Grunt module
 */
module.exports = function (grunt) {

  /**
   * Dynamically load npm tasks
   */
  require('load-grunt-tasks')(grunt);

  /**
   * Grunt config
   */
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    /**
     * Set project info
     */
    project: {
      src  : 'flexie',
      app  : 'demo',
      css  : '<%= project.app %>/css/flexie.css',
      scss : '<%= project.src %>/flexie-grid.scss'
    },

    /**
     * Project banner
     * Dynamically appended to CSS files
     * Inherits text from package.json
     */
    tag: {
      banner: '/**!\n' +
              ' * <%= pkg.name %>\n' +
              ' * <%= pkg.title %>\n' +
              ' * <%= pkg.url %>\n' +
              ' * @author <%= pkg.author %>\n' +
              ' * @version <%= pkg.version %>\n' +
              ' * Copyright <%= pkg.copyright %>. <%= pkg.license %> licensed.\n' +
              ' */\n'
    },

    /**
     * Connect port/livereload
     * https://github.com/gruntjs/grunt-contrib-connect
     * Starts a local webserver and injects
     * livereload snippet
     */
    connect: {
      options: {
        port: 9000,
        hostname: '*'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [lrSnippet, mountFolder(connect, 'demo')];
          }
        }
      }
    },

    /**
     * Compile Sass/SCSS files
     * https://github.com/gruntjs/grunt-contrib-sass
     * Compiles all Sass/SCSS files and appends project banner
     */
    sass: {
      dist: {
        options: {
          cacheLocation : '_tmp',
          sourcemap     : 'none',
          style         : 'expanded'
        },
        files: {
          '<%= project.css %>' : '<%= project.scss %>'
        }
      }
    },

    /**
     * Autoprefixer
     * Adds vendor prefixes automatically
     * https://github.com/nDmitry/grunt-autoprefixer
     */
    autoprefixer: {
      options: {
        browsers: [
          'last 2 version',
          'ie 10',
          'ie 11'
        ]
      },
      dist: {
        files: {
          '<%= project.css %>' : '<%= project.css %>'
        }
      }
    },

    /**
     * CSSMin
     * CSS minification
     * https://github.com/gruntjs/grunt-contrib-cssmin
     */
    cssmin: {
      combine: {
        options: {
          banner: '<%= tag.banner %>'
        },
        files: {
          '<%= project.css %>' : '<%= project.css %>'
        }
      }
    },

    /**
     * Opens the web server in the browser
     * https://github.com/jsoverson/grunt-open
     */
    open: {
      server: {
        path: 'http://localhost:<%= connect.options.port %>'
      }
    },

    /**
     * Runs tasks against changed watched files
     * https://github.com/gruntjs/grunt-contrib-watch
     * Watching development files and run concat/compile tasks
     * Livereload the browser once complete
     */
    watch: {
      sass: {
        files: '<%= project.src %>/{,*/}*.{scss,sass}',
        tasks: ['sass', 'autoprefixer']
      },
      livereload: {
        options: {
          livereload: LIVERELOAD_PORT
        },
        files: [
          '<%= project.app %>/{,*/}*.html',
          '<%= project.css %>'
        ]
      }
    }
  });

  /**
   * Default task
   * Run `grunt` on the command line
   */
  grunt.registerTask('default', [
    'sass',
    'autoprefixer',
    'cssmin',
    'connect:livereload',
    'open',
    'watch'
  ]);

};
<|endoftext|>


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

  // dependencies
  var path = require('path');

  // path definitions
  var pathdef = {
    'bootstrap':       'modules/bootstrap/dist',
    'fontawesome':     'lib/font-awesome',
    'headroom':        'lib/headroom.js',
    'jquery':          'lib/jquery',
    'photoswipe':      'lib/photoswipe',
    'scrollposstyler': 'lib/scrollpos-styler'
  };

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

    clean: {
      publish: [
        'publish/*',
        'css/*',
        'js/options.json',
        'js/headroom.js',
        'js/photoswipe*.js',
        'js/scrollPosStyler.js'
      ]
    },

    xsltproc: {
      options: {
        stylesheet: 'style/main.xsl',
        xinclude: true
      },
      publish: {
        files: {
          'publish/index.html': 'src/main.xml'
        }
      }
    },

    bower: {
      install: {
        options: {
          cleanTargetDir: true,
          cleanBowerDir: false,
          layout: 'byComponent'
        }
      }
    },

    copy: {
      publish: {
        files: [
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.bootstrap,
            src: '**/bootstrap*.min.css',
            dest: 'publish/css/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.bootstrap,
            src: '**/bootstrap.min.js',
            dest: 'publish/js/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.fontawesome,
            src: '**/font-awesome.min.css',
            dest: 'publish/css/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.headroom,
            src: '**/headroom.js',
            dest: 'js/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.jquery,
            src: '**/jquery.min.js',
            dest: 'publish/js/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.photoswipe,
            src: ['**/photoswipe.css', '**/default-skin.css'],
            dest: 'css/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.photoswipe,
            src: '**/photoswipe*.js',
            dest: 'js/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.scrollposstyler,
            src: '**/scrollPosStyler.js',
            dest: 'js/'
          }
        ]
      }
    },

    concat: {
      publish: {
        files: [
          {
            src: ['js/options.json', 'js/headroom.js', 'js/navbar.js', 'js/scrollPosStyler.js'],
            dest: 'publish/js/script.js'
          },
          {
            src: ['css/*.css'],
            dest: 'publish/css/gallery.css'
          },
          {
            src: ['js/photoswipe*.js'],
            dest: 'publish/js/gallery.js'
          }
        ]
      }
    },

    uglify: {
      publish: {
        files: {
          'publish/js/script.js': 'publish/js/script.js',
          'publish/js/gallery.js': 'publish/js/gallery.js'
        }
      }
    },

    sass: {
      publish: {
        options: {
          style: 'nested'
        },
        files: {
          'publish/css/style.css': 'sass/style.scss'
        }
      }
    },

    autoprefixer: {
//      options: {
//        'browsers': '> 1%, last 2 versions'
//      },
      publish: {
        files: {
          'publish/css/style.css': 'publish/css/style.css',
          'publish/css/gallery.css': 'publish/css/gallery.css'
        }
      }
    },

    csslint: {
      options: {
        'adjoining-classes': false,
        'compatible-vendor-prefixes': false
      },
      publish: {
        src: ['publish/css/style.css']
      }
    },

    cssmin: {
      publish: {
        files: {
          'publish/css/style.css': 'publish/css/style.css',
          'publish/css/gallery.css': 'publish/css/gallery.css'
        }
      }
    },

    htmlmin: {
      publish: {
        options: {
          removeComments: true,
          collapseWhitespace: true
        },
        expand: true,
        nonull: true,
        src: 'publish/**/*.html'
      }
    },

    prettify: {
      publish: {
        expand: true,
        nonull: true,
        src: 'publish/**/*.html'
      }
    },

    connect: {
      server: {
        options: {
          port: 8000,
          base: 'publish',
          keepalive: true,
          //open: 'http://localhost:8000/',
        }
      }
    }
  });

  // load the plugin(s)
  require('load-grunt-tasks')(grunt);

  // copy sample files
  grunt.registerTask('copy_samples', function() {
    // recurse samples directory
    grunt.file.recurse('src/sample', function(abspath, rootdir, subdir, filename) {
      var destfile = path.join('src', filename);

      // check if destination file exists
      if (! grunt.file.exists(destfile)) {
        grunt.log.writeln('Copying sample: ' + filename);

        // copy sample to destination
        grunt.file.copy(abspath, destfile);
      }
    });
  });

  // default task including everything
  grunt.registerTask('default', [
    'clean',
    'bower',
    'copy',
    'copy_samples',
    'xsltproc',
    'concat',
    'uglify',
    'sass',
    'autoprefixer',
    'csslint',
    'cssmin',
    'htmlmin',
    'connect']);

  // everything except minification
  grunt.registerTask('debug', [
    'clean',
    'bower',
    'copy',
    'copy_samples',
    'xsltproc',
    'concat',
    'sass',
    'autoprefixer',
    'csslint',
    'prettify',
    'connect']);
};
<commit_msg>Added TODOs<commit_after>module.exports = function(grunt) {
  "use strict";

  //TODO:
  //  - htmllint task
  //  - scsslint task
  //  - postcss autoprefixer insead of autoprefixer?

  // dependencies
  var path = require('path');

  // path definitions
  var pathdef = {
    'bootstrap':       'modules/bootstrap/dist',
    'fontawesome':     'lib/font-awesome',
    'headroom':        'lib/headroom.js',
    'jquery':          'lib/jquery',
    'photoswipe':      'lib/photoswipe',
    'scrollposstyler': 'lib/scrollpos-styler'
  };

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

    clean: {
      publish: [
        'publish/*',
        'css/*',
        'js/options.json',
        'js/headroom.js',
        'js/photoswipe*.js',
        'js/scrollPosStyler.js'
      ]
    },

    xsltproc: {
      options: {
        stylesheet: 'style/main.xsl',
        xinclude: true
      },
      publish: {
        files: {
          'publish/index.html': 'src/main.xml'
        }
      }
    },

    bower: {
      install: {
        options: {
          cleanTargetDir: true,
          cleanBowerDir: false,
          layout: 'byComponent'
        }
      }
    },

    copy: {
      publish: {
        files: [
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.bootstrap,
            src: '**/bootstrap*.min.css',
            dest: 'publish/css/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.bootstrap,
            src: '**/bootstrap.min.js',
            dest: 'publish/js/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.fontawesome,
            src: '**/font-awesome.min.css',
            dest: 'publish/css/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.headroom,
            src: '**/headroom.js',
            dest: 'js/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.jquery,
            src: '**/jquery.min.js',
            dest: 'publish/js/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.photoswipe,
            src: ['**/photoswipe.css', '**/default-skin.css'],
            dest: 'css/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.photoswipe,
            src: '**/photoswipe*.js',
            dest: 'js/'
          },
          {
            expand: true,
            flatten: true,
            nonull: true,
            cwd: pathdef.scrollposstyler,
            src: '**/scrollPosStyler.js',
            dest: 'js/'
          }
        ]
      }
    },

    concat: {
      publish: {
        files: [
          {
            src: ['js/options.json', 'js/headroom.js', 'js/navbar.js', 'js/scrollPosStyler.js'],
            dest: 'publish/js/script.js'
          },
          {
            src: ['css/*.css'],
            dest: 'publish/css/gallery.css'
          },
          {
            src: ['js/photoswipe*.js'],
            dest: 'publish/js/gallery.js'
          }
        ]
      }
    },

    uglify: {
      publish: {
        files: {
          'publish/js/script.js': 'publish/js/script.js',
          'publish/js/gallery.js': 'publish/js/gallery.js'
        }
      }
    },

    sass: {
      publish: {
        options: {
          style: 'nested'
        },
        files: {
          'publish/css/style.css': 'sass/style.scss'
        }
      }
    },

    autoprefixer: {
//      options: {
//        'browsers': '> 1%, last 2 versions'
//      },
      publish: {
        files: {
          'publish/css/style.css': 'publish/css/style.css',
          'publish/css/gallery.css': 'publish/css/gallery.css'
        }
      }
    },

    csslint: {
      options: {
        'adjoining-classes': false,
        'compatible-vendor-prefixes': false
      },
      publish: {
        src: ['publish/css/style.css']
      }
    },

    cssmin: {
      publish: {
        files: {
          'publish/css/style.css': 'publish/css/style.css',
          'publish/css/gallery.css': 'publish/css/gallery.css'
        }
      }
    },

    htmlmin: {
      publish: {
        options: {
          removeComments: true,
          collapseWhitespace: true
        },
        expand: true,
        nonull: true,
        src: 'publish/**/*.html'
      }
    },

    prettify: {
      publish: {
        expand: true,
        nonull: true,
        src: 'publish/**/*.html'
      }
    },

    connect: {
      server: {
        options: {
          port: 8000,
          base: 'publish',
          keepalive: true,
          //open: 'http://localhost:8000/',
        }
      }
    }
  });

  // load the plugin(s)
  require('load-grunt-tasks')(grunt);

  // copy sample files
  grunt.registerTask('copy_samples', function() {
    // recurse samples directory
    grunt.file.recurse('src/sample', function(abspath, rootdir, subdir, filename) {
      var destfile = path.join('src', filename);

      // check if destination file exists
      if (! grunt.file.exists(destfile)) {
        grunt.log.writeln('Copying sample: ' + filename);

        // copy sample to destination
        grunt.file.copy(abspath, destfile);
      }
    });
  });

  // default task including everything
  grunt.registerTask('default', [
    'clean',
    'bower',
    'copy',
    'copy_samples',
    'xsltproc',
    'concat',
    'uglify',
    'sass',
    'autoprefixer',
    'csslint',
    'cssmin',
    'htmlmin',
    'connect']);

  // everything except minification
  grunt.registerTask('debug', [
    'clean',
    'bower',
    'copy',
    'copy_samples',
    'xsltproc',
    'concat',
    'sass',
    'autoprefixer',
    'csslint',
    'prettify',
    'connect']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        'groc': {
            javascript: ["*.js","*.md"],
            options: {
                "out": "docs-dist/",
                "except":["Gruntfile.js","dashboard/static","node_modules", "node_modules/**","dashboard/static/**"]
            },
        },
        'gh-pages': {
            options: {
                base: 'docs-dist'
            },
            src: ['**']
        },
        'open' : {
            'file' : {
                path : 'docs-dist/index.html'
            }
        },
        'availabletasks' : {
            'tasks' : {
                options: {
                    showTasks: ['user'],
                    filter: 'exclude',
                    tasks: ['availabletasks', 'default']
                }
            }
        },
        'mochaTest' : {
            test:{
                src: ["test/*.js"]
            }
        },
        'apidoc' : {
            myapp: {
                src: "routes",
                dest: "docs-dist/api",
                debug: true
            }
        }
    });
    grunt.loadNpmTasks('grunt-groc');
    grunt.loadNpmTasks('grunt-gh-pages');
    grunt.loadNpmTasks('grunt-open');
    grunt.loadNpmTasks('grunt-available-tasks');
    grunt.loadNpmTasks('grunt-apidoc');

    grunt.registerTask('doc', 'Generate engine documentation in HTML format.', ['groc', 'apidoc']);
    grunt.registerTask('doc-dist', 'Generate documentation and publish to github-pages.', ['groc', 'apidoc', 'gh-pages']);
    grunt.registerTask('doc-view', 'Generate documentation and view locally in web browser.', ['groc', 'apidoc', 'open']);
    grunt.registerTask('default', 'availabletasks');
};
<commit_msg>Update excludes in grunt-groc task<commit_after>module.exports = function(grunt) {
grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        'groc': {
            javascript: ["*.js","*.md","**/*.js","**/*.md"],
            options: {
                "out": "docs-dist/",
                "except":[
                    "Gruntfile.js",
                    "dashboard/apps",
                    "dashboard/apps/**",
                    "dashboard/build",
                    "dashboard/build/**",
                    "node_modules",
                    "node_modules/**",
                    "dashboard/static",
                    "dashboard/static/**",
                    "docs-dist",
                    "docs-dist/**"
                ]
            },
        },
        'gh-pages': {
            options: {
                base: 'docs-dist'
            },
            src: ['**']
        },
        'open' : {
            'file' : {
                path : 'docs-dist/index.html'
            }
        },
        'availabletasks' : {
            'tasks' : {
                options: {
                    showTasks: ['user'],
                    filter: 'exclude',
                    tasks: ['availabletasks', 'default']
                }
            }
        },
        'mochaTest' : {
            test:{
                src: ["test/*.js"]
            }
        },
        'apidoc' : {
            myapp: {
                src: "routes",
                dest: "docs-dist/api",
                debug: true
            }
        }
    });
    grunt.loadNpmTasks('grunt-groc');
    grunt.loadNpmTasks('grunt-gh-pages');
    grunt.loadNpmTasks('grunt-open');
    grunt.loadNpmTasks('grunt-available-tasks');
    grunt.loadNpmTasks('grunt-apidoc');

    grunt.registerTask('doc', 'Generate engine documentation in HTML format.', ['groc', 'apidoc']);
    grunt.registerTask('doc-dist', 'Generate documentation and publish to github-pages.', ['groc', 'apidoc', 'gh-pages']);
    grunt.registerTask('doc-view', 'Generate documentation and view locally in web browser.', ['groc', 'apidoc', 'open']);
    grunt.registerTask('default', 'availabletasks');
};
<|endoftext|>