# all files / qlobber-fsq/ Gruntfile.js

100% Statements 16/16
50% Branches 1/2
100% Functions 1/1
100% Lines 16/16

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85

    1×

    1×

    1×

    1×
    1×
    1×
    1×

    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×

     /*jslint node: true */
    "use strict";

    var fsq_dir_index = process.argv.indexOf('--fsq-dir');

    module.exports = function (grunt)
    {
        grunt.initConfig(
        {
            jshint: {
                all: {
                    src: [ 'Gruntfile.js', 'index.js', 'lib/*.js', 'test/**/*.js', 'bench/**/*.js' ],
                    options: {
                        esversion: 6
                    }
                }
            },

            mochaTest: {
                default: {
                    src: ['test/common.js', 'test/test_spec.js']
                },
                stress: {
                    src: ['test/common.js', 'test/multiple_queues_spec.js' ]
                },
                multi: {
                    src: ['test/common.js',
                          'test/rabbitmq_bindings.js',
                          'test/rabbitmq_spec.js']
                }
            },

            apidox: {
                input: ['lib/qlobber-fsq.js', 'lib/events_doc.js'],
                output: 'README.md',
                fullSourceDescription: true,
                extraHeadingLevels: 1,
                sections: {
                    'QlobberFSQ': '\n## Constructor',
                    'QlobberFSQ.prototype.subscribe': '\n## Publish and subscribe',
                    'QlobberFSQ.prototype.stop_watching': '\n## Lifecycle',
                    'QlobberFSQ.events.start': '\n## Events'
                }
            },

            shell: {
                cover: {
                    command: './node_modules/.bin/istanbul cover ./node_modules/.bin/grunt -- test ' + (fsq_dir_index < 0 ? /* istanbul ignore next */ '' : process.argv.slice(fsq_dir_index).join(' '))
                },

                check_cover: {
                    command: './node_modules/.bin/istanbul check-coverage --statement 90 --branch 85 --function 95 --line 95'
                },

                coveralls: {
                    command: 'cat coverage/lcov.info | coveralls'
                },

                bench: {
                    command: './node_modules/.bin/bench -c 1 -i "$(echo bench/implementations/*.js | tr " " ,)" --data "' + new Buffer(JSON.stringify(process.argv.slice(3))).toString('hex') + '"'

                },

                diagrams: {
                    command: 'dot diagrams/how_it_works.dot -Tsvg -odiagrams/how_it_works.svg'
                }
            }
        });

        grunt.loadNpmTasks('grunt-contrib-jshint');
        grunt.loadNpmTasks('grunt-mocha-test');
        grunt.loadNpmTasks('grunt-apidox');
        grunt.loadNpmTasks('grunt-shell');

        grunt.registerTask('lint', 'jshint');
        grunt.registerTask('test', 'mochaTest:default');
        grunt.registerTask('test-stress', 'mochaTest:stress');
        grunt.registerTask('test-multi', 'mochaTest:multi');
        grunt.registerTask('docs', ['shell:diagrams', 'apidox']);
        grunt.registerTask('coverage', ['shell:cover', 'shell:check_cover']);
        grunt.registerTask('coveralls', 'shell:coveralls');
        grunt.registerTask('bench', 'shell:bench');
        grunt.registerTask('default', ['jshint', 'mochaTest:default']);
    };