// Configure RequireJs
requirejs.config({
    baseUrl : '../js/app',
    paths   : {
        // Library paths
        backbone   : '../lib/backbone/backbone',
        bootstrap  : '../lib/bootstrap/bootstrap',
        handlebars : '../lib/handlebars/handlebars-v1.1.2',
        jquery     : '../lib/jquery/jquery-1.10.2',
        'bb-loc'   : '../lib/backbone/backbone.localStorage',
        text       : '../lib/require/text',
        underscore : '../lib/underscore/underscore',
        jasmine    : '../../tests/js/lib/jasmine/jasmine',
        'jas-html' : '../../tests/js/lib/jasmine/jasmine-html',

        // Application paths
        specs      : '../../tests/js/specs'
    },

    shim : {
        'backbone' : {
            deps    : [
                'underscore',
                'jquery'
            ],
            exports : 'Backbone'
        },
        'bb-loc' : ['backbone'],
        'bootstrap' : {
            deps : [
                'jquery'
            ]
        },
        'handlebars' : {
            exports : 'Handlebars'
        },
        'underscore' : {
            exports : '_'
        },
        'jas-html' : {
            deps : ['jasmine']
        }
    }
});

// Require main app and run it
require(['jasmine', 'jas-html', 'specs/app'], function() {
    var jasmineEnv = jasmine.getEnv();
    jasmineEnv.updateInterval = 1000;

    var htmlReporter = new jasmine.HtmlReporter();

    jasmineEnv.addReporter(htmlReporter);

    jasmineEnv.specFilter = function(spec) {
        return htmlReporter.specFilter(spec);
    };

    jasmineEnv.execute();
});
