Esempio n. 1
0
    function getKarmaFiles(useDirectives) {
        var files = [];
        files.push(
            'app/assets/lib/angular-1.5.6/angular.js',
            'app/assets/lib/angular-1.5.6/angular-animate.js',
            'app/assets/lib/angular-ui/ui-bootstrap-1.3.3.js',
            'test/lib/angular/angular-mocks.js'
    );

        if (useDirectives) {
            // use sprockets chain to add files based on the asset pipeline directives
            var sc = new Chain();
            sc.appendPath('app');
            files = files.concat(sc.depChain('app.js').slice(0, -1));  // the slice is there to remove the last element, which is homeService.js itself
            sc.appendPath('app/home');
            files = files.concat(sc.depChain('statusAnnotationService.js').slice(0, -1));  // the slice is there to remove the last element, which is homeService.js itself
            files = files.concat(sc.depChain('homeService.js').slice(0, -1));  // the slice is there to remove the last element, which is homeService.js itself
            files = files.concat(sc.depChain('homeController.js').slice(0, -1));  // the slice is there to remove the last element, which is homeController.js itself
        }
        else {
            files.push(
                'app/*.js',
                'app/home/*.js'
                //'app/assets/js/**/*.js',
            );
        }

        // add specs
        files.push(
            'test/javascript/unit/specs/**/*.js'
        );
        return files;
    }
Esempio n. 2
0
var createSprockets = function(config) {
    var sc = new Chain();

    var sprocketsPath = [].concat(config.sprocketsPath);
    for (var i = 0, len = sprocketsPath.length; i < len; i++){
        if (isAbsolutePath(sprocketsPath[i])) {
            sc.appendPath(sprocketsPath[i]);
        } else {
            sc.appendPath(config.basePath + '/' + sprocketsPath[i]);
        }
    }

    var sprocketsExtensions = [".ejs"].concat(config.sprocketsExtensions || []);
    for (var i = 0, len = sprocketsExtensions.length; i < len; i++){
        sc.appendExtensions(sprocketsExtensions[i]);
    }

    for (var i = config.sprocketsBundles.length -1; i >=0; i--) {
        var expanded = sc.depChain(config.sprocketsBundles[i]);
        for (var j = expanded.length -1; j >=0; j--) {
            config.files.unshift({
                included: true, served: true, watched: config.autoWatch, pattern: expanded[j]
            });
        }
    }
};
Esempio n. 3
0
// Get all of the app's sprocket's dependencies as an array for testing.
var SprocketsChain = require('sprockets-chain'),
    sc = new SprocketsChain();

// Append paths to the list of load paths
sc.appendPath('app/assets/javascripts');
sc.appendPath('vendor/assets/javascripts');

// Get ordered array of individual absolute file paths that compose the
// `application.js` bundle
module.exports = sc.depChain('application.js');