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(); } }
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(); } }
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(); }
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 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"); }
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); }
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); }
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); } } }
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 static void Add(this IList<LogEntry> list, object target, PackageRegistryLog log) { list.Add(LogEntry.FromPackageLog(target, log)); }
public static void Add(this IList <LogEntry> list, object target, PackageRegistryLog log) { list.Add(LogEntry.FromPackageLog(target, log)); }