

'use strict';

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        jshint: {
            all: [
                'Gruntfile.js',
                'tasks/*.js',
                '<%= nodeunit.tests %>',
            ],
            options: {
                jshintrc: '.jshintrc'
            }
        },

        // Configuration to be run (and then tested).
        express: {
            default_options: {
                options: { }
            },
            custom_options: {
                options: {
                    port: '9000',
                    baseURL: '/plugin',
                }
            }
        },

        // Unit tests.
        nodeunit: {
            tests: ['test/*_test.js']
        }

    });

    // Actually load this plugin's task(s).
    grunt.loadTasks('tasks');

    // These plugins provide necessary tasks.
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

    // start express then run tests
    grunt.registerTask('test', ['express', 'nodeunit','express:stop']);

    // By default, lint and run all tests.
    grunt.registerTask('default', ['jshint', 'test']);

};
