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

    var frameworkFiles = [
        'src/functions.js',
        /* interfaces first */
        'src/ConfiguratorInterface.js',
        'src/ControllerInterface.js',
        'src/EntityInterface.js',
        'src/FactoryInterface.js',
        '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/StateRegistryInterface.js',
        'src/RegistryInterface.js',
        'src/ServiceContainerInterface.js',
        'src/Storage/RepositoryInterface.js',
        'src/Storage/EngineInterface.js',
        'src/Storage/StoreMapperInterface.js',
        'src/View/LayoutFactoryInterface.js',
        'src/View/ListFactoryInterface.js',
        'src/View/TemplateEngineInterface.js',
        'src/View/ViewScreenFactoryInterface.js',
        'src/Validator/ConstraintInterface.js',
        'src/Validator/ConstraintValidatorInterface.js',
        /* kernel */
        'src/Kernel/ActionDispatcher.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/Request.js',
        'src/HTTP/Response.js',
        '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/REST.js',
        /* storage */
        'src/Storage/Core.js',
        'src/Storage/Event/LifecycleEvent.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',
        /* validator */
        'src/Validator/Core.js',
        'src/Validator/AbstractConstraint.js',
        'src/Validator/AbstractConstraintValidator.js',
        'src/Validator/Constraint/Blank.js',
        'src/Validator/Constraint/BlankValidator.js',
        'src/Validator/Constraint/Callback.js',
        'src/Validator/Constraint/CallbackValidator.js',
        'src/Validator/Constraint/Choice.js',
        'src/Validator/Constraint/ChoiceValidator.js',
        'src/Validator/Constraint/Country.js',
        'src/Validator/Constraint/CountryValidator.js',
        'src/Validator/Constraint/Date.js',
        'src/Validator/Constraint/DateValidator.js',
        'src/Validator/Constraint/Email.js',
        'src/Validator/Constraint/EmailValidator.js',
        'src/Validator/Constraint/EqualTo.js',
        'src/Validator/Constraint/EqualToValidator.js',
        'src/Validator/Constraint/False.js',
        'src/Validator/Constraint/FalseValidator.js',
        'src/Validator/Constraint/GreaterThan.js',
        'src/Validator/Constraint/GreaterThanValidator.js',
        'src/Validator/Constraint/GreaterThanOrEqual.js',
        'src/Validator/Constraint/GreaterThanOrEqualValidator.js',
        'src/Validator/Constraint/Ip.js',
        'src/Validator/Constraint/IpValidator.js',
        'src/Validator/Constraint/Length.js',
        'src/Validator/Constraint/LengthValidator.js',
        'src/Validator/Constraint/LessThan.js',
        'src/Validator/Constraint/LessThanValidator.js',
        'src/Validator/Constraint/LessThanOrEqual.js',
        'src/Validator/Constraint/LessThanOrEqualValidator.js',
        'src/Validator/Constraint/NotBlank.js',
        'src/Validator/Constraint/NotBlankValidator.js',
        'src/Validator/Constraint/NotEqualTo.js',
        'src/Validator/Constraint/NotEqualToValidator.js',
        'src/Validator/Constraint/NotNull.js',
        'src/Validator/Constraint/NotNullValidator.js',
        'src/Validator/Constraint/NotUndefined.js',
        'src/Validator/Constraint/NotUndefinedValidator.js',
        'src/Validator/Constraint/Null.js',
        'src/Validator/Constraint/NullValidator.js',
        'src/Validator/Constraint/Range.js',
        'src/Validator/Constraint/RangeValidator.js',
        'src/Validator/Constraint/Regex.js',
        'src/Validator/Constraint/RegexValidator.js',
        'src/Validator/Constraint/True.js',
        'src/Validator/Constraint/TrueValidator.js',
        'src/Validator/Constraint/Type.js',
        'src/Validator/Constraint/TypeValidator.js',
        'src/Validator/Constraint/Undefined.js',
        'src/Validator/Constraint/UndefinedValidator.js',
        'src/Validator/Constraint/Url.js',
        'src/Validator/Constraint/UrlValidator.js',
        'src/Validator/ConstraintFactory.js',
        'src/Validator/ConstraintValidatorFactory.js',
        'src/Validator/ConstraintViolation.js',
        'src/Validator/ConstraintViolationList.js',
        'src/Validator/ExecutionContext.js',
        'src/Validator/ExecutionContextFactory.js',
        /* view */
        'src/View/Event/ViewPortEvent.js',
        'src/View/NodeWrapper.js',
        'src/View/Layout.js',
        'src/View/LayoutFactory.js',
        'src/View/List.js',
        'src/View/ListFactory.js',
        'src/View/Manager.js',
        'src/View/Parser.js',
        'src/View/TemplateEngine.js',
        'src/View/ViewPort.js',
        'src/View/ViewScreen.js',
        'src/View/ViewScreenFactory.js',
        /* events */
        'src/Event/AppShutdownEvent.js',
        'src/Event/ControllerEvent.js',
        /* top objects */
        'src/Configurator.js',
        'src/Controller.js',
        'src/DOM.js',
        'src/Entity.js',
        'src/ParamProxy.js',
        'src/StateRegistry.js',
        'src/StateRegistryFactory.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 'event':
                            path = 'event';
                            break;
                        case 'validator':
                            path = 'validator/';
                            break;
                        case 'topLevel':
                            path = [
                                'entity.js',
                                'functions.js',
                                'stateregistry.js',
                                'stateregistryfactory.js',
                                'registry.js',
                                'registryfactory.js',
                                'servicecontainer.js',
                                'translator.js',
                            ].join(',tests/');
                            break;
                    }

                    return './node_modules/venus/bin/venus run -t tests/' + path + ' -c -n';
                }
            }
        },
        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:kernel',
        'exec:test:event',
        'exec:test:validator',
        'exec:test:topLevel'
    ]);

};
<commit_msg>grunt build now generates individual components too<commit_after>module.exports = function (grunt) {

    var generator = [
            'src/Lib/Generator/Interface.js',
            'src/Lib/Generator/UUID.js'
        ],
        logger = [
            'src/Lib/Logger/Interface.js',
            'src/Lib/Logger/Handler/Interface.js',
            'src/Lib/Logger/Handler/Console.js',
            'src/Lib/Logger/CoreLogger.js'
        ],
        mediator = [
            'src/Lib/Mediator.js'
        ],
        http = [
            'src/Lib/Logger/Interface.js',
            'src/HTTP/RequestInterface.js',
            'src/HTTP/ResponseInterface.js',
            'src/HTTP/Request.js',
            'src/HTTP/Response.js',
            '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/REST.js'
        ],
        storage = [
            'src/EntityInterface.js',
            'src/Storage/RepositoryInterface.js',
            'src/Storage/EngineInterface.js',
            'src/Storage/StoreMapperInterface.js',
            'src/Storage/Core.js',
            'src/Storage/Event/LifecycleEvent.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'
        ],
        validator = [
            'src/Validator/ConstraintInterface.js',
            'src/Validator/ConstraintValidatorInterface.js',
            'src/Validator/Core.js',
            'src/Validator/AbstractConstraint.js',
            'src/Validator/AbstractConstraintValidator.js',
            'src/Validator/Constraint/Blank.js',
            'src/Validator/Constraint/BlankValidator.js',
            'src/Validator/Constraint/Callback.js',
            'src/Validator/Constraint/CallbackValidator.js',
            'src/Validator/Constraint/Choice.js',
            'src/Validator/Constraint/ChoiceValidator.js',
            'src/Validator/Constraint/Country.js',
            'src/Validator/Constraint/CountryValidator.js',
            'src/Validator/Constraint/Date.js',
            'src/Validator/Constraint/DateValidator.js',
            'src/Validator/Constraint/Email.js',
            'src/Validator/Constraint/EmailValidator.js',
            'src/Validator/Constraint/EqualTo.js',
            'src/Validator/Constraint/EqualToValidator.js',
            'src/Validator/Constraint/False.js',
            'src/Validator/Constraint/FalseValidator.js',
            'src/Validator/Constraint/GreaterThan.js',
            'src/Validator/Constraint/GreaterThanValidator.js',
            'src/Validator/Constraint/GreaterThanOrEqual.js',
            'src/Validator/Constraint/GreaterThanOrEqualValidator.js',
            'src/Validator/Constraint/Ip.js',
            'src/Validator/Constraint/IpValidator.js',
            'src/Validator/Constraint/Length.js',
            'src/Validator/Constraint/LengthValidator.js',
            'src/Validator/Constraint/LessThan.js',
            'src/Validator/Constraint/LessThanValidator.js',
            'src/Validator/Constraint/LessThanOrEqual.js',
            'src/Validator/Constraint/LessThanOrEqualValidator.js',
            'src/Validator/Constraint/NotBlank.js',
            'src/Validator/Constraint/NotBlankValidator.js',
            'src/Validator/Constraint/NotEqualTo.js',
            'src/Validator/Constraint/NotEqualToValidator.js',
            'src/Validator/Constraint/NotNull.js',
            'src/Validator/Constraint/NotNullValidator.js',
            'src/Validator/Constraint/NotUndefined.js',
            'src/Validator/Constraint/NotUndefinedValidator.js',
            'src/Validator/Constraint/Null.js',
            'src/Validator/Constraint/NullValidator.js',
            'src/Validator/Constraint/Range.js',
            'src/Validator/Constraint/RangeValidator.js',
            'src/Validator/Constraint/Regex.js',
            'src/Validator/Constraint/RegexValidator.js',
            'src/Validator/Constraint/True.js',
            'src/Validator/Constraint/TrueValidator.js',
            'src/Validator/Constraint/Type.js',
            'src/Validator/Constraint/TypeValidator.js',
            'src/Validator/Constraint/Undefined.js',
            'src/Validator/Constraint/UndefinedValidator.js',
            'src/Validator/Constraint/Url.js',
            'src/Validator/Constraint/UrlValidator.js',
            'src/Validator/ConstraintFactory.js',
            'src/Validator/ConstraintValidatorFactory.js',
            'src/Validator/ConstraintViolation.js',
            'src/Validator/ConstraintViolationList.js',
            'src/Validator/ExecutionContext.js',
            'src/Validator/ExecutionContextFactory.js'
        ],
        view = [
            'src/View/LayoutFactoryInterface.js',
            'src/View/ListFactoryInterface.js',
            'src/View/TemplateEngineInterface.js',
            'src/View/ViewScreenFactoryInterface.js',
            'src/View/Event/ViewPortEvent.js',
            'src/View/NodeWrapper.js',
            'src/View/Layout.js',
            'src/View/LayoutFactory.js',
            'src/View/List.js',
            'src/View/ListFactory.js',
            'src/View/Manager.js',
            'src/View/Parser.js',
            'src/View/TemplateEngine.js',
            'src/View/ViewPort.js',
            'src/View/ViewScreen.js',
            'src/View/ViewScreenFactory.js',
        ],
        configurator = [
            'src/ConfiguratorInterface.js',
            'src/Configurator.js'
        ],
        registry = [
            'src/RegistryInterface.js',
            'src/Registry.js',
            'src/RegistryFactory.js'
        ],
        stateRegistry = [
            'src/StateRegistryInterface.js',
            'src/StateRegistry.js',
            'src/StateRegistryFactory.js',
        ],
        serviceContainer = [
            'src/ServiceContainerInterface.js',
            'src/ParamProxy.js',
            'src/ServiceContainer.js',
        ],
        translator = [
            'src/Translator.js',
        ],
        factory = [
            'src/FactoryInterface.js',
        ],
        dom = [
            'src/DOM.js'
        ],
        framework = [
            'src/functions.js',
            'src/ControllerInterface.js',
            'src/Kernel/ActionDispatcher.js',
            'src/Kernel/AppParser.js',
            'src/Kernel/ControllerManager.js',
            'src/Kernel/Core.js',
            'src/Kernel/FeatureTester.js',
            'src/Event/AppShutdownEvent.js',
            'src/Event/ControllerEvent.js',
            'src/Controller.js',
            'src/EntityInterface.js',
            'src/Entity.js',
        ],
        unique = function (el, idx, array) {
            if (array.indexOf(el) !== idx && array.indexOf(el) < idx) {
                return false;
            }

            return true;
        };

    generator.unshift('src/functions.js');
    logger.unshift('src/functions.js');
    configurator.unshift('src/functions.js');
    serviceContainer.unshift('src/functions.js');
    registry = factory.concat(registry);
    mediator = mediator
        .concat(generator)
        .concat(logger);
    stateRegistry = factory
        .concat(registry)
        .concat(stateRegistry);
    http = http
        .concat(generator)
        .concat(registry);
    storage = factory
        .concat(logger)
        .concat(http)
        .concat(mediator)
        .concat(registry)
        .concat(stateRegistry)
        .concat(generator)
        .concat(storage);
    validator = factory
        .concat(registry)
        .concat(validator);
    view = factory
        .concat(registry)
        .concat(generator)
        .concat(mediator)
        .concat(dom)
        .concat(view);
    translator = translator
        .concat(registry)
        .concat(stateRegistry);

    mediator.unshift('src/functions.js');
    registry.unshift('src/functions.js');
    stateRegistry.unshift('src/functions.js');
    http.unshift('src/functions.js');
    storage.unshift('src/functions.js');
    validator.unshift('src/functions.js');
    view.unshift('src/functions.js');
    translator.unshift('src/functions.js');

    framework = framework
        .concat(generator)
        .concat(logger)
        .concat(factory)
        .concat(mediator)
        .concat(http)
        .concat(storage)
        .concat(validator)
        .concat(view)
        .concat(configurator)
        .concat(registry)
        .concat(stateRegistry)
        .concat(serviceContainer)
        .concat(translator)
        .concat(dom);

    framework.push('bootstrap.js');

    registry = registry.filter(unique);
    stateRegistry = stateRegistry.filter(unique);
    http = http.filter(unique);
    storage = storage.filter(unique);
    validator = validator.filter(unique);
    view = view.filter(unique);
    translator = translator.filter(unique);
    framework = framework.filter(unique);

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %>#<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n'
            },
            build: {
                files: {
                    'dist/framework.min.js': framework,
                    'dist/generator.min.js': generator,
                    'dist/logger.min.js': logger,
                    'dist/mediator.min.js': mediator,
                    'dist/http.min.js': http,
                    'dist/storage.min.js': storage,
                    'dist/validator.min.js': validator,
                    'dist/view.min.js': view,
                    'dist/configurator.min.js': configurator,
                    'dist/registry.min.js': registry,
                    'dist/state-registry.min.js': stateRegistry,
                    'dist/service-container.min.js': serviceContainer,
                    'dist/translator.min.js': translator
                }
            },
            concat: {
                files: {
                    'dist/framework.js': framework,
                    'dist/generator.js': generator,
                    'dist/logger.js': logger,
                    'dist/mediator.js': mediator,
                    'dist/http.js': http,
                    'dist/storage.js': storage,
                    'dist/validator.js': validator,
                    'dist/view.js': view,
                    'dist/configurator.js': configurator,
                    'dist/registry.js': registry,
                    'dist/state-registry.js': stateRegistry,
                    'dist/service-container.js': serviceContainer,
                    'dist/translator.js': translator
                },
                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 'event':
                            path = 'event';
                            break;
                        case 'validator':
                            path = 'validator/';
                            break;
                        case 'topLevel':
                            path = [
                                'entity.js',
                                'functions.js',
                                'stateregistry.js',
                                'stateregistryfactory.js',
                                'registry.js',
                                'registryfactory.js',
                                'servicecontainer.js',
                                'translator.js',
                            ].join(',tests/');
                            break;
                    }

                    return './node_modules/venus/bin/venus run -t tests/' + path + ' -c -n';
                }
            }
        },
        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:kernel',
        'exec:test:event',
        'exec:test:validator',
        'exec:test:topLevel'
    ]);

};
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('immoral.jquery.json'),
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
    // Task configuration.
    clean: {
      files: ['dist']
    },
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      dist: {
        src: ['src/<%= pkg.name %>.js'],
        dest: 'dist/<%= pkg.name %>.js'
      },
    },
    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      dist: {
        src: '<%= concat.dist.dest %>',
        dest: 'dist/<%= pkg.name %>.min.js'
      },
    },
    qunit: {
      files: ['test/**/*.html']
    },
    jshint: {
      gruntfile: {
        options: {
          jshintrc: '.jshintrc'
        },
        src: 'Gruntfile.js'
      },
      src: {
        options: {
          jshintrc: 'src/.jshintrc'
        },
        src: ['src/**/*.js']
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/**/*.js']
      },
    },
    coffee: {
      compile: {
        files: {
          'src/immoral.js': 'coffee/immoral.coffee', // 1:1 compile
          'test/test.js': 'coffee/test/test.coffee', // 1:1 compile
        }
      },
      compileBare: {
        options: {
          bare: true
        },
        files: {
          'src/immoral.js': 'coffee/immoral.coffee', // 1:1 compile
          'test/test.js': 'coffee/test/test.coffee', // 1:1 compile
        }
      },
      compileJoined: {
        options: {
          join: true
        },
        files: {
          'src/immoral.js': 'coffee/immoral.coffee', // 1:1 compile
          'test/test.js': 'coffee/test/test.coffee', // 1:1 compile, identical output to join = false
        }
      },
      compileWithMaps: {
        options: {
          sourceMap: true
        },
        files: {
          'src/immoral.js': 'coffee/immoral.coffee', // 1:1 compile
        }
      },
      glob_to_multiple: {
        expand: true,
        flatten: true,
        cwd: 'coffee/',
        src: ['*.coffee'],
        dest: 'src/',
        ext: '.js'
      }
    },
    watch: {
      coffee: {
        files: ['coffee/**/*.coffee'],
        tasks: ['coffee:compile']
      },
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      src: {
        files: '<%= jshint.src.src %>',
        tasks: ['jshint:src', 'qunit']
      },
      test: {
        files: '<%= jshint.test.src %>',
        tasks: ['jshint:test', 'qunit']
      },
    },
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-coffee');

  // Default task.
  grunt.registerTask('default', ['coffee', 'jshint', 'qunit', 'clean', 'concat', 'uglify']);

};
<commit_msg>Fix paths<commit_after>'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('immoral.jquery.json'),
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
    // Task configuration.
    clean: {
      files: ['dist']
    },
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      dist: {
        src: ['src/<%= pkg.name %>.js'],
        dest: 'dist/<%= pkg.name %>.js'
      },
    },
    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      dist: {
        src: '<%= concat.dist.dest %>',
        dest: 'dist/<%= pkg.name %>.min.js'
      },
    },
    qunit: {
      files: ['test/**/*.html']
    },
    jshint: {
      gruntfile: {
        options: {
          jshintrc: '.jshintrc'
        },
        src: 'Gruntfile.js'
      },
      src: {
        options: {
          jshintrc: 'src/.jshintrc'
        },
        src: ['src/**/*.js']
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/**/*.js']
      },
    },
    coffee: {
      compile: {
        files: {
          'src/immoral.js': 'src/coffee/immoral.coffee', // 1:1 compile
          'test/test.js': 'src/coffee/test/test.coffee', // 1:1 compile
        }
      },
      compileBare: {
        options: {
          bare: true
        },
        files: {
          'src/immoral.js': 'src/coffee/immoral.coffee', // 1:1 compile
          'test/test.js': 'src/coffee/test/test.coffee', // 1:1 compile
        }
      },
      compileJoined: {
        options: {
          join: true
        },
        files: {
          'src/immoral.js': 'src/coffee/immoral.coffee', // 1:1 compile
          'test/test.js': 'src/coffee/test/test.coffee', // 1:1 compile, identical output to join = false
        }
      },
      compileWithMaps: {
        options: {
          sourceMap: true
        },
        files: {
          'src/immoral.js': 'src/coffee/immoral.coffee', // 1:1 compile
        }
      },
      glob_to_multiple: {
        expand: true,
        flatten: true,
        cwd: 'src/coffee/',
        src: ['*.coffee'],
        dest: 'src/',
        ext: '.js'
      }
    },
    watch: {
      coffee: {
        files: ['src/coffee/**/*.coffee'],
        tasks: ['coffee:compile']
      },
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      src: {
        files: '<%= jshint.src.src %>',
        tasks: ['jshint:src', 'qunit']
      },
      test: {
        files: '<%= jshint.test.src %>',
        tasks: ['jshint:test', 'qunit']
      },
    },
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-coffee');

  // Default task.
  grunt.registerTask('default', ['coffee', 'jshint', 'qunit', 'clean', 'concat', 'uglify']);

};
<|endoftext|>


<commit_before>var request = require('request');

var safari_browsers = [
	{
		browserName: 'safari',
		platform: 'OS X 10.10',
		version: '8.0'
	},
	{
		browserName: 'safari',
		platform: 'OS X 10.9',
		version: '7.0'
	}
];

var chrome_browsers = [
	{
		browserName: 'chrome',
		platform: 'OS X 10.10',
		version: '44.0'
	},
	{
		browserName: 'chrome',
		platform: 'Windows 10',
		version: '43.0'
	},
	{
		browserName: 'chrome',
		platform: 'Linux',
		version: '42.0'
	}
];

var firefox_browsers = [
	{
		browserName: 'firefox',
		platform: 'Windows 10',
		version: '40.0'
	},
	{
		browserName: 'firefox',
		platform: 'OS X 10.10',
		version: '39.0'
	},
	{
		browserName: 'firefox',
		platform: 'Linux',
		version: '38.0'
	}
];

var ios_browsers = [
	{
		browserName: 'iphone',
		deviceName: 'iPhone Simulator',
		deviceOrientation: 'portrait',
		platform: 'OS X 10.10',
		version: '8.4'
	}
];

var android_browsers = [
	{
		browserName: 'android',
		deviceName: 'Android Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '5.1'
	},
	{
		browserName: 'android',
		deviceName: 'Google Nexus 7 HD Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '4.4'
	},
	{
		browserName: 'android',
		deviceName: 'Google Nexus 7C Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '4.3'
	},
	{
		browserName: 'android',
		deviceName: 'LG Nexus 4 Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '4.2'
	},
	{
		browserName: 'android',
		deviceName: 'HTC One X Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '4.1'
	},
	{
		browserName: 'android',
		deviceName: 'HTC Evo 3D Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '4.0'
	}
];

var ie_browsers = [
	{
		browserName: 'internet explorer',
		platform: 'Windows 10',
		version: '11.0'
	},
	{
		browserName: 'internet explorer',
		platform: 'Windows 8.1',
		version: '11.0'
	},
	{
		browserName: 'internet explorer',
		platform: 'Windows 7',
		version: '10.0'
	}
];

var test_urls = [
	'http://0.0.0.0:9999/test/test.html',
	'http://0.0.0.0:9999/test/integration-test.html'
],

module.exports = function(grunt) {
	grunt.initConfig({
		'saucelabs-mocha': {
			all: {
				options: {
					username: 'branchmetrics',
					urls: test_urls,
					maxRetries: 3,
					testname: 'Web SDK Tests',
					browsers: [].concat(
						safari_browsers,
						// chrome_browsers,
						firefox_browsers,
						android_browsers,
						chrome_browsers)
						// ios_browsers,
						// ie_browsers)
				}
			},
			options: {
				force: true
			}
		},
		connect: {
			server: {
				options: {
					port: 9999,
					base: ''
				}
			}
		}
	});

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

	grunt.loadNpmTasks('grunt-saucelabs');
	grunt.loadNpmTasks('grunt-contrib-connect');

	grunt.registerTask('test', ['connect', 'saucelabs-mocha']);
};
<commit_msg>fix grunt<commit_after>var request = require('request');

var safari_browsers = [
	{
		browserName: 'safari',
		platform: 'OS X 10.10',
		version: '8.0'
	},
	{
		browserName: 'safari',
		platform: 'OS X 10.9',
		version: '7.0'
	}
];

var chrome_browsers = [
	{
		browserName: 'chrome',
		platform: 'OS X 10.10',
		version: '44.0'
	},
	{
		browserName: 'chrome',
		platform: 'Windows 10',
		version: '43.0'
	},
	{
		browserName: 'chrome',
		platform: 'Linux',
		version: '42.0'
	}
];

var firefox_browsers = [
	{
		browserName: 'firefox',
		platform: 'Windows 10',
		version: '40.0'
	},
	{
		browserName: 'firefox',
		platform: 'OS X 10.10',
		version: '39.0'
	},
	{
		browserName: 'firefox',
		platform: 'Linux',
		version: '38.0'
	}
];

var ios_browsers = [
	{
		browserName: 'iphone',
		deviceName: 'iPhone Simulator',
		deviceOrientation: 'portrait',
		platform: 'OS X 10.10',
		version: '8.4'
	}
];

var android_browsers = [
	{
		browserName: 'android',
		deviceName: 'Android Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '5.1'
	},
	{
		browserName: 'android',
		deviceName: 'Google Nexus 7 HD Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '4.4'
	},
	{
		browserName: 'android',
		deviceName: 'Google Nexus 7C Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '4.3'
	},
	{
		browserName: 'android',
		deviceName: 'LG Nexus 4 Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '4.2'
	},
	{
		browserName: 'android',
		deviceName: 'HTC One X Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '4.1'
	},
	{
		browserName: 'android',
		deviceName: 'HTC Evo 3D Emulator',
		deviceOrientation: 'portrait',
		platform: 'Linux',
		version: '4.0'
	}
];

var ie_browsers = [
	{
		browserName: 'internet explorer',
		platform: 'Windows 10',
		version: '11.0'
	},
	{
		browserName: 'internet explorer',
		platform: 'Windows 8.1',
		version: '11.0'
	},
	{
		browserName: 'internet explorer',
		platform: 'Windows 7',
		version: '10.0'
	}
];

var test_urls = [
	'http://0.0.0.0:9999/test/test.html',
	'http://0.0.0.0:9999/test/integration-test.html'
];

module.exports = function(grunt) {
	grunt.initConfig({
		// 'saucelabs-mocha': {
		// 	all: {
		// 		options: {
		// 			username: 'branchmetrics',
		// 			urls: test_urls,
		// 			maxRetries: 3,
		// 			testname: 'Web SDK Tests',
		// 			browsers: chrome_browsers
		// 		}
		// 	},
		// 	options: {
		// 		force: true
		// 	}
		// },
		'saucelabs-mocha': {
			all: {
				options: {
					username: 'branchmetrics',
					urls: test_urls,
					maxRetries: 3,
					testname: 'Web SDK Tests',
					browsers: [].concat(
						safari_browsers,
						chrome_browsers,
						firefox_browsers,
						android_browsers,
						// ios_browsers,
						ie_browsers)
				}
			},
			options: {
				force: true
			}
		},
		connect: {
			server: {
				options: {
					port: 9999,
					base: ''
				}
			}
		}
	});

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

	grunt.loadNpmTasks('grunt-saucelabs');
	grunt.loadNpmTasks('grunt-contrib-connect');

	grunt.registerTask('test', ['connect', 'saucelabs-mocha']);
};
<|endoftext|>


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

	// Project configuration.
	grunt.initConfig({
		jshint: {
			src: [
				"*.js",
				"tests/*.js",
				"api/*.js"
			],
			options: {
				jshintrc: ".jshintrc"
			}
		},
		intern: {
			local: {
				options: {
					runType: "runner",
					config: "tests/intern.local",
					reporters: ["runner"]
				}
			},
			remote: {
				options: {
					runType: "runner",
					config: "tests/intern",
					reporters: ["runner"]
				}
			}
		},
		"jsdoc-amddcl": {
			"dcolor": {
				files: [
					{
						args: [
							"-c",
							"./node_modules/jsdoc-amddcl/conf.json"
						],
						src: [
							".",
							"api/.",
							"./README.md",
							"./package.json"
						]
					},
					{
						args: [
							"-X",
							"-c",
							"./node_modules/jsdoc-amddcl/conf.json"
						],
						src: [
							".",
							"./README.md",
							"./package.json"
						],
						dest: "./out/doclets.json"
					}
				]
			}
		}
	});

	// Load plugins
	grunt.loadNpmTasks("intern");
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.loadNpmTasks("jsdoc-amddcl");

	// Aliases
	grunt.registerTask("jsdoc", "jsdoc-amddcl");

	// Testing.
	// Always specify the target e.g. grunt test:remote, grunt test:remote
	// then add on any other flags afterwards e.g. console, lcovhtml.
	var testTaskDescription = "Run this task instead of the intern task directly! \n" +
		"Always specify the test target e.g. \n" +
		"grunt test:local\n" +
		"grunt test:remote\n\n" +
		"Add any optional reporters via a flag e.g. \n" +
		"grunt test:local:console\n" +
		"grunt test:local:lcovhtml\n" +
		"grunt test:local:console:lcovhtml";
	grunt.registerTask("test", testTaskDescription, function (target) {
		function addReporter(reporter) {
			var property = "intern." + target + ".options.reporters",
				value = grunt.config.get(property);
			if (value.indexOf(reporter) !== -1) {
				return;
			}
			value.push(reporter);
			grunt.config.set(property, value);
		}

		if (this.flags.lcovhtml) {
			addReporter("lcovhtml");
		}

		if (this.flags.console) {
			addReporter("console");
		}
		grunt.task.run("intern:" + target);
	});
};<commit_msg>jsdoc is not enabled yet<commit_after>/*global module */
module.exports = function (grunt) {

	// Project configuration.
	grunt.initConfig({
		jshint: {
			src: [
				"*.js",
				"tests/*.js",
				"api/*.js"
			],
			options: {
				jshintrc: ".jshintrc"
			}
		},
		intern: {
			local: {
				options: {
					runType: "runner",
					config: "tests/intern.local",
					reporters: ["runner"]
				}
			},
			remote: {
				options: {
					runType: "runner",
					config: "tests/intern",
					reporters: ["runner"]
				}
			}
		}/*,
		"jsdoc-amddcl": {
			"dcolor": {
				files: [
					{
						args: [
							"-c",
							"./node_modules/jsdoc-amddcl/conf.json"
						],
						src: [
							".",
							"api/.",
							"./README.md",
							"./package.json"
						]
					},
					{
						args: [
							"-X",
							"-c",
							"./node_modules/jsdoc-amddcl/conf.json"
						],
						src: [
							".",
							"./README.md",
							"./package.json"
						],
						dest: "./out/doclets.json"
					}
				]
			}
		}
		*/
	});

	// Load plugins
	grunt.loadNpmTasks("intern");
	grunt.loadNpmTasks("grunt-contrib-jshint");
	//grunt.loadNpmTasks("jsdoc-amddcl");

	// Aliases
	//grunt.registerTask("jsdoc", "jsdoc-amddcl");

	// Testing.
	// Always specify the target e.g. grunt test:remote, grunt test:remote
	// then add on any other flags afterwards e.g. console, lcovhtml.
	var testTaskDescription = "Run this task instead of the intern task directly! \n" +
		"Always specify the test target e.g. \n" +
		"grunt test:local\n" +
		"grunt test:remote\n\n" +
		"Add any optional reporters via a flag e.g. \n" +
		"grunt test:local:console\n" +
		"grunt test:local:lcovhtml\n" +
		"grunt test:local:console:lcovhtml";
	grunt.registerTask("test", testTaskDescription, function (target) {
		function addReporter(reporter) {
			var property = "intern." + target + ".options.reporters",
				value = grunt.config.get(property);
			if (value.indexOf(reporter) !== -1) {
				return;
			}
			value.push(reporter);
			grunt.config.set(property, value);
		}

		if (this.flags.lcovhtml) {
			addReporter("lcovhtml");
		}

		if (this.flags.console) {
			addReporter("console");
		}
		grunt.task.run("intern:" + target);
	});
};<|endoftext|>


<commit_before>'use strict';

var paths = {
  js: ['*.js', 'test/**/*.js', '!test/coverage/**', '!bower_components/**', 'packages/**/*.js', '!packages/**/node_modules/**', '!packages/contrib/**/*.js', '!packages/contrib/**/node_modules/**'],
  html: ['packages/**/public/**/views/**', 'packages/**/server/views/**'],
  css: ['!bower_components/**', 'packages/**/public/**/css/*.css', '!packages/contrib/**/public/**/css/*.css']
};

module.exports = function(grunt) {

  if (process.env.NODE_ENV !== 'production') {
    require('time-grunt')(grunt);
  }

  // Project Configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    assets: grunt.file.readJSON('config/assets.json'),
    clean: ['bower_components/build'],
    watch: {
      js: {
        files: paths.js,
        tasks: ['jshint'],
        options: {
          livereload: true
        }
      },
      html: {
        files: paths.html,
        options: {
          livereload: true,
          interval: 500
        }
      },
      css: {
        files: paths.css,
        tasks: ['csslint'],
        options: {
          livereload: true
        }
      }
    },
    jshint: {
      all: {
        src: paths.js,
        options: {
          jshintrc: true
        }
      }
    },
    uglify: {
      core: {
        options: {
          mangle: false
        },
        files: '<%= assets.core.js %>'
      }
    },
    csslint: {
      options: {
        csslintrc: '.csslintrc'
      },
      src: paths.css
    },
    cssmin: {
      core: {
        files: '<%= assets.core.css %>'
      }
    },
    nodemon: {
      dev: {
        script: 'server.js',
        options: {
          args: [],
          ignore: ['node_modules/**'],
          ext: 'js,html',
          nodeArgs: ['--debug'],
          delayTime: 1,
          cwd: __dirname
        }
      }
    },
    concurrent: {
      tasks: ['nodemon', 'watch'],
      options: {
        logConcurrentOutput: true
      }
    },
    external_daemon: {
      mongodb: {
        cmd: '../mongodb/bin/mongod',
        args: []
      }
    },
    mochaTest: {
      options: {
        reporter: 'spec',
        require: [
          'server.js',
          function() {
            require('meanio/lib/util').preload(__dirname + '/packages/**/server', 'model');
          }
        ]
      },
      src: ['packages/**/server/tests/**/*.js']
    },
    env: {
      test: {
        NODE_ENV: 'test'
      }
    },
    karma: {
      unit: {
        configFile: 'karma.conf.js'
      }
    }
  });

  //Load NPM tasks
  require('load-grunt-tasks')(grunt);
  grunt.loadNpmTasks('grunt-external-daemon');

  //Default task(s).
  if (process.env.NODE_ENV === 'production') {
    grunt.registerTask('default', ['clean', 'cssmin', 'uglify', 'external_daemon', 'concurrent']);
  } else {
    grunt.registerTask('default', ['clean', 'jshint', 'csslint', 'external_daemon', 'concurrent']);
  }

  //Test task.
  if (process.env.NODE_ENV === 'production') {
    grunt.registerTask('test', ['env:test', 'mochaTest', 'karma:unit']);
  } else {
    grunt.registerTask('test', ['env:test', 'mochaTest', 'karma:unit']);
  }

  // For Heroku users only.
  // Docs: https://github.com/linnovate/mean/wiki/Deploying-on-Heroku
  grunt.registerTask('heroku:production', ['cssmin', 'uglify']);
};
<commit_msg>add external daemon<commit_after>'use strict';

var paths = {
  js: ['*.js', 'test/**/*.js', '!test/coverage/**', '!bower_components/**', 'packages/**/*.js', '!packages/**/node_modules/**', '!packages/contrib/**/*.js', '!packages/contrib/**/node_modules/**'],
  html: ['packages/**/public/**/views/**', 'packages/**/server/views/**'],
  css: ['!bower_components/**', 'packages/**/public/**/css/*.css', '!packages/contrib/**/public/**/css/*.css']
};

module.exports = function(grunt) {

  if (process.env.NODE_ENV !== 'production') {
    require('time-grunt')(grunt);
  }

  // Project Configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    assets: grunt.file.readJSON('config/assets.json'),
    clean: ['bower_components/build'],
    watch: {
      js: {
        files: paths.js,
        tasks: ['jshint'],
        options: {
          livereload: true
        }
      },
      html: {
        files: paths.html,
        options: {
          livereload: true,
          interval: 500
        }
      },
      css: {
        files: paths.css,
        tasks: ['csslint'],
        options: {
          livereload: true
        }
      }
    },
    jshint: {
      all: {
        src: paths.js,
        options: {
          jshintrc: true
        }
      }
    },
    uglify: {
      core: {
        options: {
          mangle: false
        },
        files: '<%= assets.core.js %>'
      }
    },
    csslint: {
      options: {
        csslintrc: '.csslintrc'
      },
      src: paths.css
    },
    cssmin: {
      core: {
        files: '<%= assets.core.css %>'
      }
    },
    nodemon: {
      dev: {
        script: 'server.js',
        options: {
          args: [],
          ignore: ['node_modules/**'],
          ext: 'js,html',
          nodeArgs: ['--debug'],
          delayTime: 1,
          cwd: __dirname
        }
      }
    },
    concurrent: {
      tasks: ['nodemon', 'watch'],
      options: {
        logConcurrentOutput: true
      }
    },
    external_daemon: {
      mongodb: {
        cmd: '../mongodb/bin/mongod',
        args: []
      }
    },
    mochaTest: {
      options: {
        reporter: 'spec',
        require: [
          'server.js',
          function() {
            require('meanio/lib/util').preload(__dirname + '/packages/**/server', 'model');
          }
        ]
      },
      src: ['packages/**/server/tests/**/*.js']
    },
    env: {
      test: {
        NODE_ENV: 'test'
      }
    },
    karma: {
      unit: {
        configFile: 'karma.conf.js'
      }
    }
  });

  //Load NPM tasks
  require('load-grunt-tasks')(grunt);
  grunt.loadNpmTasks('grunt-external-daemon');

  //Default task(s).
  if (process.env.NODE_ENV === 'production') {
    grunt.registerTask('default', ['clean', 'cssmin', 'uglify', 'external_daemon', 'concurrent']);
  } else {
    grunt.registerTask('default', ['clean', 'jshint', 'csslint', 'external_daemon', 'concurrent']);
  }

  //Test task.
  if (process.env.NODE_ENV === 'production') {
    grunt.registerTask('test', ['env:test', 'mochaTest', 'karma:unit']);
  } else {
    grunt.registerTask('test', ['external_daemon', 'env:test', 'mochaTest', 'karma:unit']);
  }

  // For Heroku users only.
  // Docs: https://github.com/linnovate/mean/wiki/Deploying-on-Heroku
  grunt.registerTask('heroku:production', ['cssmin', 'uglify']);
};
<|endoftext|>


<commit_before>const path = require('path');
const sass = require('node-sass');

module.exports = function (grunt) {

  /**
   * Grunt task to remove source map comment
   */
  grunt.registerMultiTask('removesourcemap', 'Grunt task to remove sourcemp comment from files', function () {
    var done = this.async(),
      files = this.filesSrc.filter(function (file) {
        return grunt.file.isFile(file);
      }),
      counter = 0;
    this.files.forEach(function (file) {
      file.src.filter(function (filepath) {
        var content = grunt.file.read(filepath).replace(/\/\/# sourceMappingURL=\S+/, '');
        grunt.file.write(file.dest, content);
        grunt.log.success('Source file "' + filepath + '" was processed.');
        counter++;
        if (counter >= files.length) done(true);
      });
    });
  });

  /**
   * Grunt task for modernizr
   */
  grunt.registerMultiTask("modernizr", "Respond to your user’s browser features.", function () {
    var options = this.options(),
      done = this.async(),
      modernizr = require("modernizr"),
      dest = this.data.dest;
    modernizr.build(options, function (output) {
      grunt.file.write(dest, output);
      done();
    });
  });

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

    // copy
    copy: {
      fonts: {
        files: [
          {
            expand: true,
            cwd: 'node_modules/@fortawesome/fontawesome-free/webfonts',
            src: ['**/*'],
            dest: 't3SphinxThemeRtd/static/fonts/'
          },
          {
            expand: true,
            cwd: 'fonts',
            src: ['**/*'],
            dest: 't3SphinxThemeRtd/static/fonts/'
          }
        ]
      },
      libs: {
        files: [
          {
            src: 'node_modules/jquery/dist/jquery.min.js',
            dest: 't3SphinxThemeRtd/static/js/jquery.min.js'
          },
          {
            src: 'node_modules/popper.js/dist/umd/popper.min.js',
            dest: 't3SphinxThemeRtd/static/js/popper.min.js'
          },
          {
            src: 'node_modules/bootstrap/dist/js/bootstrap.min.js',
            dest: 't3SphinxThemeRtd/static/js/bootstrap.min.js'
          }
        ]
      }
    },

    // stylelint
    stylelint: {
      options: {
        configFile: '.stylelintrc',
        fix: true,
      },
      sass: ['sass/**/*.scss']
    },

    // sass
    sass: {
      options: {
        implementation: sass,
        outputStyle: 'compressed'
      },
      build: {
        files: {
          't3SphinxThemeRtd/static/css/theme.css': 'sass/theme.scss',
          't3SphinxThemeRtd/static/css/webfonts.css': 'sass/webfonts.scss',
          't3SphinxThemeRtd/static/css/fontawesome.css': 'sass/fontawesome.scss',
        }
      }
    },

    // modernizr
    modernizr: {
      main: {
        'dest': 't3SphinxThemeRtd/static/js/modernizr.min.js',
        'options': {
          'options': [
            'domPrefixes',
            'prefixes',
            'addTest',
            'hasEvent',
            'mq',
            'prefixedCSSValue',
            'testAllProps',
            'testProp',
            'testStyles',
            'setClasses'
          ],
          'feature-detects': [
            'custom-elements',
            'history',
            'pointerevents',
            'postmessage',
            'webgl',
            'websockets',
            'css/animations',
            'css/columns',
            'css/flexbox',
            'elem/picture',
            'img/sizes',
            'img/srcset',
            'workers/webworkers'
          ]
        }
      }
    },

    // uglify
    uglify: {
      options: {
        output: {
          comments: false
        }
      },
      autocomplete: {
        src: 'node_modules/autocompleter/autocomplete.js',
        dest: 't3SphinxThemeRtd/static/js/autocomplete.min.js'
      },
      underscore: {
        src: 'node_modules/underscore/underscore.js',
        dest: 't3SphinxThemeRtd/static/js/underscore.min.js'
      },
      modernizr: {
        src: 't3SphinxThemeRtd/static/js/modernizr.min.js',
        dest: 't3SphinxThemeRtd/static/js/modernizr.min.js'
      },
      // SOURCE: https://github.com/sphinx-doc/sphinx/blob/master/sphinx/themes/basic/static/doctools.js
      doctools: {
        src: 'js/doctools.js',
        dest: 't3SphinxThemeRtd/static/js/doctools.min.js'
      },
      // SOURCE: https://github.com/sphinx-doc/sphinx/blob/master/sphinx/themes/basic/static/searchtools.js
      searchtools: {
        src: 'js/searchtools.js',
        dest: 't3SphinxThemeRtd/static/js/searchtools.min.js'
      },
      theme: {
        src: 'js/theme.js',
        dest: 't3SphinxThemeRtd/static/js/theme.min.js'
      },
    },

    // remmove sourcemaps of used dist files
    removesourcemap: {
      contrib: {
        files: {
          't3SphinxThemeRtd/static/js/jquery.min.js': 't3SphinxThemeRtd/static/js/jquery.min.js',
          't3SphinxThemeRtd/static/js/bootstrap.min.js': 't3SphinxThemeRtd/static/js/bootstrap.min.js',
          't3SphinxThemeRtd/static/js/popper.min.js': 't3SphinxThemeRtd/static/js/popper.min.js'
        }
      }
    },

    // exec
    exec: {
      build_sphinx: {
        command: () => {
          systemSpecific = '';
          switch (process.platform) {
            case 'linux':
              systemSpecific = '--user=$(id -u):$(id -g) ';
              break;
          }
          command = 'docker run --rm '
            + systemSpecific
            + '--volume ' + path.resolve((grunt.option('source') ? grunt.option('source') : './node_modules/TYPO3CMS-Guide-HowToDocument')) + ':/PROJECT/:ro '
            + '--volume ' + path.resolve('./config') + ':/CONFIG/:ro '
            + '--volume ' + path.resolve('./build') + ':/RESULT/ '
            + '--volume ' + path.resolve('./t3SphinxThemeRtd') + ':/ALL/userhome/.local/share/virtualenvs/venv-y0waPz_e/lib/python2.7/site-packages/t3SphinxThemeRtd:ro '
            + 't3docs/render-documentation makehtml '
            + '-c make_latex 0 '
            + '-c make_singlehtml 0 '
            + '-c jobfile /CONFIG/jobfile.json '
            + ';'
          return command;
        }
      }
    },

    // build
    clean: {
      build: ['build/*', '!build/.gitignore'],
      css: ['t3SphinxThemeRtd/static/css'],
      fonts: ['t3SphinxThemeRtd/static/fonts'],
      js: ['t3SphinxThemeRtd/static/js'],
    },

    // watch
    watch: {
      /* Compile sass changes into theme directory */
      sass: {
        files: [
          'sass/*.sass',
          'sass/*.scss',
          'node_modules/**/*.sass',
          'node_modules/**/*.scss',
        ],
        tasks: ['sass']
      },
      /* Changes in theme dir rebuild sphinx */
      sphinx: {
        files: [
          't3SphinxThemeRtd/**/*',
        ],
        tasks: ['clean:build', 'exec']
      },
      /* live-reload the demo_docs if sphinx re-builds */
      livereload: {
        files: [
          'build/**/*'
        ],
        options: { livereload: true }
      }
    }

  });

  /**
   * Load tasks
   */
  grunt.loadNpmTasks('grunt-exec');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-sass');
  grunt.loadNpmTasks('grunt-stylelint');

  /**
   * Register tasks
   */
  grunt.registerTask('update', ['copy', 'modernizr']);
  grunt.registerTask('js', ['uglify']);
  grunt.registerTask('default', ['clean', 'update', 'stylelint', 'sass', 'js', 'removesourcemap']);
  grunt.registerTask('build', ['default', 'exec']);
  grunt.registerTask('render', ['clean:build', 'exec']);
};
<commit_msg>Fix typo<commit_after>const path = require('path');
const sass = require('node-sass');

module.exports = function (grunt) {

  /**
   * Grunt task to remove source map comment
   */
  grunt.registerMultiTask('removesourcemap', 'Grunt task to remove sourcemp comment from files', function () {
    var done = this.async(),
      files = this.filesSrc.filter(function (file) {
        return grunt.file.isFile(file);
      }),
      counter = 0;
    this.files.forEach(function (file) {
      file.src.filter(function (filepath) {
        var content = grunt.file.read(filepath).replace(/\/\/# sourceMappingURL=\S+/, '');
        grunt.file.write(file.dest, content);
        grunt.log.success('Source file "' + filepath + '" was processed.');
        counter++;
        if (counter >= files.length) done(true);
      });
    });
  });

  /**
   * Grunt task for modernizr
   */
  grunt.registerMultiTask("modernizr", "Respond to your user’s browser features.", function () {
    var options = this.options(),
      done = this.async(),
      modernizr = require("modernizr"),
      dest = this.data.dest;
    modernizr.build(options, function (output) {
      grunt.file.write(dest, output);
      done();
    });
  });

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

    // copy
    copy: {
      fonts: {
        files: [
          {
            expand: true,
            cwd: 'node_modules/@fortawesome/fontawesome-free/webfonts',
            src: ['**/*'],
            dest: 't3SphinxThemeRtd/static/fonts/'
          },
          {
            expand: true,
            cwd: 'fonts',
            src: ['**/*'],
            dest: 't3SphinxThemeRtd/static/fonts/'
          }
        ]
      },
      libs: {
        files: [
          {
            src: 'node_modules/jquery/dist/jquery.min.js',
            dest: 't3SphinxThemeRtd/static/js/jquery.min.js'
          },
          {
            src: 'node_modules/popper.js/dist/umd/popper.min.js',
            dest: 't3SphinxThemeRtd/static/js/popper.min.js'
          },
          {
            src: 'node_modules/bootstrap/dist/js/bootstrap.min.js',
            dest: 't3SphinxThemeRtd/static/js/bootstrap.min.js'
          }
        ]
      }
    },

    // stylelint
    stylelint: {
      options: {
        configFile: '.stylelintrc',
        fix: true,
      },
      sass: ['sass/**/*.scss']
    },

    // sass
    sass: {
      options: {
        implementation: sass,
        outputStyle: 'compressed'
      },
      build: {
        files: {
          't3SphinxThemeRtd/static/css/theme.css': 'sass/theme.scss',
          't3SphinxThemeRtd/static/css/webfonts.css': 'sass/webfonts.scss',
          't3SphinxThemeRtd/static/css/fontawesome.css': 'sass/fontawesome.scss',
        }
      }
    },

    // modernizr
    modernizr: {
      main: {
        'dest': 't3SphinxThemeRtd/static/js/modernizr.min.js',
        'options': {
          'options': [
            'domPrefixes',
            'prefixes',
            'addTest',
            'hasEvent',
            'mq',
            'prefixedCSSValue',
            'testAllProps',
            'testProp',
            'testStyles',
            'setClasses'
          ],
          'feature-detects': [
            'custom-elements',
            'history',
            'pointerevents',
            'postmessage',
            'webgl',
            'websockets',
            'css/animations',
            'css/columns',
            'css/flexbox',
            'elem/picture',
            'img/sizes',
            'img/srcset',
            'workers/webworkers'
          ]
        }
      }
    },

    // uglify
    uglify: {
      options: {
        output: {
          comments: false
        }
      },
      autocomplete: {
        src: 'node_modules/autocompleter/autocomplete.js',
        dest: 't3SphinxThemeRtd/static/js/autocomplete.min.js'
      },
      underscore: {
        src: 'node_modules/underscore/underscore.js',
        dest: 't3SphinxThemeRtd/static/js/underscore.min.js'
      },
      modernizr: {
        src: 't3SphinxThemeRtd/static/js/modernizr.min.js',
        dest: 't3SphinxThemeRtd/static/js/modernizr.min.js'
      },
      // SOURCE: https://github.com/sphinx-doc/sphinx/blob/master/sphinx/themes/basic/static/doctools.js
      doctools: {
        src: 'js/doctools.js',
        dest: 't3SphinxThemeRtd/static/js/doctools.min.js'
      },
      // SOURCE: https://github.com/sphinx-doc/sphinx/blob/master/sphinx/themes/basic/static/searchtools.js
      searchtools: {
        src: 'js/searchtools.js',
        dest: 't3SphinxThemeRtd/static/js/searchtools.min.js'
      },
      theme: {
        src: 'js/theme.js',
        dest: 't3SphinxThemeRtd/static/js/theme.min.js'
      },
    },

    // remove sourcemaps from dist files
    removesourcemap: {
      contrib: {
        files: {
          't3SphinxThemeRtd/static/js/jquery.min.js': 't3SphinxThemeRtd/static/js/jquery.min.js',
          't3SphinxThemeRtd/static/js/bootstrap.min.js': 't3SphinxThemeRtd/static/js/bootstrap.min.js',
          't3SphinxThemeRtd/static/js/popper.min.js': 't3SphinxThemeRtd/static/js/popper.min.js'
        }
      }
    },

    // exec
    exec: {
      build_sphinx: {
        command: () => {
          systemSpecific = '';
          switch (process.platform) {
            case 'linux':
              systemSpecific = '--user=$(id -u):$(id -g) ';
              break;
          }
          command = 'docker run --rm '
            + systemSpecific
            + '--volume ' + path.resolve((grunt.option('source') ? grunt.option('source') : './node_modules/TYPO3CMS-Guide-HowToDocument')) + ':/PROJECT/:ro '
            + '--volume ' + path.resolve('./config') + ':/CONFIG/:ro '
            + '--volume ' + path.resolve('./build') + ':/RESULT/ '
            + '--volume ' + path.resolve('./t3SphinxThemeRtd') + ':/ALL/userhome/.local/share/virtualenvs/venv-y0waPz_e/lib/python2.7/site-packages/t3SphinxThemeRtd:ro '
            + 't3docs/render-documentation makehtml '
            + '-c make_latex 0 '
            + '-c make_singlehtml 0 '
            + '-c jobfile /CONFIG/jobfile.json '
            + ';'
          return command;
        }
      }
    },

    // build
    clean: {
      build: ['build/*', '!build/.gitignore'],
      css: ['t3SphinxThemeRtd/static/css'],
      fonts: ['t3SphinxThemeRtd/static/fonts'],
      js: ['t3SphinxThemeRtd/static/js'],
    },

    // watch
    watch: {
      /* Compile sass changes into theme directory */
      sass: {
        files: [
          'sass/*.sass',
          'sass/*.scss',
          'node_modules/**/*.sass',
          'node_modules/**/*.scss',
        ],
        tasks: ['sass']
      },
      /* Changes in theme dir rebuild sphinx */
      sphinx: {
        files: [
          't3SphinxThemeRtd/**/*',
        ],
        tasks: ['clean:build', 'exec']
      },
      /* live-reload the demo_docs if sphinx re-builds */
      livereload: {
        files: [
          'build/**/*'
        ],
        options: { livereload: true }
      }
    }

  });

  /**
   * Load tasks
   */
  grunt.loadNpmTasks('grunt-exec');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-sass');
  grunt.loadNpmTasks('grunt-stylelint');

  /**
   * Register tasks
   */
  grunt.registerTask('update', ['copy', 'modernizr']);
  grunt.registerTask('js', ['uglify']);
  grunt.registerTask('default', ['clean', 'update', 'stylelint', 'sass', 'js', 'removesourcemap']);
  grunt.registerTask('build', ['default', 'exec']);
  grunt.registerTask('render', ['clean:build', 'exec']);
};
<|endoftext|>


<commit_before>/*jslint node:true*/
/**
 * Gruntfile for freedom.js
 *
 * Here are the common tasks used:
 * build
 *  - Lint and compile freedom.js
 *  - (default Grunt task)
 *  - This must be run before ANY karma task (because of connect:default)
 *  - Unit tests only run on PhantomJS
 * demo
 *  - Build freedom.js, and start a web server for seeing demos at
 *    http://localhost:8000/demo
 * test
 *  - Build freedom.js, and run all unit tests on
 *    Chrome, Firefox, and PhantomJS
 * debug
 *  - Same as test, except keeps the browsers open
 *    and reruns tests on watched file changes.
 *  - Used to debug unit tests
 * ci
 *  - Do everything that Travis CI should do
 *  - Lint, compile, and unit test freedom.js on phantom.js
 *  - Run all tests on saucelabs.com
 *  - Report coverage to coveralls.io
 * release
 *  - Bump npm package patch version, tag the commit, and publish to npm
 *  - Compile YUIdocs and publish docs, demos, and dist to website
 **/

var FILES = {
  srcCore: [
    'src/*.js',
    'src/link/*.js',
    'src/proxy/*.js',
    'interface/*.js'
  ],
  srcPlatform: [
    'providers/core/*.js'
  ],
  specCoreUnit: [
    'spec/src/*.spec.js'
  ],
  specPlatformUnit: [
    'spec/providers/core/**/*.spec.js'
  ],
  specProviderUnit: [
    'spec/providers/social/**/*.unit.spec.js',
    'spec/providers/storage/**/*.unit.spec.js',
    'spec/providers/transport/**/*.unit.spec.js'
  ],
  specProviderIntegration: [
    'spec/providers/*.integration.spec.js',
    'spec/providers/storage/*.integration.spec.js'
  ],
  specAll: ['spec/**/*.spec.js'],
  freedom: [
    'freedom.js'
  ]
};

var CUSTOM_LAUNCHER = {
  sauce_chrome_mac: {
    base: 'SauceLabs',
    browserName: 'chrome',
    version: '',
    platform: 'OS X 10.9'
  },
  sauce_chrome_win: {
    base: 'SauceLabs',
    browserName: 'chrome',
    version: '',
    platform: 'Windows 7'
  },
  sauce_firefox: {
    base: 'SauceLabs',
    browserName: 'firefox',
    version: ''
  }
};

module.exports = function (grunt) {
  'use strict';
  /**
   * GRUNT CONFIG
   **/
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    karma: {
      options: {
        // NOTE: need to run 'connect:default' to serve files
        configFile: 'karma.conf.js',
        singleRun: true,
        autoWatch: false
      },
      browsers: {
        browsers: ['Chrome', 'Firefox']
      },
      phantom: {
        browsers: ['PhantomJS']
      },
      saucelabs: {
        browsers: ['sauce_chrome_mac', 'sauce_chrome_win', 'sauce_firefox'],
        reporters: ['dots', 'saucelabs'],
        sauceLabs: {
          testName: 'freedom.js',
          username: 'freedomjs',
          accessKey: process.env.SAUCEKEY,
          build: process.env.TRAVIS_BUILD_NUMBER,
          tags: [
            '<%= gitinfo.local.branch.current.name %>',
            '<%= gitinfo.local.branch.current.shortSHA %>',
            '<%= gitinfo.local.branch.current.currentUser %>',
            '<%= gitinfo.local.branch.current.lastCommitAuthor %>',
            '<%= gitinfo.local.branch.current.lastCommitTime %>'
          ]
        },
        customLaunchers: CUSTOM_LAUNCHER
      }
    },
    jshint: {
      beforeconcat: {
        files: { src: FILES.srcCore.concat(FILES.srcPlatform) }
      },
      grunt: ['Gruntfile.js'],
      providers: ['providers/**/*.js'],
      demo: ['demo/**/*.js', '!demo/**/third-party/**'],
      options: {
        jshintrc: true
      }
    },
    browserify: {
      freedom: {
        files: {
          'freedom.js': ['src/util/workerEntry.js']
        },
        options: {
          postBundleCB: function (err, src, next) {
            next(err, require('fs').readFileSync('src/util/header.txt') +
                      grunt.template.process('/** Version: <%= pkg.version %> **/\n') +
                      src);
          }
        }
      },
      frame: {
        files: {
          'spec/helper/frame.js': ['src/util/frameEntry.js']
        }
      },
      jasmine_unit: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit
          )
        }
      },
      jasmine_coverage: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit
          )
        },
        options: {
          transform: ['folderify', ['browserify-istanbul', {
            // Note: bundle must be ignored,
            ignore: ['**/spec/**', '**/src/bundle.js']
          }]]
        }
      },
      jasmine_full: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit,
            FILES.specProviderIntegration
          ),
          'spec/helper/frame.js': ['src/util/frameEntry.js']
        }
      },
      options: {
        transform: ['folderify'],
        browserifyOptions: {
          debug: true
        }
      }
    },
    clean: ['freedom.js', 'freedom.js.map', 'freedom.min.js', 'freedom.min.js.map', 'spec.js', 'spec/helper/frame.js'],
    "extract_sourcemap": {
      freedom: {
        files: {
          "./": ["freedom.js"]
        }
      }
    },
    yuidoc: {
      compile: {
        name: '<%= pkg.name %>',
        description: '<%= pkg.description %>',
        version: '<%= pkg.version %>',
        options: {
          paths: 'src/',
          outdir: 'tools/doc/'
        }
      }
    },
    coveralls: {
      report: {
        src: 'tools/coverage/PhantomJS**/*lcov.info'
      }
    },
    connect: {
      freedom: {
        options: {
          port: 8000,
          keepalive: false
        }
      },
      keepalive: {
        options: {
          port: 8000,
          keepalive: true
        }
      },
      demo: {
        options: {
          port: 8000,
          keepalive: true,
          base: ["./", "demo/"],
          open: "http://localhost:8000/demo/"
        }
      }
    },
    gitinfo: {},
    bump: {
      options: {
        files: ['package.json'],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['package.json'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: true,
        pushTo: 'origin'
      }
    },
    'npm-publish': {
      options: {
        // list of tasks that are required before publishing
        requires: [],
        // if the workspace is dirty, abort publishing (to avoid publishing local changes)
        abortIfDirty: true
      }
    },
    prompt: {
      tagMessage: {
        options: {
          questions: [
            {
              config: 'bump.options.tagMessage',
              type: 'input',
              message: 'Enter a git tag message:',
              default: 'v%VERSION%',
            }
          ]
        }
      }
    },
    shell: {
      options: {},
      publishWebsite: {
        command: 'bash tools/publishWebsite.sh'
      }
    }
  });

  // Load tasks.
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-yuidoc');
  grunt.loadNpmTasks('grunt-coveralls');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-extract-sourcemap');
  grunt.loadNpmTasks('grunt-gitinfo');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-npm');
  grunt.loadNpmTasks('grunt-prompt');
  grunt.loadNpmTasks('grunt-shell');

  grunt.registerTask('prepare_watch', 'Run browserify and karma in watch mode.',
    function () {
      grunt.config.merge({
        browserify: {
          options: {
            debug: true,
            watch: true
          }
        },
        karma: {
          options: {
            singleRun: false,
            autoWatch: true,
            reporters: ['progress', 'html'],
            coverageReporter: {}
          }
        }
      });
    });

  // Default tasks.
  grunt.registerTask('build', [
    'jshint',
    'browserify:freedom',
    'extract_sourcemap'
  ]);
  grunt.registerTask('unit', [
    'browserify:frame',
    'browserify:jasmine_unit',
    'connect:freedom',
    'karma:phantom'
  ]);
  grunt.registerTask('test', [
    'jshint',
    'browserify:frame',
    'browserify:jasmine_full',
    'connect:freedom',
    'karma:browsers'
  ]);
  grunt.registerTask('debug', [
    'prepare_watch',
    'build',
    'connect:freedom',
    'browserify:jasmine_full',
    'karma:browsers'
  ]);
  grunt.registerTask('demo', [
    'browserify:freedom',
    'connect:demo'
  ]);
  grunt.registerTask('website', [
    'yuidoc',
    'shell:publishWebsite'
  ]);

  if (process.env.TRAVIS_JOB_NUMBER) {
    var jobParts = process.env.TRAVIS_JOB_NUMBER.split('.');
    //When run from Travis from jobs *.1
    if (jobParts.length > 1 && jobParts[1] === '1') {
      grunt.registerTask('ci', [
        'browserify:frame',
        'browserify:jasmine_coverage',
        'connect:freedom',
        'karma:phantom',
        'gitinfo',
        'karma:saucelabs',
        'coveralls:report'
      ]);
    } else {  //When run from Travis from jobs *.2, *.3, etc.
      grunt.registerTask('ci', [
        'browserify:frame',
        'browserify:jasmine_unit',
        'connect:freedom',
        'karma:phantom'
      ]);
    }
  } else {  //When run from command-line
    grunt.registerTask('ci', [
      'browserify:frame',
      'browserify:jasmine_unit',
      'connect:freedom',
      'karma:phantom',
      'gitinfo',
      'karma:saucelabs'
    ]);
  }

  grunt.registerTask('release', function (arg) {
    if (arguments.length === 0) {
      arg = 'patch';
    }
    grunt.task.run([
      'default',
      'prompt:tagMessage',
      'bump:' + arg,
      'npm-publish',
      'website'
    ]);
  });

  grunt.registerTask('default', ['build', 'unit']);
};

module.exports.FILES = FILES;
module.exports.CUSTOM_LAUNCHER = CUSTOM_LAUNCHER;
<commit_msg>ask for beta & dev versions of chrome, since default appears to be quite old.<commit_after>/*jslint node:true*/
/**
 * Gruntfile for freedom.js
 *
 * Here are the common tasks used:
 * build
 *  - Lint and compile freedom.js
 *  - (default Grunt task)
 *  - This must be run before ANY karma task (because of connect:default)
 *  - Unit tests only run on PhantomJS
 * demo
 *  - Build freedom.js, and start a web server for seeing demos at
 *    http://localhost:8000/demo
 * test
 *  - Build freedom.js, and run all unit tests on
 *    Chrome, Firefox, and PhantomJS
 * debug
 *  - Same as test, except keeps the browsers open
 *    and reruns tests on watched file changes.
 *  - Used to debug unit tests
 * ci
 *  - Do everything that Travis CI should do
 *  - Lint, compile, and unit test freedom.js on phantom.js
 *  - Run all tests on saucelabs.com
 *  - Report coverage to coveralls.io
 * release
 *  - Bump npm package patch version, tag the commit, and publish to npm
 *  - Compile YUIdocs and publish docs, demos, and dist to website
 **/

var FILES = {
  srcCore: [
    'src/*.js',
    'src/link/*.js',
    'src/proxy/*.js',
    'interface/*.js'
  ],
  srcPlatform: [
    'providers/core/*.js'
  ],
  specCoreUnit: [
    'spec/src/*.spec.js'
  ],
  specPlatformUnit: [
    'spec/providers/core/**/*.spec.js'
  ],
  specProviderUnit: [
    'spec/providers/social/**/*.unit.spec.js',
    'spec/providers/storage/**/*.unit.spec.js',
    'spec/providers/transport/**/*.unit.spec.js'
  ],
  specProviderIntegration: [
    'spec/providers/*.integration.spec.js',
    'spec/providers/storage/*.integration.spec.js'
  ],
  specAll: ['spec/**/*.spec.js'],
  freedom: [
    'freedom.js'
  ]
};

var CUSTOM_LAUNCHER = {
  sauce_chrome_mac: {
    base: 'SauceLabs',
    browserName: 'chrome',
    version: 'b',
    platform: 'OS X 10.9'
  },
  sauce_chrome_win: {
    base: 'SauceLabs',
    browserName: 'chrome',
    version: 'd',
    platform: 'Windows 7'
  },
  sauce_firefox: {
    base: 'SauceLabs',
    browserName: 'firefox',
    version: ''
  }
};

module.exports = function (grunt) {
  'use strict';
  /**
   * GRUNT CONFIG
   **/
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    karma: {
      options: {
        // NOTE: need to run 'connect:default' to serve files
        configFile: 'karma.conf.js',
        singleRun: true,
        autoWatch: false
      },
      browsers: {
        browsers: ['Chrome', 'Firefox']
      },
      phantom: {
        browsers: ['PhantomJS']
      },
      saucelabs: {
        browsers: ['sauce_chrome_mac', 'sauce_chrome_win', 'sauce_firefox'],
        reporters: ['dots', 'saucelabs'],
        sauceLabs: {
          testName: 'freedom.js',
          username: 'freedomjs',
          accessKey: process.env.SAUCEKEY,
          build: process.env.TRAVIS_BUILD_NUMBER,
          tags: [
            '<%= gitinfo.local.branch.current.name %>',
            '<%= gitinfo.local.branch.current.shortSHA %>',
            '<%= gitinfo.local.branch.current.currentUser %>',
            '<%= gitinfo.local.branch.current.lastCommitAuthor %>',
            '<%= gitinfo.local.branch.current.lastCommitTime %>'
          ]
        },
        customLaunchers: CUSTOM_LAUNCHER
      }
    },
    jshint: {
      beforeconcat: {
        files: { src: FILES.srcCore.concat(FILES.srcPlatform) }
      },
      grunt: ['Gruntfile.js'],
      providers: ['providers/**/*.js'],
      demo: ['demo/**/*.js', '!demo/**/third-party/**'],
      options: {
        jshintrc: true
      }
    },
    browserify: {
      freedom: {
        files: {
          'freedom.js': ['src/util/workerEntry.js']
        },
        options: {
          postBundleCB: function (err, src, next) {
            next(err, require('fs').readFileSync('src/util/header.txt') +
                      grunt.template.process('/** Version: <%= pkg.version %> **/\n') +
                      src);
          }
        }
      },
      frame: {
        files: {
          'spec/helper/frame.js': ['src/util/frameEntry.js']
        }
      },
      jasmine_unit: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit
          )
        }
      },
      jasmine_coverage: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit
          )
        },
        options: {
          transform: ['folderify', ['browserify-istanbul', {
            // Note: bundle must be ignored,
            ignore: ['**/spec/**', '**/src/bundle.js']
          }]]
        }
      },
      jasmine_full: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit,
            FILES.specProviderIntegration
          ),
          'spec/helper/frame.js': ['src/util/frameEntry.js']
        }
      },
      options: {
        transform: ['folderify'],
        browserifyOptions: {
          debug: true
        }
      }
    },
    clean: ['freedom.js', 'freedom.js.map', 'freedom.min.js', 'freedom.min.js.map', 'spec.js', 'spec/helper/frame.js'],
    "extract_sourcemap": {
      freedom: {
        files: {
          "./": ["freedom.js"]
        }
      }
    },
    yuidoc: {
      compile: {
        name: '<%= pkg.name %>',
        description: '<%= pkg.description %>',
        version: '<%= pkg.version %>',
        options: {
          paths: 'src/',
          outdir: 'tools/doc/'
        }
      }
    },
    coveralls: {
      report: {
        src: 'tools/coverage/PhantomJS**/*lcov.info'
      }
    },
    connect: {
      freedom: {
        options: {
          port: 8000,
          keepalive: false
        }
      },
      keepalive: {
        options: {
          port: 8000,
          keepalive: true
        }
      },
      demo: {
        options: {
          port: 8000,
          keepalive: true,
          base: ["./", "demo/"],
          open: "http://localhost:8000/demo/"
        }
      }
    },
    gitinfo: {},
    bump: {
      options: {
        files: ['package.json'],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['package.json'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: true,
        pushTo: 'origin'
      }
    },
    'npm-publish': {
      options: {
        // list of tasks that are required before publishing
        requires: [],
        // if the workspace is dirty, abort publishing (to avoid publishing local changes)
        abortIfDirty: true
      }
    },
    prompt: {
      tagMessage: {
        options: {
          questions: [
            {
              config: 'bump.options.tagMessage',
              type: 'input',
              message: 'Enter a git tag message:',
              default: 'v%VERSION%',
            }
          ]
        }
      }
    },
    shell: {
      options: {},
      publishWebsite: {
        command: 'bash tools/publishWebsite.sh'
      }
    }
  });

  // Load tasks.
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-yuidoc');
  grunt.loadNpmTasks('grunt-coveralls');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-extract-sourcemap');
  grunt.loadNpmTasks('grunt-gitinfo');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-npm');
  grunt.loadNpmTasks('grunt-prompt');
  grunt.loadNpmTasks('grunt-shell');

  grunt.registerTask('prepare_watch', 'Run browserify and karma in watch mode.',
    function () {
      grunt.config.merge({
        browserify: {
          options: {
            debug: true,
            watch: true
          }
        },
        karma: {
          options: {
            singleRun: false,
            autoWatch: true,
            reporters: ['progress', 'html'],
            coverageReporter: {}
          }
        }
      });
    });

  // Default tasks.
  grunt.registerTask('build', [
    'jshint',
    'browserify:freedom',
    'extract_sourcemap'
  ]);
  grunt.registerTask('unit', [
    'browserify:frame',
    'browserify:jasmine_unit',
    'connect:freedom',
    'karma:phantom'
  ]);
  grunt.registerTask('test', [
    'jshint',
    'browserify:frame',
    'browserify:jasmine_full',
    'connect:freedom',
    'karma:browsers'
  ]);
  grunt.registerTask('debug', [
    'prepare_watch',
    'build',
    'connect:freedom',
    'browserify:jasmine_full',
    'karma:browsers'
  ]);
  grunt.registerTask('demo', [
    'browserify:freedom',
    'connect:demo'
  ]);
  grunt.registerTask('website', [
    'yuidoc',
    'shell:publishWebsite'
  ]);

  if (process.env.TRAVIS_JOB_NUMBER) {
    var jobParts = process.env.TRAVIS_JOB_NUMBER.split('.');
    //When run from Travis from jobs *.1
    if (jobParts.length > 1 && jobParts[1] === '1') {
      grunt.registerTask('ci', [
        'browserify:frame',
        'browserify:jasmine_coverage',
        'connect:freedom',
        'karma:phantom',
        'gitinfo',
        'karma:saucelabs',
        'coveralls:report'
      ]);
    } else {  //When run from Travis from jobs *.2, *.3, etc.
      grunt.registerTask('ci', [
        'browserify:frame',
        'browserify:jasmine_unit',
        'connect:freedom',
        'karma:phantom'
      ]);
    }
  } else {  //When run from command-line
    grunt.registerTask('ci', [
      'browserify:frame',
      'browserify:jasmine_unit',
      'connect:freedom',
      'karma:phantom',
      'gitinfo',
      'karma:saucelabs'
    ]);
  }

  grunt.registerTask('release', function (arg) {
    if (arguments.length === 0) {
      arg = 'patch';
    }
    grunt.task.run([
      'default',
      'prompt:tagMessage',
      'bump:' + arg,
      'npm-publish',
      'website'
    ]);
  });

  grunt.registerTask('default', ['build', 'unit']);
};

module.exports.FILES = FILES;
module.exports.CUSTOM_LAUNCHER = CUSTOM_LAUNCHER;
<|endoftext|>