Code coverage report for lib/tools/broccoli/tree-differ.js

Statements: 45.83% (11 / 24)      Branches: 0% (0 / 6)      Functions: 33.33% (2 / 6)      Lines: 45.83% (11 / 24)      Ignored: none     

All files » lib/tools/broccoli/ » tree-differ.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    1 1 1 1       1         1               1   1 1 1       1    
///<reference path="../../.d.ts"/>
"use strict";
var fs = require("fs");
var path = require("path");
var TreeDiffer = (function () {
    function TreeDiffer(rootPath) {
        this.rootPath = rootPath;
        this.rootDirName = path.basename(rootPath);
    }
    TreeDiffer.prototype.diffTree = function (absoluteOutputPath, treeRootDirName) {
        var rootDir = treeRootDirName ? path.join(this.rootPath, treeRootDirName) : this.rootPath;
        var result = this.dirtyCheckPath(absoluteOutputPath, rootDir);
        return result;
    };
    TreeDiffer.prototype.dirtyCheckPath = function (absoluteOutputPath, rootDir) {
        var result = new DirtyCheckingDiffResult();
        var cachedDirectories = fs.existsSync(rootDir) ? fs.readdirSync(rootDir) : [];
        var currentDirectories = fs.existsSync(absoluteOutputPath) ? fs.readdirSync(absoluteOutputPath) : [];
        result.changedDirectories = _.difference(cachedDirectories, currentDirectories);
        result.removedDirectories = _.difference(currentDirectories, cachedDirectories);
        return result;
    };
    return TreeDiffer;
})();
exports.TreeDiffer = TreeDiffer;
var DirtyCheckingDiffResult = (function () {
    function DirtyCheckingDiffResult() {
        this.changedDirectories = [];
        this.removedDirectories = [];
    }
    return DirtyCheckingDiffResult;
})();