예제 #1
0
        public void Publish(Article article)
        {
            Console.WriteLine("Publishing");
            _publisher.PublishOnline(article);

            Console.WriteLine("Archiving");
            _archiver.Archive(article);

            Console.WriteLine("Notifying");
            _notifier.Notify(article);
        }
예제 #2
0
        public void Publish(Article article)
        {
            Console.WriteLine("Publishing");
            _publisher.PublishOnline(article);

            Console.WriteLine("Archiving");
            _archiver.Archive(article);

            var people = _peopleRepository.All();

            Console.WriteLine("Notifying");
            _notifier.Notify(article, people);
        }
예제 #3
0
        protected override async Task Run(TestBuild job)
        {
            var build   = job;
            var project = build.Project;

            var puller = _pullers.FirstOrDefault(z => z.CanPull(project.RepoPathOrUrl));

            if (puller == null)
            {
                throw new NotSupportedException("no puller for this project");
            }

            Trace.TraceInformation("Start TestBuild {0}", build);

            //pull
            Trace.TraceInformation("Pull Source Code for {0} from {1}", project, project.RepoPathOrUrl);
            await puller.Pull(project.RepoPathOrUrl, project.SrcDir);

            //build
            Trace.TraceInformation("Build Source Code for {0} to output {1}", project, project.BuildOutputPath);
            await _builder.Build(project.BuildScript, project.SrcDir);

            //archive
            Trace.TraceInformation("Archive Build for {0} to {1}", project, build.LocalPath);
            await _archiver.Archive(project.BuildOutputDir, build.LocalPath);

            var driver = _drivers.FirstOrDefault(z => z.Name.Equals(project.DriverName, StringComparison.OrdinalIgnoreCase));

            if (driver == null)
            {
                throw new NotSupportedException("no driver for this project");
            }

            //publish
            var tests = (await driver.Publish(build)).ToList();
            var toDel = project.Cases.Actives().ExceptBy(tests, z => z.FullName).ToList();
            var toAdd = tests.ExceptBy(project.Cases, z => z.FullName).ToList();

            var toUpdate = (from le in project.Cases
                            join re in tests
                            on le.FullName equals re.FullName
                            select new { le, re }).ToList();

            toUpdate.ForEach(z =>
            {
                z.le.Keyword = z.re.Keyword;
            });

            toAdd.ForEach(z => project.Cases.Add(z));

            toDel.ForEach(z =>
            {
                z.Plans.Clear();

                z.Archive();
            });

            await Uow.CommitAsync();

            Trace.TraceInformation("Complete TestBuild {0} with {1} TestCases published as {2} added, {3} updated, {4} deleted", build, tests.Count, toAdd.Count, toUpdate.Count, toDel.Count);
        }
예제 #4
0
 public ArchiverStage(string rootPath, string archiveFilename, IArchiver archiver, CancellationToken cancellationToken)
     : base(rootPath, Archiving, ArchivingType, cancellationToken, pc => archiver.Archive(rootPath, archiveFilename, cancellationToken, pc))
 {
 }
예제 #5
0
 public ArchiverStage(string rootPath, string archiveFilename, IArchiver archiver, CancellationToken cancellationToken)
     : base(rootPath, Archiving, ArchivingType, cancellationToken, pc => archiver.Archive(rootPath, archiveFilename, cancellationToken, pc))
 {
 }