public static void LoadPackages(Action<IPackageFacility> configuration, bool runActivators = true)
        {
            _packages.Clear();

            Diagnostics = new PackagingDiagnostics();
            var record = new PackageLoadingRecord();

            Diagnostics.LogExecution(record, () =>
            {
                var facility = new PackageFacility();
                var assemblyLoader = new AssemblyLoader(Diagnostics);
                var graph = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

                var codeLocation = findCallToLoadPackages();
                graph.PushProvenance(codeLocation);
                configuration(facility);
                facility.Configure(graph);


                graph.PopProvenance();
                graph.DiscoverAndLoadPackages(() =>
                {
                    _assemblies.Clear();
                    _assemblies.AddRange(assemblyLoader.Assemblies);
                }, runActivators);
            });

            record.Finished = DateTime.Now;

            //_packages.Clear();


        }
Пример #2
0
        public static TableTag Write(LoggingSession session)
        {
            var table = new TableTag();

            table.AddClass("table");
            table.AddHeaderRow(r =>
            {
                r.Header("Description");
                r.Header("Provenance");
            });

            session.EachLog((target, log) =>
            {
                table.AddBodyRow(row =>
                {
                    row.Add("td", td =>
                    {
                        td.Append(new HtmlTag("h3").Text("Directive: " + PackagingDiagnostics.GetTypeName(target)));
                        td.Append(new HtmlTag("h5").Text("Desc: " + target.ToString()));
                        var time = new HtmlTag("h6").Text(log.TimeInMilliseconds.ToString() + "ms");
                        td.Append(time);
                    });

                    row.Cell(log.Provenance);
                });

                if (log.FullTraceText().IsNotEmpty())
                {
                    table.AddBodyRow(row =>
                    {
                        row.Cell().Attr("colspan", "2").AddClass("log").Add("pre").Text(log.FullTraceText());
                        if (!log.Success)
                        {
                            row.AddClass("failure");
                        }
                    });
                }
            });

            return(table);
        }
        /// <summary>
        /// The entry method into the bottles environment
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="runActivators"></param>
        public static void LoadPackages(Action<IPackageFacility> configuration, bool runActivators = true)
            //consider renaming to InitializeEnvironment
            //have it return an environment object.
        {
            _packages.Clear();

            Diagnostics = new PackagingDiagnostics();
            var record = new PackageLoadingRecord();

            Diagnostics.LogExecution(record, () =>
            {
                var facility = new PackageFacility();
                var assemblyLoader = new AssemblyLoader(Diagnostics);
                var graph = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

                var codeLocation = findCallToLoadPackages();
                graph.InProvenance(codeLocation, g =>
                {
                    //collect user configuration
                    configuration(facility);

                    //applies collected configurations
                    facility.Configure(g);
                });


                graph.DiscoverAndLoadPackages(() =>
                {
                    //clearing assemblies why? - my guess is testing.
                    // this should only really be called once.
                    _assemblies.Clear();

                    _assemblies.AddRange(assemblyLoader.Assemblies);
                    //the above assemblies are used when we need to resolve bottle assemblies
                }, runActivators);
            });

            record.Finished = DateTime.Now;
        }
Пример #4
0
        public static TableTag Write(LoggingSession session)
        {
            var table = new TableTag();

            table.AddHeaderRow(r =>
            {
                r.Header("Type");
                r.Header("Description");
                r.Header("Provenance");
                r.Header("Timing");
            });

            session.EachLog((target, log) =>
            {
                table.AddBodyRow(row =>
                {
                    row.Cell(PackagingDiagnostics.GetTypeName(target));
                    row.Cell(target.ToString());
                    row.Cell(log.Provenance);
                    row.Cell(log.TimeInMilliseconds.ToString()).AddClass("execution-time");
                });

                if (log.FullTraceText().IsNotEmpty())
                {
                    table.AddBodyRow(row =>
                    {
                        row.Cell().Attr("colspan", "4").Add("pre").AddClass("log").Text(log.FullTraceText());
                        if (!log.Success)
                        {
                            row.AddClass("failure");
                        }
                    });
                }
            });

            return(table);
        }
Пример #5
0
        public void SetUp()
        {
            diagnostics = new PackagingDiagnostics();

            loader = new StubPackageLoader("a", "b");
            package = new StubPackage("a");

            diagnostics.LogPackage(package, loader);
        }
Пример #6
0
        public void SetUp()
        {
            diagnostics = new PackagingDiagnostics();

            activator1 = new StubActivator();
            activator2 = new StubActivator();
            activator3 = new StubActivator();

            bootstrapper = new StubBootstrapper("Boot1", activator1, activator2, activator3);

            diagnostics.LogBootstrapperRun(bootstrapper, bootstrapper.Bootstrap(null));
        }
Пример #7
0
        public void SetUp()
        {
            diagnostics = new PackagingDiagnostics();
            package = new StubPackage("a");
            assembly = Assembly.GetExecutingAssembly();

            theProvenance = "from here";
            diagnostics.LogAssembly(package, assembly, theProvenance);
        }
Пример #8
0
 public void SetUp()
 {
     diagnostics = new PackagingDiagnostics();
 }
Пример #9
0
        public static void LoadPackages(Action<IPackageFacility> configuration)
        {
            _packages.Clear();

            var facility = new PackageFacility();
            Diagnostics = new PackagingDiagnostics();
            var assemblyLoader = new AssemblyLoader(Diagnostics);
            var graph = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

            var codeLocation = findCallToLoadPackages();
            graph.PushProvenance(codeLocation);
            configuration(facility);
            facility.As<IPackagingRuntimeGraphConfigurer>().Configure(graph);

            graph.PopProvenance();
            graph.DiscoverAndLoadPackages(() =>
                                          	{
                                          		_assemblies.Clear();
                                          		_assemblies.AddRange(assemblyLoader.Assemblies);
                                          	});
        }