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

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %>#<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */'
            },
            build: {
                files: {
                    'framework.min.js': [
                        'src/functions.js',
                        'src/Lib/Generator/Interface.js',
                        'src/Lib/Generator/UUID.js',
                        'src/Lib/Logger/Handler/Interface.js',
                        'src/Lib/Logger/Handler/Console.js',
                        'src/Lib/Logger/Interface.js',
                        'src/Lib/Logger/CoreLogger.js',
                        'src/Lib/Mediator.js',
                        'src/HTTP/RequestInterface.js',
                        'src/HTTP/Request.js',
                        'src/HTTP/HTMLRequest.js',
                        'src/HTTP/JSONRequest.js',
                        'src/HTTP/ResponseInterface.js',
                        'src/HTTP/Response.js',
                        'src/HTTP/HTMLResponse.js',
                        'src/HTTP/JSONResponse.js',
                        'src/HTTP/HeaderParser.js',
                        'src/HTTP/Manager.js',
                        'src/HTTP/REST.js',
                        'src/Storage/Core.js',
                        'src/Storage/EngineInterface.js',
                        'src/Storage/EngineFactory.js',
                        'src/Storage/Engine/IndexedDB.js',
                        'src/Storage/Engine/Localstorage.js',
                        'src/Storage/Engine/Rest.js',
                        'src/Storage/Manager.js',
                        'src/Storage/ManagerFactory.js',
                        'src/Storage/RepositoryInterface.js',
                        'src/Storage/Repository.js',
                        'src/Storage/RepositoryFactory.js',
                        'src/ConfiguratorInterface.js',
                        'src/Configurator.js',
                        'src/ControllerInterface.js',
                        'src/Controller.js',
                        'src/EntityInterface.js',
                        'src/Entity.js',
                        'src/FactoryInterface.js',
                        'src/QueueInterface.js',
                        'src/Queue.js',
                        'src/RegistryInterface.js',
                        'src/Registry.js',
                        'src/ServiceContainerInterface.js',
                        'src/ServiceContainer.js',
                        'bootstrap.js'
                    ]
                }
            }
        },
        'bower-install': {
            target: {
                html: 'index.html',
                jsPattern: '<script src="{{filePath}}"></script>'
            }
        },
        exec: {
            test: {
                cmd: function (pkg) {
                    var path;

                    switch (pkg) {
                        case 'lib':
                            path = 'lib/';
                            break;
                        case 'storage':
                            path = 'storage/';
                            break;
                        case 'view':
                            path = 'view/';
                            break;
                        case 'kernel':
                            path = 'kernel';
                            break;
                        case 'topLevel':
                            path = [
                                'entity.js',
                                'functions.js',
                                'queue.js',
                                'queuefactory.js',
                                'registry.js',
                                'registryfactory.js',
                                'queuefactory.js',
                                'servicecontainer.js',
                                'translator.js',
                            ].join(',tests/');
                            break;
                    }

                    return './node_modules/venus/bin/venus run -t tests/' + path + ' -c -n --singleton';
                }
            }
        },
        watch: {
            js: {
                files: ['src/*.js'],
                tasks: [],
                options: {
                    livereload: true
                }
            }
        },
        jscs: {
            src: 'src/**/*.js',
            options: {
                requireCurlyBraces: [
                    'if',
                    'else',
                    'for',
                    'do',
                    'while',
                    'try',
                    'catch',
                ],
                requireSpaceAfterKeywords: [
                    'if',
                    'else',
                    'for',
                    'do',
                    'while',
                    'switch',
                    'try',
                    'catch'
                ],
                requireParenthesesAroundIIFE: true,
                requireSpacesInFunctionExpression: {
                    beforeOpeningRoundBrace: true,
                    beforeOpeningCurlyBrace: true
                },
                disallowSpacesInsideObjectBrackets: true,
                disallowSpacesInsideArrayBrackets: true,
                disallowSpacesInsideParentheses: true,
                disallowQuotedKeysInObjects: true,
                disallowSpaceAfterObjectKeys: true,
                requireCommaBeforeLineBreak: true,
                requireOperatorBeforeLineBreak: [
                    '?',
                    '+',
                    '-',
                    '/',
                    '*',
                    '=',
                    '==',
                    '===',
                    '!=',
                    '!==',
                    '>',
                    '>=',
                    '<',
                    '<='
                ],
                disallowLeftStickedOperators: [
                    '?',
                    '+',
                    '-',
                    '/',
                    '*',
                    '=',
                    '==',
                    '===',
                    '!=',
                    '!==',
                    '>',
                    '>=',
                    '<',
                    '<='
                ],
                requireRightStickedOperators: ['!'],
                disallowRightStickedOperators: [
                    '?',
                    '+',
                    '/',
                    '*',
                    ':',
                    '=',
                    '==',
                    '===',
                    '!=',
                    '!==',
                    '>',
                    '>=',
                    '<',
                    '<='
                ],
                requireLeftStickedOperators: [','],
                disallowSpaceAfterPrefixUnaryOperators: [
                    '++',
                    '--',
                    '+',
                    '-',
                    '~',
                    '!'
                ],
                disallowSpaceBeforePostfixUnaryOperators: [
                    '++',
                    '--'
                ],
                requireSpaceBeforeBinaryOperators: [
                    '+',
                    '-',
                    '/',
                    '*',
                    '=',
                    '==',
                    '===',
                    '!=',
                    '!=='
                ],
                requireSpaceAfterBinaryOperators: [
                    '+',
                    '-',
                    '/',
                    '*',
                    '=',
                    '==',
                    '===',
                    '!=',
                    '!=='
                ],
                requireCamelCaseOrUpperCaseIdentifiers: true,
                disallowKeywords: ["with"],
                disallowMultipleLineBreaks: true,
                validateQuoteMarks: '\'',
                disallowMixedSpacesAndTabs: true,
                disallowTrailingWhitespace: true,
                disallowKeywordsOnNewLine: ['else'],
                requireDotNotation: true,
                validateJSDoc: {
                    checkParamNames: true,
                    checkRedundantParams: true,
                    requireParamTypes: true
                }
            }
        }
    });

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

    grunt.registerTask('default', ['bower-install']);
    grunt.registerTask('test', [
        'jscs',
        'exec:test:lib',
        'exec:test:storage',
        'exec:test:view',
        'exec:test:topLevel'
    ]);

};
<commit_msg>added the build task to generate minified + concatenated versions of the framework<commit_after>module.exports = function (grunt) {

    var frameworkFiles = [
        'src/functions.js',
        /* interfaces first */
        'src/ConfiguratorInterface.js',
        'src/ControllerInterface.js',
        'src/EntityInterface.js',
        'src/FactoryInterface',
        'src/HTTP/RequestInterface.js',
        'src/HTTP/ResponseInterface.js',
        'src/Lib/Generator/Interface.js',
        'src/Lib/Logger/Handler/Interface.js',
        'src/Lib/Logger/Interface.js',
        'src/QueueInterface.js',
        'src/RegistryInterface.js',
        'src/ServiceContainerInterface.js',
        'src/Storage/RepositoryInterface.js',
        'src/Storage/EngineInterface.js',
        'src/Storage/StoreMapperInterface.js',
        'src/TemplateEngineInterface.js',
        'src/View/LayoutFactoryInterface.js',
        'src/View/ListFactoryInterface.js',
        'src/View/ViewScreenFactoryInterface.js',
        /* kernel */
        'src/Kernel/ActionBinder.js',
        'src/Kernel/AppParser.js',
        'src/Kernel/ControllerManager.js',
        'src/Kernel/Core.js',
        'src/Kernel/FeatureTester.js',
        /* libs */
        'src/Lib/Generator/UUID.js',
        'src/Lib/Logger/CoreLogger.js',
        'src/Lib/Logger/Handler/Console.js',
        'src/Lib/Mediator.js',
        /* http */
        'src/HTTP/JSONRequest.js',
        'src/HTTP/JSONResponse.js',
        'src/HTTP/HeaderParser.js',
        'src/HTTP/HTMLRequest.js',
        'src/HTTP/HTMLResponse.js',
        'src/HTTP/Manager.js',
        'src/HTTP/Request.js',
        'src/HTTP/Response.js',
        'src/HTTP/REST.js',
        /* storage */
        'src/Storage/Core.js',
        'src/Storage/Engine/IndexedDB.js',
        'src/Storage/Engine/Localstorage.js',
        'src/Storage/Engine/Rest.js',
        'src/Storage/EngineFactory/AbstractFactory.js',
        'src/Storage/EngineFactory/Core.js',
        'src/Storage/EngineFactory/IndexedDBFactory.js',
        'src/Storage/EngineFactory/LocalstorageFactory.js',
        'src/Storage/EngineFactory/RestFactory.js',
        'src/Storage/Manager.js',
        'src/Storage/ManagerFactory.js',
        'src/Storage/Repository.js',
        'src/Storage/RepositoryFactory.js',
        'src/Storage/StoreMapper/IndexedDBMapper.js',
        'src/Storage/StoreMapper/LocalstorageMapper.js',
        'src/Storage/StoreMapper/RestMapper.js',
        'src/Storage/UnitOfWork.js',
        'src/Storage/UnitOfWorkFactory.js',
        /* view */
        'src/View/Layout.js',
        'src/View/LayoutFactory.js',
        'src/View/List.js',
        'src/View/ListFactory.js',
        'src/View/Manager.js',
        'src/View/NodeWrapper.js',
        'src/View/Parser.js',
        'src/View/TemplateEngine.js',
        'src/View/ViewPort.js',
        'src/View/ViewScreen.js',
        'src/View/ViewScreenFactory.js',
        /* top objects */
        'src/Configurator.js',
        'src/Controller.js',
        'src/DOM.js',
        'src/Entity.js',
        'src/ParamProxy.js',
        'src/Queue.js',
        'src/QueueFactory.js',
        'src/Registry.js',
        'src/RegistryFactory.js',
        'src/ServiceContainer.js',
        'src/Translator.js',
        'bootstrap.js'
    ];

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %>#<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */'
            },
            build: {
                files: {
                    'dist/framework.min.js': frameworkFiles
                }
            },
            concat: {
                files: {
                    'dist/framework.js': frameworkFiles
                },
                options: {
                    mangle: false,
                    beautify: true
                }
            }
        },
        'bower-install': {
            target: {
                html: 'index.html',
                jsPattern: '<script src="{{filePath}}"></script>'
            }
        },
        exec: {
            test: {
                cmd: function (pkg) {
                    var path;

                    switch (pkg) {
                        case 'lib':
                            path = 'lib/';
                            break;
                        case 'storage':
                            path = 'storage/';
                            break;
                        case 'view':
                            path = 'view/';
                            break;
                        case 'kernel':
                            path = 'kernel';
                            break;
                        case 'topLevel':
                            path = [
                                'entity.js',
                                'functions.js',
                                'queue.js',
                                'queuefactory.js',
                                'registry.js',
                                'registryfactory.js',
                                'queuefactory.js',
                                'servicecontainer.js',
                                'translator.js',
                            ].join(',tests/');
                            break;
                    }

                    return './node_modules/venus/bin/venus run -t tests/' + path + ' -c -n --singleton';
                }
            }
        },
        watch: {
            js: {
                files: ['src/*.js'],
                tasks: [],
                options: {
                    livereload: true
                }
            }
        },
        jscs: {
            src: 'src/**/*.js',
            options: {
                requireCurlyBraces: [
                    'if',
                    'else',
                    'for',
                    'do',
                    'while',
                    'try',
                    'catch',
                ],
                requireSpaceAfterKeywords: [
                    'if',
                    'else',
                    'for',
                    'do',
                    'while',
                    'switch',
                    'try',
                    'catch'
                ],
                requireParenthesesAroundIIFE: true,
                requireSpacesInFunctionExpression: {
                    beforeOpeningRoundBrace: true,
                    beforeOpeningCurlyBrace: true
                },
                disallowSpacesInsideObjectBrackets: true,
                disallowSpacesInsideArrayBrackets: true,
                disallowSpacesInsideParentheses: true,
                disallowQuotedKeysInObjects: true,
                disallowSpaceAfterObjectKeys: true,
                requireCommaBeforeLineBreak: true,
                requireOperatorBeforeLineBreak: [
                    '?',
                    '+',
                    '-',
                    '/',
                    '*',
                    '=',
                    '==',
                    '===',
                    '!=',
                    '!==',
                    '>',
                    '>=',
                    '<',
                    '<='
                ],
                disallowLeftStickedOperators: [
                    '?',
                    '+',
                    '-',
                    '/',
                    '*',
                    '=',
                    '==',
                    '===',
                    '!=',
                    '!==',
                    '>',
                    '>=',
                    '<',
                    '<='
                ],
                requireRightStickedOperators: ['!'],
                disallowRightStickedOperators: [
                    '?',
                    '+',
                    '/',
                    '*',
                    ':',
                    '=',
                    '==',
                    '===',
                    '!=',
                    '!==',
                    '>',
                    '>=',
                    '<',
                    '<='
                ],
                requireLeftStickedOperators: [','],
                disallowSpaceAfterPrefixUnaryOperators: [
                    '++',
                    '--',
                    '+',
                    '-',
                    '~',
                    '!'
                ],
                disallowSpaceBeforePostfixUnaryOperators: [
                    '++',
                    '--'
                ],
                requireSpaceBeforeBinaryOperators: [
                    '+',
                    '-',
                    '/',
                    '*',
                    '=',
                    '==',
                    '===',
                    '!=',
                    '!=='
                ],
                requireSpaceAfterBinaryOperators: [
                    '+',
                    '-',
                    '/',
                    '*',
                    '=',
                    '==',
                    '===',
                    '!=',
                    '!=='
                ],
                requireCamelCaseOrUpperCaseIdentifiers: true,
                disallowKeywords: ["with"],
                disallowMultipleLineBreaks: true,
                validateQuoteMarks: '\'',
                disallowMixedSpacesAndTabs: true,
                disallowTrailingWhitespace: true,
                disallowKeywordsOnNewLine: ['else'],
                requireDotNotation: true,
                validateJSDoc: {
                    checkParamNames: true,
                    checkRedundantParams: true,
                    requireParamTypes: true
                }
            }
        }
    });

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

    grunt.registerTask('default', ['bower-install']);
    grunt.registerTask('build', ['jscs', 'uglify']);
    grunt.registerTask('test', [
        'jscs',
        'exec:test:lib',
        'exec:test:storage',
        'exec:test:view',
        'exec:test:topLevel'
    ]);

};
<|endoftext|>


<commit_before>// Generated on 2014-01-19 using generator-webapp-assetgraph 0.0.0
'use strict';

module.exports = function (grunt) {

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

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

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

        // Project settings
        yeoman: {
            // Configurable paths
            app: 'app',
            dist: 'dist',
            test: 'test'
        },

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

        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },

            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    src: '{,*/}*.css',
                    dest: '.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',
                '<%= yeoman.app %>/scripts/{,*/}*.js',
                '!<%= yeoman.app %>/scripts/vendor/*',
                '<%= yeoman.test %>/spec/{,*/}*.js'
            ]
        },

        reduce: {
            // Source folder
            root: '.tmp',

            // Build destination folder
            outRoot: '<%= yeoman.dist %>',

            // Root of your CDN. Optional
            //cdnRoot: 'https://my.amazon.s3.bucket',

            // minimatch patterns of files to include as base assets
            // Dependencies of these will be automatically populated
            // Paths are relative to reduce.root
            include: [
                '**/*.html',
                '**/.htaccess',
                '*.txt',
                '*.ico'
            ],

            // Compile less files and remove less.js from application
            less: true,

            // Run all available jpeg and png optimizations on images
            // For maximum efficiency install jpegtran, optipng, pngcrush and pngquant
            optimizeImages: true,

            // Create a cache manifest file
            // If one already exists it will be ammended with static assets
            manifest: false,

            // Set the 'async'-attribute on all script tags
            asyncScripts: true,

            // Pretty print assets. Good for debugging
            pretty: false, // Default: false

            // Inline CSS backgrounds below this byte threshold as data-uris
            // There will be an old IE fallback to the original image
            // 0 disables.
            inlineSize: 4096
        },
        connect: {
            options: {
                port: 9000,
                livereload: 35729,
                // Change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    open: true,
                    base: [
                        '.tmp',
                        '<%= yeoman.app %>'
                    ]
                }
            }
        },
        watch: {
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    '<%= yeoman.app %>/{,**/}*.{html,js,jsx}',
                    '.tmp/{,**/}*.{css}',
                ]
            },
            css: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    '<%= yeoman.app %>/{,**/}*.css',
                ],
                tasks: ['autoprefixer']
            }
        },
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '.tmp',
                    src: [
                        '{,**/}*'
                    ]
                }]
            }
        }
    });

    grunt.registerTask('build', [
        'clean:dist',
        'copy:dist',
        'autoprefixer',
        'reduce'
    ]);

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

    grunt.registerTask('serve', [
        'clean:dist',
        'autoprefixer',
        'connect:livereload',
        'watch'
    ]);
};
<commit_msg>Make grunt-reduce start assets more specific<commit_after>// Generated on 2014-01-19 using generator-webapp-assetgraph 0.0.0
'use strict';

module.exports = function (grunt) {

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

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

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

        // Project settings
        yeoman: {
            // Configurable paths
            app: 'app',
            dist: 'dist',
            test: 'test'
        },

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

        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },

            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    src: '{,*/}*.css',
                    dest: '.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',
                '<%= yeoman.app %>/scripts/{,*/}*.js',
                '!<%= yeoman.app %>/scripts/vendor/*',
                '<%= yeoman.test %>/spec/{,*/}*.js'
            ]
        },

        reduce: {
            // Source folder
            root: '.tmp',

            // Build destination folder
            outRoot: '<%= yeoman.dist %>',

            // Root of your CDN. Optional
            //cdnRoot: 'https://my.amazon.s3.bucket',

            // minimatch patterns of files to include as base assets
            // Dependencies of these will be automatically populated
            // Paths are relative to reduce.root
            include: [
                '*.html',
                '.htaccess',
                '*.txt',
                '*.ico'
            ],

            // Compile less files and remove less.js from application
            less: true,

            // Run all available jpeg and png optimizations on images
            // For maximum efficiency install jpegtran, optipng, pngcrush and pngquant
            optimizeImages: true,

            // Create a cache manifest file
            // If one already exists it will be ammended with static assets
            manifest: false,

            // Set the 'async'-attribute on all script tags
            asyncScripts: true,

            // Pretty print assets. Good for debugging
            pretty: false, // Default: false

            // Inline CSS backgrounds below this byte threshold as data-uris
            // There will be an old IE fallback to the original image
            // 0 disables.
            inlineSize: 4096
        },
        connect: {
            options: {
                port: 9000,
                livereload: 35729,
                // Change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    open: true,
                    base: [
                        '.tmp',
                        '<%= yeoman.app %>'
                    ]
                }
            }
        },
        watch: {
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    '<%= yeoman.app %>/{,**/}*.{html,js,jsx}',
                    '.tmp/{,**/}*.{css}',
                ]
            },
            css: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    '<%= yeoman.app %>/{,**/}*.css',
                ],
                tasks: ['autoprefixer']
            }
        },
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '.tmp',
                    src: [
                        '{,**/}*'
                    ]
                }]
            }
        }
    });

    grunt.registerTask('build', [
        'clean:dist',
        'copy:dist',
        'autoprefixer',
        'reduce'
    ]);

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

    grunt.registerTask('serve', [
        'clean:dist',
        'autoprefixer',
        'connect:livereload',
        'watch'
    ]);
};
<|endoftext|>


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

    require('jit-grunt')(grunt);require('jit-grunt')(grunt);

    grunt.initConfig({

        watch: {
            js: {
                files: ['src/**/*.js', 'src/**/*.json'],
                tasks: ['build']
            }
        },

        clean: {
            options: {
                force: true
            },
            all: {
                files: [{
                    dot: true,
                    src: [
                        'dist/*'
                    ]
                }]
            }
        },

        browserify: {
            options: {
                browserifyOptions: {
                    debug: true
                },
                debug: true,
                transform: ['debowerify']
            },
            dev : {

                files : {
                    'dist/venations.js' : ['src/**/*.js']
                }
            }
        },

        concat: {
            dev: {
                files: {
                    'dist/vendor.js': [
                        'vendor/paper/dist/paper-full.min.js',
                        'vendor/underscore/underscore-min.js'
                    ]
                }
            }
        }
    });

    grunt.registerTask('build', ['clean:all', 'browserify:dev', 'concat']);
    grunt.registerTask('default', ['build']);
}
<commit_msg>Gruntfile minor fix<commit_after>module.exports = function(grunt) {

    require('jit-grunt')(grunt);

    grunt.initConfig({

        watch: {
            js: {
                files: ['src/**/*.js', 'src/**/*.json'],
                tasks: ['build']
            }
        },

        clean: {
            options: {
                force: true
            },
            all: {
                files: [{
                    dot: true,
                    src: [
                        'dist/*'
                    ]
                }]
            }
        },

        browserify: {
            options: {
                browserifyOptions: {
                    debug: true
                },
                debug: true,
                transform: ['debowerify']
            },
            dev : {

                files : {
                    'dist/venations.js' : ['src/**/*.js']
                }
            }
        },

        concat: {
            dev: {
                files: {
                    'dist/vendor.js': [
                        'vendor/paper/dist/paper-full.min.js',
                        'vendor/underscore/underscore-min.js'
                    ]
                }
            }
        }
    });

    grunt.registerTask('build', ['clean:all', 'browserify:dev', 'concat']);
    grunt.registerTask('default', ['build']);
}
<|endoftext|>


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

	// Project configuration.
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		clean: {
			options: { force: true },
			files: ['./public/patterns']
		},
		concat: {
			options: {
				stripBanners: true,
				banner: '/* \n * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> \n * \n * <%= pkg.author %>, and the web community.\n * Licensed under the <%= pkg.license %> license. \n * \n * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. \n *\n */\n\n',
			},
			dist: {
				src: './builder/patternlab.js',
				dest: './builder/patternlab.js'
			}
		},
		copy: {
			main: {
				files: [
					{ expand: true, cwd: './source/js/', src: '*', dest: './public/js/'},
					{ expand: true, cwd: './source/css/', src: 'style.css', dest: './public/css/' },
					{ expand: true, cwd: './source/images/', src: ['*.png', '*.jpg', '*.gif', '*.jpeg'], dest: './public/images/' },
					{ expand: true, cwd: './source/images/sample/', src: ['*.png', '*.jpg', '*.gif', '*.jpeg'], dest: './public/images/sample/'},
					{ expand: true, cwd: './source/fonts/', src: '*', dest: './public/fonts/'},
					{ expand: true, cwd: './source/_data/', src: 'annotations.js', dest: './public/data/' }
				]
			}
		},
		jshint: {
			options: {
				"curly": true,
				"eqnull": true,
				"eqeqeq": true,
				"undef": true,
				"forin": true,
				//"unused": true,
				"node": true
			},
			patternlab: ['Gruntfile.js', './builder/lib/patternlab.js']
		},
		watch: {
			// scss: { //scss can be watched if you like
			// 	files: ['source/css/**/*.scss', 'public/styleguide/css/*.scss'],
			// 	tasks: ['default']
			// },
			mustache: {
				files: ['source/_patterns/**/*.mustache'],
				tasks: ['default']
			},
			data: {
				files: ['source/_patterns/**/*.json', 'source/_data/*.json'],
				tasks: ['default']
			}
		},
		sass: {
			build: {
				options: {
					style: 'expanded',
					precision: 8
				},
				files: {
					'./source/css/style.css': './source/css/style.scss',
					'./public/styleguide/css/static.css': './public/styleguide/css/static.scss',
					'./public/styleguide/css/styleguide.css': './public/styleguide/css/styleguide.scss'
				}
			}
		},
		qunit: {
			all:{
				options:{
					urls: ['./test/tests.html']
				}
			}
		}
	});

	// load all grunt tasks
 	require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

	//load the patternlab task
	grunt.task.loadTasks('./builder/');

	//if you choose to use scss, or any preprocessor, you can add it here
	grunt.registerTask('default', ['clean', 'concat', 'patternlab', /*'sass',*/ 'copy']);

	//travis CI task
	grunt.registerTask('travis', ['clean', 'concat', 'patternlab', /*'sass',*/ 'copy', 'qunit'])
};<commit_msg>set grunt to watch for .scss files<commit_after>module.exports = function(grunt) {

	// Project configuration.
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		clean: {
			options: { force: true },
			files: ['./public/patterns']
		},
		concat: {
			options: {
				stripBanners: true,
				banner: '/* \n * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> \n * \n * <%= pkg.author %>, and the web community.\n * Licensed under the <%= pkg.license %> license. \n * \n * Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice. \n *\n */\n\n',
			},
			dist: {
				src: './builder/patternlab.js',
				dest: './builder/patternlab.js'
			}
		},
		copy: {
			main: {
				files: [
					{ expand: true, cwd: './source/js/', src: '*', dest: './public/js/'},
					{ expand: true, cwd: './source/css/', src: 'style.css', dest: './public/css/' },
					{ expand: true, cwd: './source/images/', src: ['*.png', '*.jpg', '*.gif', '*.jpeg'], dest: './public/images/' },
					{ expand: true, cwd: './source/images/sample/', src: ['*.png', '*.jpg', '*.gif', '*.jpeg'], dest: './public/images/sample/'},
					{ expand: true, cwd: './source/fonts/', src: '*', dest: './public/fonts/'},
					{ expand: true, cwd: './source/_data/', src: 'annotations.js', dest: './public/data/' }
				]
			}
		},
		jshint: {
			options: {
				"curly": true,
				"eqnull": true,
				"eqeqeq": true,
				"undef": true,
				"forin": true,
				//"unused": true,
				"node": true
			},
			patternlab: ['Gruntfile.js', './builder/lib/patternlab.js']
		},
		watch: {
			scss: { //scss can be watched if you like
				files: ['source/css/**/*.scss', 'public/styleguide/css/*.scss'],
				tasks: ['default']
			},
			mustache: {
				files: ['source/_patterns/**/*.mustache'],
				tasks: ['default']
			},
			data: {
				files: ['source/_patterns/**/*.json', 'source/_data/*.json'],
				tasks: ['default']
			}
		},
		sass: {
			build: {
				options: {
					style: 'expanded',
					precision: 8
				},
				files: {
					'./source/css/style.css': './source/css/style.scss',
					'./public/styleguide/css/static.css': './public/styleguide/css/static.scss',
					'./public/styleguide/css/styleguide.css': './public/styleguide/css/styleguide.scss'
				}
			}
		},
		qunit: {
			all:{
				options:{
					urls: ['./test/tests.html']
				}
			}
		}
	});

	// load all grunt tasks
 	require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

	//load the patternlab task
	grunt.task.loadTasks('./builder/');

	//if you choose to use scss, or any preprocessor, you can add it here
	grunt.registerTask('default', ['clean', 'concat', 'patternlab', /*'sass',*/ 'copy']);

	//travis CI task
	grunt.registerTask('travis', ['clean', 'concat', 'patternlab', /*'sass',*/ 'copy', 'qunit'])
};<|endoftext|>


<commit_before>/*global module,require*/
var lrSnippet = require('connect-livereload')({
  port: 35731
});
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

module.exports = function (grunt) {
  // load all grunt tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  // configurable paths
  var projectConfig = {
    dist: 'dist',
    src: ''
  };

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

  grunt.initConfig({
    clean: {
      build: '<%= config.dist %>'
    },
    config: projectConfig,
    connect: {
      server: {
        options: {
          hostname: '0.0.0.0',
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, projectConfig.src),
              mountFolder(connect, projectConfig.src + 'source/_site')
            ];
          },
          port: 9002
        }
      }
    },
    run: {
      options: {
      },
      submodulesUpdate: {
        cmd: 'git',
        args: [
          'submodule',
          'update',
          '--init',
          '--remote'
        ]
      }
    },
    copy: {
      prebuild: {
        files: [
          // Copy resources from git submodules
          {
            expand: true,
            cwd: 'submodules/patternfly-core/tests/pages/_includes/widgets',
            src: ['**'],
            dest: 'source/_includes/widgets'
          },
          {
            expand: true,
            cwd: 'submodules/patternfly-design/pattern-library',
            src: ['**/design/**', '!**/documents/**'],
            dest: 'source/_includes/patterns',
            rename: function(dest, src) {
              return dest + '/' + src.replace('/design', '');
            }
          },
          {
            expand: true,
            cwd: 'submodules/angular-patternfly/dist/docs/partials',
            src: ['**'],
            dest: 'source/_includes/angular-partials'
          }
        ]
      },
      postbuild: {
        files: [
          {
            expand: true,
            cwd: 'submodules/patternfly-design/pattern-library',
            src: ['**/design/**', '!**/documents/**', '!**/*.md'],
            dest: 'source/_site/pattern-library',
            rename: function(dest, src) {
              return dest + '/' + src.replace('/design', '');
            }
          }
        ]
      }
    },
    csscount: {
      source: {
        src: [
          'source/assets/css/patternfly*.min.css'
        ],
        options: {
          maxSelectors: 4096
        }
      }
    },
    cssmin: {
      source: {
        files: [{
          expand: true,
          cwd: 'source/assets/css',
          src: ['patternfly*.css', '!*.min.css'],
          dest: 'source/assets/css',
          ext: '.min.css',
        }],
        options: {
          sourceMap: true
        }
      }
    },
    jekyll: {
      source: {
        options: {
          config: 'source/_config.yml',
          dest: 'source/_site',
          src: 'source'
        }
      }
    },
    less: {
      patternflySite: {
        files: {
          'source/assets/css/patternfly-site.css': 'source/_less/patternfly-site.less'
        },
        options: {
          paths: [
            'less/',
            'node_modules/'
          ],
          sourceMap: true,
          outputSourceFiles: true,
          sourceMapFilename: 'source/assets/css/patternfly-site.css.map',
          sourceMapURL: 'patternfly-site.css.map'
        }
      },
      patternflySiteAdjusted: {
        files: {
          'source/assets/css/patternfly-adjusted.css': 'source/_less/patternfly-adjusted.less'
        },
        options: {
          paths: [
            'less/',
            'node_modules/'
          ],
          sourceMap: true,
          outputSourceFiles: true,
          sourceMapFilename: 'source/assets/css/patternfly-adjusted.css.map',
          sourceMapURL: 'patternfly-adjusted.css.map'
        }
      }
    },
    uglify: {
      options: {
        mangle: false
      },
      production: {
        files: {
          'source/assets/js/patternfly-site.min.js': ['source/assets/js/patternfly-site.js']
        }
      }
    },
    watch: {
      less: {
        files: ['source/_less/*.less'],
        tasks: ['less']
      },
      css: {
        files: ['source/assets/css/*.css', '!source/assets/css/*.min.css'],
        tasks: ['cssmin'/* , 'csscount' */]
      },
      js: {
        files: ['source/assets/js/*.js', '!source/assets/js/*.min.js'],
        tasks: ['uglify']
      },
      jekyll: {
        files: ['source/**/*', '!source/_less/*', '!source/_site/**/*', '!source/assets/css/*.css',],
        tasks: ['jekyll']
      },
      livereload: {
        files: ['source/_site/**/*.html', '!source/_site/bower_components/**/*.html', '!source/_site/components/**/*.html', 'source/_site/assets/css/*.css', 'source/_site/assets/js/*.js']
      },
      options: {
        livereload: 35731
      }
    }
  });

  grunt.registerTask('jenkins', [
    'less',
    'cssmin',
    'uglify'
  ]);

  grunt.registerTask('prebuild', [
    'run:submodulesUpdate',
    'copy:prebuild'
  ])

  grunt.registerTask('build', [
    'prebuild',
    'less',
    'cssmin',
    //'csscount',
    'uglify',
    'jekyll',
    'copy:postbuild'
  ]);

  grunt.registerTask('server', [
    'build',
    'connect:server',
    'watch'
  ]);

  grunt.registerTask('default', ['build']);
};
<commit_msg>Added a grunt jekyll option to use the 'bundle exec' prefix when running jekyll<commit_after>/*global module,require*/
var lrSnippet = require('connect-livereload')({
  port: 35731
});
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

module.exports = function (grunt) {
  // load all grunt tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  // configurable paths
  var projectConfig = {
    dist: 'dist',
    src: ''
  };

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

  grunt.initConfig({
    clean: {
      build: '<%= config.dist %>'
    },
    config: projectConfig,
    connect: {
      server: {
        options: {
          hostname: '0.0.0.0',
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, projectConfig.src),
              mountFolder(connect, projectConfig.src + 'source/_site')
            ];
          },
          port: 9002
        }
      }
    },
    run: {
      options: {
      },
      submodulesUpdate: {
        cmd: 'git',
        args: [
          'submodule',
          'update',
          '--init',
          '--remote'
        ]
      }
    },
    copy: {
      prebuild: {
        files: [
          // Copy resources from git submodules
          {
            expand: true,
            cwd: 'submodules/patternfly-core/tests/pages/_includes/widgets',
            src: ['**'],
            dest: 'source/_includes/widgets'
          },
          {
            expand: true,
            cwd: 'submodules/patternfly-design/pattern-library',
            src: ['**/design/**', '!**/documents/**'],
            dest: 'source/_includes/patterns',
            rename: function(dest, src) {
              return dest + '/' + src.replace('/design', '');
            }
          },
          {
            expand: true,
            cwd: 'submodules/angular-patternfly/dist/docs/partials',
            src: ['**'],
            dest: 'source/_includes/angular-partials'
          }
        ]
      },
      postbuild: {
        files: [
          {
            expand: true,
            cwd: 'submodules/patternfly-design/pattern-library',
            src: ['**/design/**', '!**/documents/**', '!**/*.md'],
            dest: 'source/_site/pattern-library',
            rename: function(dest, src) {
              return dest + '/' + src.replace('/design', '');
            }
          }
        ]
      }
    },
    csscount: {
      source: {
        src: [
          'source/assets/css/patternfly*.min.css'
        ],
        options: {
          maxSelectors: 4096
        }
      }
    },
    cssmin: {
      source: {
        files: [{
          expand: true,
          cwd: 'source/assets/css',
          src: ['patternfly*.css', '!*.min.css'],
          dest: 'source/assets/css',
          ext: '.min.css',
        }],
        options: {
          sourceMap: true
        }
      }
    },
    jekyll: {
      source: {
        options: {
          config: 'source/_config.yml',
          dest: 'source/_site',
          src: 'source',
          bundleExec: 'true'
        }
      }
    },
    less: {
      patternflySite: {
        files: {
          'source/assets/css/patternfly-site.css': 'source/_less/patternfly-site.less'
        },
        options: {
          paths: [
            'less/',
            'node_modules/'
          ],
          sourceMap: true,
          outputSourceFiles: true,
          sourceMapFilename: 'source/assets/css/patternfly-site.css.map',
          sourceMapURL: 'patternfly-site.css.map'
        }
      },
      patternflySiteAdjusted: {
        files: {
          'source/assets/css/patternfly-adjusted.css': 'source/_less/patternfly-adjusted.less'
        },
        options: {
          paths: [
            'less/',
            'node_modules/'
          ],
          sourceMap: true,
          outputSourceFiles: true,
          sourceMapFilename: 'source/assets/css/patternfly-adjusted.css.map',
          sourceMapURL: 'patternfly-adjusted.css.map'
        }
      }
    },
    uglify: {
      options: {
        mangle: false
      },
      production: {
        files: {
          'source/assets/js/patternfly-site.min.js': ['source/assets/js/patternfly-site.js']
        }
      }
    },
    watch: {
      less: {
        files: ['source/_less/*.less'],
        tasks: ['less']
      },
      css: {
        files: ['source/assets/css/*.css', '!source/assets/css/*.min.css'],
        tasks: ['cssmin'/* , 'csscount' */]
      },
      js: {
        files: ['source/assets/js/*.js', '!source/assets/js/*.min.js'],
        tasks: ['uglify']
      },
      jekyll: {
        files: ['source/**/*', '!source/_less/*', '!source/_site/**/*', '!source/assets/css/*.css',],
        tasks: ['jekyll']
      },
      livereload: {
        files: ['source/_site/**/*.html', '!source/_site/bower_components/**/*.html', '!source/_site/components/**/*.html', 'source/_site/assets/css/*.css', 'source/_site/assets/js/*.js']
      },
      options: {
        livereload: 35731
      }
    }
  });

  grunt.registerTask('jenkins', [
    'less',
    'cssmin',
    'uglify'
  ]);

  grunt.registerTask('prebuild', [
    'run:submodulesUpdate',
    'copy:prebuild'
  ])

  grunt.registerTask('build', [
    'prebuild',
    'less',
    'cssmin',
    //'csscount',
    'uglify',
    'jekyll',
    'copy:postbuild'
  ]);

  grunt.registerTask('server', [
    'build',
    'connect:server',
    'watch'
  ]);

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


<commit_before>module.exports = function(grunt) {
    var browsers = [{
        browserName: "firefox",
        version: "19",
        platform: "XP"
    }, {
        browserName: "googlechrome",
        platform: "XP"
    }, {
        browserName: "googlechrome",
        platform: "linux"
    }, {
        browserName: "internet explorer",
        platform: "WIN8",
        version: "10"
    }, {
        browserName: "internet explorer",
        platform: "VISTA",
        version: "9"
    }, {
        browserName: "opera",
        platform: "Windows 2008",
        version: "12"
    }];

    grunt.initConfig({
        connect: {
            server: {
                options: {
                    base: "",
                    port: 9999
                }
            }
        },
        'saucelabs-jasmine': {
            all: {
                options: {
                    urls: ["http://127.0.0.1:9999/test-jasmine/SpecRunner.html"],
                    tunnelTimeout: 5,
                    build: process.env.TRAVIS_JOB_ID,
                    concurrency: 3,
                    browsers: browsers,
                    testname: "pasta tests",
                    tags: ["master"]
                }
            }
        },
        'saucelabs-qunit': {
            all: {
                options: {
                    urls: ["http://127.0.0.1:9999/test-qunit/index.html"],
                    tunnelTimeout: 5,
                    build: process.env.TRAVIS_JOB_ID,
                    concurrency: 3,
                    browsers: browsers,
                    testname: "qunit tests",
                    tags: ["master"]
                }
            }
        },
        'saucelabs-mocha': {
            all: {
                options: {
                    urls: ["http://127.0.0.1:9999/test-mocha/test/browser/opts.html"],
                    tunnelTimeout: 5,
                    build: process.env.TRAVIS_JOB_ID,
                    concurrency: 3,
                    browsers: browsers,
                    testname: "mocha tests",
                    tags: ["master"]
                }
            }
        },
        'saucelabs-yui': {
            all: {
                options: {
                    urls: ["http://127.0.0.1:9999/test-yui/index.html"],
                    tunnelTimeout: 5,
                    build: process.env.TRAVIS_JOB_ID,
                    concurrency: 3,
                    browsers: browsers,
                    testname: "yui tests",
                    tags: ["master"]
                }
            }
        },
        watch: {}
    });

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

    grunt.registerTask("dev", ["connect", "watch"]);
    grunt.registerTask("test", ["connect", "saucelabs-jasmine", "saucelabs-qunit", "saucelabs-mocha", "saucelabs-yui"]);
};<commit_msg>removed opera for being buggy >.<<commit_after>module.exports = function(grunt) {
    var browsers = [{
        browserName: "firefox",
        version: "19",
        platform: "XP"
    }, {
        browserName: "googlechrome",
        platform: "XP"
    }, {
        browserName: "googlechrome",
        platform: "linux"
    }, {
        browserName: "internet explorer",
        platform: "WIN8",
        version: "10"
    }];

    grunt.initConfig({
        connect: {
            server: {
                options: {
                    base: "",
                    port: 9999
                }
            }
        },
        'saucelabs-jasmine': {
            all: {
                options: {
                    urls: ["http://127.0.0.1:9999/test-jasmine/SpecRunner.html"],
                    tunnelTimeout: 5,
                    build: process.env.TRAVIS_JOB_ID,
                    concurrency: 3,
                    browsers: browsers,
                    testname: "pasta tests",
                    tags: ["master"]
                }
            }
        },
        'saucelabs-qunit': {
            all: {
                options: {
                    urls: ["http://127.0.0.1:9999/test-qunit/index.html"],
                    tunnelTimeout: 5,
                    build: process.env.TRAVIS_JOB_ID,
                    concurrency: 3,
                    browsers: browsers,
                    testname: "qunit tests",
                    tags: ["master"]
                }
            }
        },
        'saucelabs-mocha': {
            all: {
                options: {
                    urls: ["http://127.0.0.1:9999/test-mocha/test/browser/opts.html"],
                    tunnelTimeout: 5,
                    build: process.env.TRAVIS_JOB_ID,
                    concurrency: 3,
                    browsers: browsers,
                    testname: "mocha tests",
                    tags: ["master"]
                }
            }
        },
        'saucelabs-yui': {
            all: {
                options: {
                    urls: ["http://127.0.0.1:9999/test-yui/index.html"],
                    tunnelTimeout: 5,
                    build: process.env.TRAVIS_JOB_ID,
                    concurrency: 3,
                    browsers: browsers,
                    testname: "yui tests",
                    tags: ["master"]
                }
            }
        },
        watch: {}
    });

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

    grunt.registerTask("dev", ["connect", "watch"]);
    grunt.registerTask("test", ["connect", "saucelabs-jasmine", "saucelabs-qunit", "saucelabs-mocha", "saucelabs-yui"]);
};<|endoftext|>


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

  var projectFiles = ['package.json', '*.js', 'bin/**/*.js', 'local/**/*.js', 'local/**/*.json', 'local/*.js*', 'spec/**/*.js'];

  // Project configuration.
  grunt.initConfig({
    "jsbeautifier": {
      src: projectFiles,
      options: {
        js: {
          indentSize: 2
        }

      },
    },
    watch: {
      files: projectFiles,
      tasks: ['default'],
      options: {
        livereload: true
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-jsbeautifier');

  // Default task(s).
  grunt.registerTask('default', ['jsbeautifier']);
};
<commit_msg>fix lf - crlf issues with lint<commit_after>module.exports = function(grunt) {

  var projectFiles = ['package.json', '*.js', 'bin/**/*.js', 'local/**/*.js', 'local/**/*.json', 'local/*.js*', 'spec/**/*.js'];

  // Project configuration.
  grunt.initConfig({
    'jsbeautifier': {
      src: projectFiles,
      options: {
        js: {
          indentSize: 2
        }

      },
    },
    watch: {
      files: projectFiles,
      tasks: ['default'],
      options: {
        livereload: true
      }
    },
    lineending: {
      dist: {
        options: {
          overwrite: true,
          eol: 'lf'
        },
        files: {
          '': projectFiles
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-jsbeautifier');
  grunt.loadNpmTasks('grunt-lineending');

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


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

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

  grunt.initConfig({

    watch: {
      js: {
        files: ['client/**/*.js'],
        tasks: ['js', 'karma:test']
      },
      scss: {
        files: ['client/**/*.scss'],
        tasks: ['scss']
      }
    },

    browserify: {
      options: {
        transform: ['babelify']
      },
      dist: {
        files: {
          'priv/static/main.js': 'client/app/main.js'
        }
      }
    },

    karma: {
      test: {
        options: {
          configFile: 'client/test/karma.conf.js'
        }
      }
    },

    sass: {
      options: {
        sourceMap: true
      },
      compile: {
        files: {
          'priv/static/main.css': 'client/styles/main.scss'
        }
      }
    }
  });

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

  grunt.registerTask('js', [
    'browserify'
  ]);

  grunt.registerTask('scss', [
    'sass'
  ]);

  grunt.registerTask('default', [
    'scss', 'js', 'karma:test', 'watch'
  ]);
};
<commit_msg>dev and prod sass tasks<commit_after>module.exports = function(grunt) {
  'use strict';

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

  grunt.initConfig({

    watch: {
      js: {
        files: ['client/**/*.js'],
        tasks: ['js', 'karma:test']
      },
      sass: {
        files: ['client/**/*.scss'],
        tasks: ['sass:dev']
      }
    },

    browserify: {
      options: {
        transform: ['babelify']
      },
      dist: {
        files: {
          'priv/static/main.js': 'client/app/main.js'
        }
      }
    },

    karma: {
      test: {
        options: {
          configFile: 'client/test/karma.conf.js'
        }
      }
    },

    sass: {
      options: {
        sourceMap: true
      },
      dev: {
        files: {
          'priv/static/main.css': 'client/styles/main.scss'
        }
      },
      prod: {
        options: {
          outputStyle: 'compressed',
          sourceMap: false
        },
        files: {
          'priv/static/main.css': 'client/styles/main.scss'
        }
      }
    }
  });

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

  grunt.registerTask('js', [
    'browserify'
  ]);

  grunt.registerTask('scss', [
    'sass'
  ]);

  grunt.registerTask('build', [
    'sass:prod', 'js'
  ]);

  grunt.registerTask('default', [
    'sass:dev', 'js', 'karma:test', 'watch'
  ]);
};
<|endoftext|>


<commit_before>module.exports = grunt => {
    const JS_INCLUDE = [ '**/*.js', '!node_modules/**', '!test/**/*.spec.js', '!public/js/*-bundle.js', '!public/js/*-bundle.min.js' ];
    const pkg = grunt.file.readJSON( 'package.json' );
    const path = require( 'path' );
    const nodeSass = require( 'node-sass' );

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

    grunt.config.init( {
        concurrent: {
            develop: {
                tasks: [ 'nodemon', 'watch' ],
                options: {
                    logConcurrentOutput: true
                }
            }
        },
        nodemon: {
            dev: {
                script: 'app.js',
                options: {
                    watch: [ 'app', 'config' ],
                    //nodeArgs: [ '--debug' ],
                    env: {
                        NODE_ENV: 'development',
                        DEBUG: '*, -express:*, -send, -compression, -body-parser:*, -puppeteer:*'
                    }
                }
            }
        },
        sass: {
            options: {
                implementation: nodeSass,
                functions: {
                    'base64-url($mimeType, $data)': function( mimeType, data ) {
                        const base64 = new Buffer( data.getValue() ).toString( 'base64' );
                        const urlString = `url("data:${mimeType.getValue()};base64,${base64}")`;
                        return nodeSass.types.String( urlString );
                    }
                }
            },
            compile: {
                cwd: 'app/views/styles',
                dest: 'public/css',
                expand: true,
                outputStyle: 'compressed',
                src: '**/*.scss',
                ext: '.css',
                flatten: true,
                extDot: 'last'
            }
        },
        watch: {
            config: {
                files: [ 'config/*.json' ],
                tasks: [ 'client-config-file:create' ]
            },
            sass: {
                files: [ 'app/views/styles/**/*.scss', 'widget/**/*.scss', '!app/views/styles/component/_system_variables.scss' ],
                tasks: [ 'sass' ],
                options: {
                    spawn: false,
                    livereload: true
                }
            },
            jade: {
                files: [ 'app/views/**/*.pug' ],
                options: {
                    spawn: false,
                    livereload: true
                }
            },
            language: {
                files: [ 'app/views/**/*.pug', 'app/controllers/**/*.js', 'app/models/**/*.js', 'public/js/src/**/*.js' ],
                tasks: [ 'shell:translation', 'i18next' ]
            },
            js: {
                files: [ 'public/js/src/**/*.js', 'widget/**/*.js' ],
                tasks: [ 'js-dev' ],
                options: {
                    spawn: false,
                    livereload: true
                }
            }
        },
        shell: {
            translation: {
                command: [
                    'cd locales',
                    'gulp',
                    'cd ..'
                ].join( '&&' )
            },
            ie11polyfill: {
                command: 'curl "https://cdn.polyfill.io/v2/polyfill.min.js?ua=ie%2F11.0.0&features=es2015%2Ces2016%2Ces2017%2Ces2018%2CElement.prototype.matches" -o "public/js/ie11-polyfill.min.js"',
            }
        },
        jsbeautifier: {
            test: {
                src: JS_INCLUDE,
                options: {
                    config: './.jsbeautifyrc',
                    mode: 'VERIFY_ONLY'
                }
            },
            fix: {
                src: JS_INCLUDE,
                options: {
                    config: './.jsbeautifyrc'
                }
            }
        },
        eslint: {
            all: JS_INCLUDE,
        },
        // test server JS
        mochaTest: {
            all: {
                options: {
                    reporter: 'dot'
                },
                src: [ 'test/server/**/*.spec.js' ]
            },
            account: {
                src: [ 'test/server/account-*.spec.js' ]
            }
        },
        // test client JS
        karma: {
            options: {
                singleRun: true,
                reporters: [ 'dots' ],
                configFile: 'test/client/config/karma.conf.js'
            },
            headless: {
                browsers: [ 'ChromeHeadless' ]
            },
            browsers: {
                browsers: [ 'Chrome', 'ChromeCanary', 'Firefox', 'Opera' /*,'Safari'*/ ],
            }
        },
        browserify: {
            development: {
                files: {
                    'public/js/enketo-webform-dev-bundle.js': [ 'public/js/src/main-webform.js' ],
                    'public/js/enketo-webform-edit-dev-bundle.js': [ 'public/js/src/main-webform-edit.js' ],
                    'public/js/enketo-webform-view-dev-bundle.js': [ 'public/js/src/main-webform-view.js' ],
                    'public/js/enketo-offline-fallback-dev-bundle.js': [ 'public/js/src/main-offline-fallback.js' ]
                },
                options: {
                    browserifyOptions: {
                        debug: true
                    }
                },
            },
            production: {
                files: {
                    'public/js/enketo-webform-bundle.js': [ 'public/js/src/main-webform.js' ],
                    'public/js/enketo-webform-edit-bundle.js': [ 'public/js/src/main-webform-edit.js' ],
                    'public/js/enketo-webform-view-bundle.js': [ 'public/js/src/main-webform-view.js' ],
                    'public/js/enketo-offline-fallback-bundle.js': [ 'public/js/src/main-offline-fallback.js' ]
                },
            },
            options: {
                // ensure that several placeholder modules in **enketo-core** are overridden
                transform: [
                    [ 'aliasify', {
                        aliases: pkg.aliasify.aliases,
                        global: true
                    } ]
                ]
            },
        },
        uglify: {
            all: {
                files: {
                    'public/js/enketo-webform-bundle.min.js': [ 'public/js/enketo-webform-bundle.js' ],
                    'public/js/enketo-webform-edit-bundle.min.js': [ 'public/js/enketo-webform-edit-bundle.js' ],
                    'public/js/enketo-webform-view-bundle.min.js': [ 'public/js/enketo-webform-view-bundle.js' ],
                    'public/js/enketo-offline-fallback-bundle.min.js': [ 'public/js/enketo-offline-fallback-bundle.js' ],
                },
            },
        },
        env: {
            develop: {
                NODE_ENV: 'develop'
            },
            test: {
                NODE_ENV: 'test'
            },
            production: {
                NODE_ENV: 'production'
            }
        },
        i18next: {
            locales: {
                cwd: 'locales/',
                expand: true,
                src: [ '*/' ],
                include: [ '**/translation.json', '**/translation-additions.json' ],
                rename( dest, src ) {
                    return `${dest + src}translation-combined.json`;
                },
                dest: 'locales/'
            }
        }
    } );

    grunt.registerTask( 'client-config-file', 'Temporary client-config file', task => {
        const CLIENT_CONFIG_PATH = 'public/temp-client-config.json';
        if ( task === 'create' ) {
            const config = require( './app/models/config-model' );
            grunt.file.write( CLIENT_CONFIG_PATH, JSON.stringify( config.client ) );
            grunt.log.writeln( `File ${CLIENT_CONFIG_PATH} created` );
        } else if ( task === 'remove' ) {
            grunt.file.delete( CLIENT_CONFIG_PATH );
            grunt.log.writeln( `File ${CLIENT_CONFIG_PATH} removed` );
        }
    } );

    grunt.registerTask( 'system-sass-variables', 'Creating _system_variables.scss', () => {
        const SYSTEM_SASS_VARIABLES_PATH = 'app/views/styles/component/_system_variables.scss';
        const config = require( './app/models/config-model' );
        grunt.file.write( SYSTEM_SASS_VARIABLES_PATH, `$base-path: "${config.server[ 'base path' ]}";` );
        grunt.log.writeln( `File ${SYSTEM_SASS_VARIABLES_PATH} created` );
    } );

    grunt.registerTask( 'widgets', 'generate widget reference files', () => {
        const WIDGETS_JS_LOC = 'public/js/';
        const WIDGETS_JS = `${WIDGETS_JS_LOC}widgets.js`;
        const WIDGETS_SASS_LOC = 'app/views/styles/component/';
        const WIDGETS_SASS = `${WIDGETS_SASS_LOC}_widgets.scss`;
        const PRE = '// This file is automatically generated with `grunt widgets`\n';
        const widgets = require( './app/models/config-model' ).server.widgets;
        const coreWidgets = require( './public/js/src/module/core-widgets' );
        const paths = Object.keys( widgets ).map( key => coreWidgets[ widgets[ key ] ] || widgets[ key ] );
        let content = `${PRE}'use strict';\n\nmodule.exports = [\n    ${paths.map( p => grunt.file.exists( WIDGETS_JS_LOC, `${p}.js` ) ? `require( '${p}' )` : `//${p} not found` ).join( ',\n    ' )}\n];\n`;
        grunt.file.write( WIDGETS_JS, content );
        grunt.log.writeln( `File ${WIDGETS_JS} created` );
        content = `${PRE +
    paths.map( p => {
        p = path.join( '../../', p );
        return grunt.file.exists( WIDGETS_SASS_LOC, `${p}.scss` ) ? `@import "${p}"` : `//${p} not found`;
    } ).join( ';\n' )};`;
        grunt.file.write( WIDGETS_SASS, content );
        grunt.log.writeln( `File ${WIDGETS_SASS} created` );
    } );

    grunt.registerTask( 'default', [ 'shell:ie11polyfill', 'i18next', 'widgets', 'css', 'js', 'uglify' ] );
    grunt.registerTask( 'js', [ 'client-config-file:create', 'widgets', 'browserify:production' ] );
    grunt.registerTask( 'js-dev', [ 'client-config-file:create', 'widgets', 'browserify:development' ] );
    grunt.registerTask( 'css', [ 'system-sass-variables:create', 'sass' ] );
    grunt.registerTask( 'test', [ 'env:test', 'js', 'css', 'mochaTest:all', 'karma:headless', 'jsbeautifier:test', 'eslint' ] );
    grunt.registerTask( 'test-browser', [ 'env:test', 'css', 'client-config-file:create', 'karma:browsers' ] );
    grunt.registerTask( 'develop', [ 'env:develop', 'shell:ie11polyfill', 'i18next', 'js-dev', 'css', 'concurrent:develop' ] );
    grunt.registerTask( 'test-and-build', [ 'env:test', 'mochaTest:all', 'karma:headless', 'env:production', 'default' ] );
};
<commit_msg>fixed: jsbeautifier test<commit_after>module.exports = grunt => {
    const JS_INCLUDE = [ '**/*.js', '!node_modules/**', '!test/**/*.spec.js', '!public/js/*-bundle.js', '!public/js/*.min.js' ];
    const pkg = grunt.file.readJSON( 'package.json' );
    const path = require( 'path' );
    const nodeSass = require( 'node-sass' );

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

    grunt.config.init( {
        concurrent: {
            develop: {
                tasks: [ 'nodemon', 'watch' ],
                options: {
                    logConcurrentOutput: true
                }
            }
        },
        nodemon: {
            dev: {
                script: 'app.js',
                options: {
                    watch: [ 'app', 'config' ],
                    //nodeArgs: [ '--debug' ],
                    env: {
                        NODE_ENV: 'development',
                        DEBUG: '*, -express:*, -send, -compression, -body-parser:*, -puppeteer:*'
                    }
                }
            }
        },
        sass: {
            options: {
                implementation: nodeSass,
                functions: {
                    'base64-url($mimeType, $data)': function( mimeType, data ) {
                        const base64 = new Buffer( data.getValue() ).toString( 'base64' );
                        const urlString = `url("data:${mimeType.getValue()};base64,${base64}")`;
                        return nodeSass.types.String( urlString );
                    }
                }
            },
            compile: {
                cwd: 'app/views/styles',
                dest: 'public/css',
                expand: true,
                outputStyle: 'compressed',
                src: '**/*.scss',
                ext: '.css',
                flatten: true,
                extDot: 'last'
            }
        },
        watch: {
            config: {
                files: [ 'config/*.json' ],
                tasks: [ 'client-config-file:create' ]
            },
            sass: {
                files: [ 'app/views/styles/**/*.scss', 'widget/**/*.scss', '!app/views/styles/component/_system_variables.scss' ],
                tasks: [ 'sass' ],
                options: {
                    spawn: false,
                    livereload: true
                }
            },
            jade: {
                files: [ 'app/views/**/*.pug' ],
                options: {
                    spawn: false,
                    livereload: true
                }
            },
            language: {
                files: [ 'app/views/**/*.pug', 'app/controllers/**/*.js', 'app/models/**/*.js', 'public/js/src/**/*.js' ],
                tasks: [ 'shell:translation', 'i18next' ]
            },
            js: {
                files: [ 'public/js/src/**/*.js', 'widget/**/*.js' ],
                tasks: [ 'js-dev' ],
                options: {
                    spawn: false,
                    livereload: true
                }
            }
        },
        shell: {
            translation: {
                command: [
                    'cd locales',
                    'gulp',
                    'cd ..'
                ].join( '&&' )
            },
            ie11polyfill: {
                command: 'curl "https://cdn.polyfill.io/v2/polyfill.min.js?ua=ie%2F11.0.0&features=es2015%2Ces2016%2Ces2017%2Ces2018%2CElement.prototype.matches" -o "public/js/ie11-polyfill.min.js"',
            }
        },
        jsbeautifier: {
            test: {
                src: JS_INCLUDE,
                options: {
                    config: './.jsbeautifyrc',
                    mode: 'VERIFY_ONLY'
                }
            },
            fix: {
                src: JS_INCLUDE,
                options: {
                    config: './.jsbeautifyrc'
                }
            }
        },
        eslint: {
            all: JS_INCLUDE,
        },
        // test server JS
        mochaTest: {
            all: {
                options: {
                    reporter: 'dot'
                },
                src: [ 'test/server/**/*.spec.js' ]
            },
            account: {
                src: [ 'test/server/account-*.spec.js' ]
            }
        },
        // test client JS
        karma: {
            options: {
                singleRun: true,
                reporters: [ 'dots' ],
                configFile: 'test/client/config/karma.conf.js'
            },
            headless: {
                browsers: [ 'ChromeHeadless' ]
            },
            browsers: {
                browsers: [ 'Chrome', 'ChromeCanary', 'Firefox', 'Opera' /*,'Safari'*/ ],
            }
        },
        browserify: {
            development: {
                files: {
                    'public/js/enketo-webform-dev-bundle.js': [ 'public/js/src/main-webform.js' ],
                    'public/js/enketo-webform-edit-dev-bundle.js': [ 'public/js/src/main-webform-edit.js' ],
                    'public/js/enketo-webform-view-dev-bundle.js': [ 'public/js/src/main-webform-view.js' ],
                    'public/js/enketo-offline-fallback-dev-bundle.js': [ 'public/js/src/main-offline-fallback.js' ]
                },
                options: {
                    browserifyOptions: {
                        debug: true
                    }
                },
            },
            production: {
                files: {
                    'public/js/enketo-webform-bundle.js': [ 'public/js/src/main-webform.js' ],
                    'public/js/enketo-webform-edit-bundle.js': [ 'public/js/src/main-webform-edit.js' ],
                    'public/js/enketo-webform-view-bundle.js': [ 'public/js/src/main-webform-view.js' ],
                    'public/js/enketo-offline-fallback-bundle.js': [ 'public/js/src/main-offline-fallback.js' ]
                },
            },
            options: {
                // ensure that several placeholder modules in **enketo-core** are overridden
                transform: [
                    [ 'aliasify', {
                        aliases: pkg.aliasify.aliases,
                        global: true
                    } ]
                ]
            },
        },
        uglify: {
            all: {
                files: {
                    'public/js/enketo-webform-bundle.min.js': [ 'public/js/enketo-webform-bundle.js' ],
                    'public/js/enketo-webform-edit-bundle.min.js': [ 'public/js/enketo-webform-edit-bundle.js' ],
                    'public/js/enketo-webform-view-bundle.min.js': [ 'public/js/enketo-webform-view-bundle.js' ],
                    'public/js/enketo-offline-fallback-bundle.min.js': [ 'public/js/enketo-offline-fallback-bundle.js' ],
                },
            },
        },
        env: {
            develop: {
                NODE_ENV: 'develop'
            },
            test: {
                NODE_ENV: 'test'
            },
            production: {
                NODE_ENV: 'production'
            }
        },
        i18next: {
            locales: {
                cwd: 'locales/',
                expand: true,
                src: [ '*/' ],
                include: [ '**/translation.json', '**/translation-additions.json' ],
                rename( dest, src ) {
                    return `${dest + src}translation-combined.json`;
                },
                dest: 'locales/'
            }
        }
    } );

    grunt.registerTask( 'client-config-file', 'Temporary client-config file', task => {
        const CLIENT_CONFIG_PATH = 'public/temp-client-config.json';
        if ( task === 'create' ) {
            const config = require( './app/models/config-model' );
            grunt.file.write( CLIENT_CONFIG_PATH, JSON.stringify( config.client ) );
            grunt.log.writeln( `File ${CLIENT_CONFIG_PATH} created` );
        } else if ( task === 'remove' ) {
            grunt.file.delete( CLIENT_CONFIG_PATH );
            grunt.log.writeln( `File ${CLIENT_CONFIG_PATH} removed` );
        }
    } );

    grunt.registerTask( 'system-sass-variables', 'Creating _system_variables.scss', () => {
        const SYSTEM_SASS_VARIABLES_PATH = 'app/views/styles/component/_system_variables.scss';
        const config = require( './app/models/config-model' );
        grunt.file.write( SYSTEM_SASS_VARIABLES_PATH, `$base-path: "${config.server[ 'base path' ]}";` );
        grunt.log.writeln( `File ${SYSTEM_SASS_VARIABLES_PATH} created` );
    } );

    grunt.registerTask( 'widgets', 'generate widget reference files', () => {
        const WIDGETS_JS_LOC = 'public/js/';
        const WIDGETS_JS = `${WIDGETS_JS_LOC}widgets.js`;
        const WIDGETS_SASS_LOC = 'app/views/styles/component/';
        const WIDGETS_SASS = `${WIDGETS_SASS_LOC}_widgets.scss`;
        const PRE = '// This file is automatically generated with `grunt widgets`\n';
        const widgets = require( './app/models/config-model' ).server.widgets;
        const coreWidgets = require( './public/js/src/module/core-widgets' );
        const paths = Object.keys( widgets ).map( key => coreWidgets[ widgets[ key ] ] || widgets[ key ] );
        let content = `${PRE}'use strict';\n\nmodule.exports = [\n    ${paths.map( p => grunt.file.exists( WIDGETS_JS_LOC, `${p}.js` ) ? `require( '${p}' )` : `//${p} not found` ).join( ',\n    ' )}\n];\n`;
        grunt.file.write( WIDGETS_JS, content );
        grunt.log.writeln( `File ${WIDGETS_JS} created` );
        content = `${PRE +
    paths.map( p => {
        p = path.join( '../../', p );
        return grunt.file.exists( WIDGETS_SASS_LOC, `${p}.scss` ) ? `@import "${p}"` : `//${p} not found`;
    } ).join( ';\n' )};`;
        grunt.file.write( WIDGETS_SASS, content );
        grunt.log.writeln( `File ${WIDGETS_SASS} created` );
    } );

    grunt.registerTask( 'default', [ 'shell:ie11polyfill', 'i18next', 'widgets', 'css', 'js', 'uglify' ] );
    grunt.registerTask( 'js', [ 'client-config-file:create', 'widgets', 'browserify:production' ] );
    grunt.registerTask( 'js-dev', [ 'client-config-file:create', 'widgets', 'browserify:development' ] );
    grunt.registerTask( 'css', [ 'system-sass-variables:create', 'sass' ] );
    grunt.registerTask( 'test', [ 'env:test', 'js', 'css', 'mochaTest:all', 'karma:headless', 'jsbeautifier:test', 'eslint' ] );
    grunt.registerTask( 'test-browser', [ 'env:test', 'css', 'client-config-file:create', 'karma:browsers' ] );
    grunt.registerTask( 'develop', [ 'env:develop', 'shell:ie11polyfill', 'i18next', 'js-dev', 'css', 'concurrent:develop' ] );
    grunt.registerTask( 'test-and-build', [ 'env:test', 'mochaTest:all', 'karma:headless', 'env:production', 'default' ] );
};
<|endoftext|>