예제 #1
0
        private static void startTheEnvironment(IList <LogEntry> list, IEnvironment environment, params Action <IInstaller, IPackageLog>[] actions)
        {
            var log = new PackageRegistryLog();

            try
            {
                var installers = environment.StartUp(log);

                // This needs to happen regardless, but we want these logs put in before
                // logs for the installers, so we don't do it in the finally{}
                AddPackagingLogEntries(list);

                executeInstallers(list, installers, actions);
            }
            catch (Exception ex)
            {
                AddPackagingLogEntries(list);
                log.MarkFailure(ex.ToString());
            }
            finally
            {
                list.Add(LogEntry.FromPackageLog(environment, log));
                environment.SafeDispose();
            }
        }
예제 #2
0
        private static void startTheEnvironment(IList<LogEntry> list, IEnvironment environment, params Action<IInstaller, IPackageLog>[] actions)
        {
            var log = new PackageRegistryLog();

            try
            {
                var installers = environment.StartUp(log);

                // This needs to happen regardless, but we want these logs put in before
                // logs for the installers, so we don't do it in the finally{}
                AddPackagingLogEntries(list);

                executeInstallers(list, installers, actions);

            }
            catch (Exception ex)
            {
                AddPackagingLogEntries(list);
                log.MarkFailure(ex.ToString());
            }
            finally
            {
                list.Add(LogEntry.FromPackageLog(environment, log));
                environment.SafeDispose();
            }
        }
예제 #3
0
파일: LogEntry.cs 프로젝트: Memmo/fubumvc
 public static LogEntry FromPackageLog(object target, PackageRegistryLog log)
 {
     return new LogEntry(){
         Description = target.ToString(),
         Success = log.Success,
         TraceText = log.FullTraceText().Trim(),
         TimeInMilliseconds = log.TimeInMilliseconds
     };
 }
        public void SetUp()
        {
            Directory.GetFiles(".", "*.script.config").Each(x => File.Delete(x));


            scripts   = new ScriptGraph();
            activator = new ScriptGraphConfigurationActivator(scripts, new FileSystem());

            log = new PackageRegistryLog();
        }
예제 #5
0
 public static LogEntry FromPackageLog(object target, PackageRegistryLog log)
 {
     return(new LogEntry()
     {
         Description = target.ToString(),
         Success = log.Success,
         TraceText = log.FullTraceText().Trim(),
         TimeInMilliseconds = log.TimeInMilliseconds
     });
 }
예제 #6
0
        public void from_package_log_successful()
        {
            var packageLog = new PackageRegistryLog();
            packageLog.Trace("some stuff");
            packageLog.Success.ShouldBeTrue();

            var log = LogEntry.FromPackageLog(this, packageLog);
            log.Success.ShouldBeTrue();
            log.TraceText.ShouldEqual(packageLog.FullTraceText().Trim());
            log.Description.ShouldEqual(this.ToString());
        }
        public void write_trace()
        {
            var log = new PackageRegistryLog();
            log.FullTraceText().ShouldBeEmpty();

            log.Trace("stuff");
            log.Trace("other");
            log.Trace("new");

            log.FullTraceText().ShouldContain("stuff");
            log.FullTraceText().ShouldContain("other");
            log.FullTraceText().ShouldContain("new");
        }
예제 #8
0
        public void from_package_log_successful()
        {
            var packageLog = new PackageRegistryLog();

            packageLog.Trace("some stuff");
            packageLog.Success.ShouldBeTrue();

            var log = LogEntry.FromPackageLog(this, packageLog);

            log.Success.ShouldBeTrue();
            log.TraceText.ShouldEqual(packageLog.FullTraceText().Trim());
            log.Description.ShouldEqual(this.ToString());
        }
예제 #9
0
        public void write_trace()
        {
            var log = new PackageRegistryLog();

            log.FullTraceText().ShouldBeEmpty();

            log.Trace("stuff");
            log.Trace("other");
            log.Trace("new");

            log.FullTraceText().ShouldContain("stuff");
            log.FullTraceText().ShouldContain("other");
            log.FullTraceText().ShouldContain("new");
        }
        public void find_children()
        {
            var log = new PackageRegistryLog();

            var loader1 = new StubPackageLoader();
            var loader2 = new StubPackageLoader();
            var loader3 = new StubPackageLoader();

            var package1 = new StubPackage("1");
            var package2 = new StubPackage("2");
            var package3 = new StubPackage("3");

            log.AddChild(loader1, loader2, loader3, package1, package2, package3);

            log.FindChildren<IPackageLoader>().ShouldHaveTheSameElementsAs(loader1, loader2, loader3);

            log.FindChildren<IPackageInfo>().ShouldHaveTheSameElementsAs(package1, package2, package3);
        }
예제 #11
0
        public void find_children()
        {
            var log = new PackageRegistryLog();

            var loader1 = new StubPackageLoader();
            var loader2 = new StubPackageLoader();
            var loader3 = new StubPackageLoader();

            var package1 = new StubPackage("1");
            var package2 = new StubPackage("2");
            var package3 = new StubPackage("3");

            log.AddChild(loader1, loader2, loader3, package1, package2, package3);

            log.FindChildren <IPackageLoader>().ShouldHaveTheSameElementsAs(loader1, loader2, loader3);

            log.FindChildren <IPackageInfo>().ShouldHaveTheSameElementsAs(package1, package2, package3);
        }
예제 #12
0
        private static void executeInstallers(IList <LogEntry> list, IEnumerable <IInstaller> installers, IEnumerable <Action <IInstaller, IPackageLog> > actions)
        {
            foreach (var action in actions)
            {
                foreach (var installer in installers)
                {
                    var log = new PackageRegistryLog();
                    try
                    {
                        action(installer, log);
                    }
                    catch (Exception e)
                    {
                        log.MarkFailure(e.ToString());
                    }

                    list.Add(installer, log);
                }
            }
        }
예제 #13
0
        private static void executeInstallers(IList<LogEntry> list, IEnumerable<IInstaller> installers, IEnumerable<Action<IInstaller, IPackageLog>> actions)
        {
            foreach (var action in actions)
            {
                foreach (var installer in installers)
                {
                    var log = new PackageRegistryLog();
                    try
                    {
                        action(installer, log);
                    }
                    catch (Exception e)
                    {
                        log.MarkFailure(e.ToString());
                    }

                    list.Add(installer, log);
                }
            }
        }
        public void SetUp()
        {
            Directory.GetFiles(".", "*.script.config").Each(x => File.Delete(x));

            scripts = new ScriptGraph();
            activator = new ScriptGraphConfigurationActivator(scripts, new FileSystem());

            log = new PackageRegistryLog();
        }
 public static void Add(this IList<LogEntry> list, object target, PackageRegistryLog log)
 {
     list.Add(LogEntry.FromPackageLog(target, log));
 }
예제 #16
0
 public static void Add(this IList <LogEntry> list, object target, PackageRegistryLog log)
 {
     list.Add(LogEntry.FromPackageLog(target, log));
 }