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

            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();
            }
        }
Beispiel #2
0
        public void from_package_log_failure()
        {
            var packageLog = new PackageLog();
            packageLog.Trace("some stuff");
            packageLog.MarkFailure("it broke");
            packageLog.Success.ShouldBeFalse();

            var log = LogEntry.FromPackageLog(this, packageLog);
            log.Success.ShouldBeFalse();
            log.TraceText.ShouldEqual(packageLog.FullTraceText().Trim());
            log.Description.ShouldEqual(this.ToString());
        }
Beispiel #3
0
        public void from_package_log_failure()
        {
            var packageLog = new PackageLog();

            packageLog.Trace("some stuff");
            packageLog.MarkFailure("it broke");
            packageLog.Success.ShouldBeFalse();

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

            log.Success.ShouldBeFalse();
            log.TraceText.ShouldEqual(packageLog.FullTraceText().Trim());
            log.Description.ShouldEqual(this.ToString());
        }
        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 PackageLog();
                    try
                    {
                        action(installer, log);
                    }
                    catch (Exception e)
                    {
                        log.MarkFailure(e.ToString());
                    }

                    list.Add(installer, log);
                }
            }
        }
Beispiel #5
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 PackageLog();
                    try
                    {
                        action(installer, log);
                    }
                    catch (Exception e)
                    {
                        log.MarkFailure(e.ToString());
                    }

                    list.Add(installer, log);
                }
            }
        }
        private static void startTheEnvironment(IList<LogEntry> list, IEnvironment environment, params Action<IInstaller, IPackageLog>[] actions)
        {
            var log = new PackageLog();

            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();
            }
        }
Beispiel #7
0
        private void dispose()
        {
            if (_disposed) return;

            _disposed = true;

            var deactivators = _factory.GetAll<IDeactivator>().ToArray();
            var log = new PackageLog();

            deactivators.Each(x => {
                try
                {
                    log.Trace("Running " + x);
                    x.Deactivate(log);
                }
                catch (Exception e)
                {
                    log.MarkFailure(e);
                }
            });

            Facility.Shutdown();

            Console.WriteLine(log.FullTraceText());
        }