Code coverage report for lib/project.js

Statements: 6.06% (2 / 33)      Branches: 0% (0 / 24)      Functions: 33.33% (1 / 3)      Lines: 6.06% (2 / 33)     

All files » lib/ » project.js
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 611   1                                                                                                                    
YUI.add('project', function(Y) {
    
    Y.Project = {
        mix: function(json, options) {
            if (json.project) {
                options = Y.merge(options, json.project);
            }
            if (options.title && !options.name) {
                options.name = options.title;
            }
            return options;
        },
        init: function(options) {
            var project = {};
            if (options.configfile) {
                project = Y.Files.getJSON(options.configfile);
            } else {
                Y.log('Scanning for yuidoc.json file.', 'info', 'yuidoc');
                project = Y.getProjectData();
                if (!project) {
                    project = {};
                }
            }
 
 
            if (project.options && Object.keys(project.options).length) {
                options = Y.merge(project.options, options);
                delete project.options;
                options.project = project;
            }
 
            if (options.version && options.project) {
                options.project.version = options.version;
                delete options.version;
            }
 
            if (!options.outdir) {
                options.outdir = './out';
            }
 
            options.paths = Y.validatePaths(options.paths, options.ignorePaths);
 
            if (!options.paths.length) {
                Y.log('Paths argument was empty', 'warn', 'yuidoc');
                Y.showHelp();
                process.exit(1);
            }
            
            if (typeof options.tabtospace === 'number') {
                options.tabspace = '';
                for (var s = 0; s < options.tabtospace; s++) {
                    options.tabspace += ' ';
                }
            }
 
            return options;
            
        }
    };
});