示例#1
0
        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);
        }
示例#2
0
        public HtmlDocument QueryScripts(ScriptQuery query)
        {
            var queryNames = query.Scripts == null
                                                 ? new string[0]
                                                 : query.Scripts.Split(',').Select(x => x.Trim()).Distinct();



            var document = DiagnosticHtml.BuildDocument(_urls, "Script Graph Query");

            document.Push("div").AddClass("script-query");

            document.Push("form").Attr("action", _urls.UrlFor <ScriptWriter>(x => x.QueryScripts(null), null));

            document.Add("b").Text("For requested script names (comma-delimited):  ");
            document.Add(new TextboxTag("Scripts", queryNames.Join(", ")).Id("script-names-text"));
            document.Add("br");
            document.Add("input").Attr("type", "submit").Value("Query");
            document.Pop();



            if (queryNames.Any())
            {
                document.Add("hr");
                document.Add("b").Text("Results");
                document.Push("ul");

                var actuals = _assets.GetAssets(queryNames);
                actuals.Each(script => document.Push("li").Text(script.Name));
            }

            document.Pop();

            return(document);
        }
        public void read_a_directory()
        {
            new FileSystem().WriteStringToFile("something.script.config",
                                               @"
jquery is jquery.1.4.2.js
a includes b,c,d
");

            // This should be ignored
            new FileSystem().WriteStringToFile(FubuMvcPackageFacility.FubuContentFolder.AppendPath("wrong.script.config"),
                                               @"
a includes e,f,g
");

            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");
        }
示例#4
0
 public void FetchList(string[] names)
 {
     _scripts = _graph.GetAssets(names);
 }