public void read_a_directory() { new FileSystem().WriteStringToFile("something.script.config", @" jquery is jquery.1.4.2.js a includes b,c,d "); new FileSystem().WriteStringToFile("else.script.config", @" f extends d g requires h "); activator.ReadScriptConfig(".", log); Debug.WriteLine(log.FullTraceText()); assets.CompileDependencies(log); Assert.IsTrue(log.Success, log.FullTraceText()); // got the alias assets.GetAssets(new[] { "jquery" }).Single().Name.ShouldEqual("jquery.1.4.2.js"); // got the set assets.GetAssets(new[] { "a" }).Select(x => x.Name).ShouldHaveTheSameElementsAs("b", "c", "d", "f"); // got the extension assets.GetAssets(new[] { "d" }).Select(x => x.Name).ShouldHaveTheSameElementsAs("d", "f"); // got the requires assets.GetAssets(new[] { "g" }).Select(x => x.Name).ShouldHaveTheSameElementsAs("h", "g"); }
private IEnumerable <string> ScriptNamesFor(params string[] names) { if (!_compiled) { theGraph.CompileDependencies(new PackageLog()); _compiled = true; } IEnumerable <string> scripts = theGraph.GetAssets(names).Select(x => x.Name); scripts.Each(x => Debug.WriteLine(x)); return(scripts); }
protected override void beforeEach() { _graph = new AssetGraph(); _assetsForSetA = new[] { "a-1.js", "a-2.js" }; _assetsForSetB = new[] { "b-1.css", "b-2.css" }; _assetsForSetC = new[] { "c-1.js", "c-2.js", "c-3.css", "c-4.css" }; _assetsForSetA.Each(x => _graph.AddToSet("setA", x)); _assetsForSetB.Each(x => _graph.AddToSet("setB", x)); _assetsForSetC.Each(x => _graph.AddToSet("setC", x)); _graph.CompileDependencies(null); MockFor <IAssetDependencyFinder>() .Stub(x => x.CompileDependenciesAndOrder(new[] { "setA" })) .Return(_assetsForSetA); MockFor <IAssetDependencyFinder>() .Stub(x => x.CompileDependenciesAndOrder(new[] { "setB" })) .Return(_assetsForSetB); MockFor <IAssetDependencyFinder>() .Stub(x => x.CompileDependenciesAndOrder(new[] { "setC" })) .Return(_assetsForSetC); ClassUnderTest.Apply(null, null, _graph); }
protected override void beforeEach() { var assetGraph = new AssetGraph(); assetGraph.Dependency("a.js", "b.js"); assetGraph.Dependency("a.js", "c.js"); assetGraph.Dependency("d.js", "e.js"); assetGraph.Dependency("d.js", "b.js"); assetGraph.CompileDependencies(new PackageLog()); Services.Inject <IAssetDependencyFinder>(new AssetDependencyFinderCache(assetGraph)); }
public void using_the_configure_method() { var graph = new AssetGraph(); var expression = new AssetsExpression(theRegistry, graph); expression.Configure(@" crud includes a.js, b.js, c.js "); graph.CompileDependencies(new PackageLog()); graph.AssetSetFor("crud").AllFileDependencies() .Select(x => x.Name) .ShouldHaveTheSameElementsAs("a.js", "b.js", "c.js"); }
public void SetUp() { graph = new AssetGraph(); var reader = new AssetDslReader(graph); reader.ReadLine("1 includes A,B,C"); reader.ReadLine("2 includes C,D"); reader.ReadLine("3 includes 1,E"); reader.ReadLine("D requires D1,D2"); reader.ReadLine("3 requires 4"); reader.ReadLine("4 includes jquery,validation.js"); reader.ReadLine("Combo includes 1,2"); reader.ReadLine("C-1 extends C"); reader.ReadLine("crud includes crudForm.js,validation.js"); reader.ReadLine("A requires crud"); graph.CompileDependencies(new PackageLog()); }
public override void TearDown() { _graph.CompileDependencies(new PackageLog()); }