Code coverage report for lib/tools/broccoli/broccoli-plugin-wrapper.js

Statements: 22.86% (8 / 35)      Branches: 0% (0 / 2)      Functions: 20% (1 / 5)      Lines: 22.86% (8 / 35)      Ignored: none     

All files » lib/tools/broccoli/ » broccoli-plugin-wrapper.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    1 1 1                                     1                     1             1         1   1  
///<reference path="../../.d.ts"/>
"use strict";
var tree_differ_1 = require('./tree-differ');
var BroccoliPluginWrapper = (function () {
    function BroccoliPluginWrapper(pluginClass, wrappedPluginArguments) {
        this.pluginClass = pluginClass;
        this.wrappedPlugin = null;
        this.inputTree = null;
        this.description = null;
        this.absoluteOutputPath = null;
        this.treeRootDirName = null;
        this.projectDir = null;
        this.$injector = null;
        this.inputPath = null;
        this.cachePath = null;
        this.outputPath = null;
        this.inputTree = wrappedPluginArguments[0];
        this.description = this.pluginClass.name;
        this.absoluteOutputPath = wrappedPluginArguments[1];
        this.treeRootDirName = wrappedPluginArguments[2];
        this.projectDir = wrappedPluginArguments[3];
        this.$injector = $injector.resolve("injector");
    }
    BroccoliPluginWrapper.prototype.rebuild = function () {
        try {
            this.init();
            var diffResult = this.treeDiffer.diffTree(this.absoluteOutputPath, this.treeRootDirName);
            this.wrappedPlugin.rebuild(diffResult);
        }
        catch (e) {
            e.message = "[" + this.description + "]: " + e.message;
            throw e;
        }
    };
    BroccoliPluginWrapper.prototype.init = function () {
        this.treeDiffer = new tree_differ_1.TreeDiffer(this.inputPath);
        this.wrappedPlugin = this.$injector.resolve(this.pluginClass, { inputPath: this.inputPath,
            cachePath: this.cachePath,
            outputRoot: this.absoluteOutputPath,
            projectDir: this.projectDir });
    };
    BroccoliPluginWrapper.prototype.cleanup = function () {
        if (this.wrappedPlugin.cleanup) {
            this.wrappedPlugin.cleanup();
        }
    };
    return BroccoliPluginWrapper;
})();
exports.BroccoliPluginWrapper = BroccoliPluginWrapper;