Example #1
0
        public async Task Execute(CancellationToken cancellationToken = default)
        {
            using var _ = _logger.BeginScope(nameof(Execute));
            _logger.LogInformation("Executing pipeline");
            await CacheFileSystem.DeleteDir("content");

            await CacheFileSystem.GetOrCreateDirectory("content");

            await CacheFileSystem.DeleteDir("content-html");

            await CacheFileSystem.GetOrCreateDirectory("content-html");

            var outputPath = GetRootedPath(CurrentPath, Site.OutputPath);
            await FileSystem.CleanDirectory(outputPath);

            await FileSystem.GetOrCreateDirectory(outputPath);

            RawCache = await CacheFileSystem.Mount("content");

            PageCache = await CacheFileSystem.Mount("content-html");

            OutputFs = await FileSystem.Mount(outputPath);

            /* Aggregate content based on branches, tags and etc given in site definition */
            var aggregator = new ContentAggregator(
                Site,
                GitRoot,
                FileSystem,
                new MimeDbClassifier());

            var catalog = new Catalog();

            /* Add content */
            await catalog.Add(aggregator.Aggregate(cancellationToken), cancellationToken);

            /* Site */
            var site = await BuildSite(catalog, Site);

            /* UI */
            var ui = new UiBuilder(PageCache, OutputFs);
            await ui.BuildSite(site);

            _logger.LogInformation("Pipeline completed");
        }