public Categories() { Dependencies.AddRange(new[] { nameof(Posts), }); ProcessModules = new ModuleList { new ReplaceDocuments(nameof(Posts)), new GroupDocuments(CustomKeys.Category), new FilterDocuments(Config.FromDocument(doc => !string.IsNullOrEmpty(doc.GetString(Keys.GroupKey)))), new ForEachDocument( new SetMetadata(CustomKeys.CategoryPosts, Config.FromDocument(doc => doc.GetChildren())), new SetMetadata(CustomKeys.Title, Config.FromDocument(doc => doc.GetString(Keys.GroupKey))), new SetMetadata(CustomKeys.Subtitle, Config.FromDocument(doc => $"Pokémon attrapés avec la méthode <strong>‘{doc.GetString(Keys.GroupKey)}’</strong>")), new SetMetadata(CustomKeys.WritePath, Config.FromDocument(doc => $"categories/{doc.GetString(Keys.GroupKey).Slugify()}/index.html")) ), new RenderRazor().WithLayout((NormalizedPath)"/_Category.cshtml"), new SetDestination(Config.FromDocument(doc => (NormalizedPath)doc.GetString(CustomKeys.WritePath))) }; OutputModules = new ModuleList { new WriteFiles() }; }
public NewsFeed() { Dependencies.AddRange( nameof(Blogs.Posts), nameof(Broadcasts.Episodes)); ProcessModules = new ModuleList { new ReplaceDocuments( nameof(Blogs.Posts), nameof(Broadcasts.Episodes)), new FilterDocuments(Config.FromDocument(doc => doc.Get <FeedItem>("FeedItems").Recent)), new OrderDocuments(Config.FromDocument(doc => doc.Get <FeedItem>("FeedItems").Published)).Descending(), new GenerateFeeds() .WithAtomPath("feeds/news.atom") .WithRssPath("feeds/news.rss") .WithFeedTitle("Recent News From Discover .NET") .WithFeedDescription("A roundup of recent blog posts, podcasts, and more.") .WithItemTitle(Config.FromDocument(doc => doc.Get <FeedItem>("FeedItems").Title)) .WithItemDescription(Config.FromDocument(doc => doc.Get <FeedItem>("FeedItems").Description)) .WithItemPublished(Config.FromDocument(doc => (DateTime?)doc.Get <FeedItem>("FeedItems").Published.DateTime)) .WithItemLink(Config.FromDocument(doc => TypeHelper.Convert <Uri>(doc.Get <FeedItem>("FeedItems").Link))) .WithItemId(Config.FromDocument(doc => TypeHelper.Convert <Uri>(doc.Get <FeedItem>("FeedItems").Link).ToString())) .WithItemAuthor(Config.FromDocument(doc => doc.Get <FeedItem>("FeedItems").Author ?? doc.GetString("Author") ?? doc.GetString("Title"))) .WithItemImageLink(null) }; OutputModules = new ModuleList { new WriteFiles() }; }
public SocialImages() { Dependencies.AddRange(nameof(Inputs)); ProcessModules = new ModuleList { new GetPipelineDocuments(ContentType.Content), // Filter to non-archive content new FilterDocuments(Config.FromDocument(doc => !Archives.IsArchive(doc))), // Process the content new CacheDocuments { new AddTitle(), new SetDestination(true), new ExecuteIf(Config.FromSetting(WebKeys.OptimizeContentFileNames, true)) { new OptimizeFileName() }, new GenerateSocialImage(), } }; OutputModules = new ModuleList { new WriteFiles() }; }
public Sitemap() { Dependencies.AddRange( nameof(Content), nameof(Data), nameof(Archives)); PostProcessModules = new ModuleList { new ExecuteIf(Config.FromSetting <bool>(WebKeys.GenerateSitemap)) { new ConcatDocuments(nameof(Content)) { new FilterDocuments(Config.FromDocument(WebKeys.ShouldOutput, true)) }, new ConcatDocuments(nameof(Data)) { new FilterDocuments(Config.FromDocument <bool>(WebKeys.ShouldOutput)) }, new ConcatDocuments(nameof(Archives)), new FlattenTree(), new FilterDocuments(Config.FromDocument(doc => !doc.GetBool(Keys.TreePlaceholder))), new GenerateSitemap() } }; OutputModules = new ModuleList { new WriteFiles() }; }
public HomePipeline(IDeliveryClient deliveryClient) { Dependencies.AddRange(nameof(PostsPipeline), nameof(HomepagePipeline), nameof(SiteMetadataPipeline)); ProcessModules = new ModuleList( // pull documents from other pipelines new ReplaceDocuments(nameof(PostsPipeline)), new PaginateDocuments(4), new SetDestination(Config.FromDocument((doc, ctx) => Filename(doc))), new MergeContent(new ReadFiles("Index.cshtml")), new RenderRazor() .WithModel(Config.FromDocument((document, context) => { var model = new HomeViewModel(document.AsPagedKontent <Article>(), new SidebarViewModel( context.Outputs.FromPipeline(nameof(HomepagePipeline)).Select(x => x.AsKontent <Homepage>()).FirstOrDefault(), context.Outputs.FromPipeline(nameof(SiteMetadataPipeline)).Select(x => x.AsKontent <SiteMetadata>()).FirstOrDefault(), true, "/")); return(model); } )), new KontentImageProcessor() ); OutputModules = new ModuleList { new WriteFiles(), }; }
public SitemapPipeline() { Dependencies.AddRange(nameof(HomePipeline), nameof(PortfolioPages), nameof(ResumePages)); ProcessModules = new ModuleList { new ReplaceDocuments(Dependencies.ToArray()), new SetMetadata(Keys.SitemapItem, Config.FromDocument((doc, _) => { var siteMapItem = new SitemapItem(doc.Destination.FullPath) { LastModUtc = doc.Get <DateTime?>(ContentfulKeys.System.UpdatedAt, null) }; if (!siteMapItem.LastModUtc.HasValue) { siteMapItem.LastModUtc = DateTime.UtcNow; siteMapItem.ChangeFrequency = SitemapChangeFrequency.Weekly; } else { siteMapItem.ChangeFrequency = SitemapChangeFrequency.Monthly; } return(siteMapItem); })), new GenerateSitemap(), }; OutputModules = new ModuleList { new WriteFiles(), }; }
/// <summary> /// Runs the plugin manager, by loading all dependencies, plugins, configs and then enables all plugins. /// </summary> /// <param name="dependencies">The dependencies that could have been loaded by Exiled.Bootstrap.</param> public static void Run(Assembly[] dependencies = null) { if (dependencies?.Length > 0) { Dependencies.AddRange(dependencies); } LoadDependencies(); LoadPlugins(); ConfigManager.Reload(); TranslationManager.Reload(); EnablePlugins(); BuildInfoCommand.ModDescription = string.Join( "\n", AppDomain.CurrentDomain.GetAssemblies() .Where(a => a.FullName.StartsWith("Exiled.", StringComparison.OrdinalIgnoreCase)) .Select(a => $"{a.GetName().Name} - Version {a.GetName().Version.ToString(3)}")); ServerConsole.AddLog( @"Welcome to ▄████████ ▀████ ▐████▀ ▄█ ▄█ ▄████████ ████████▄ ███ ███ ███▌ ████▀ ███ ███ ███ ███ ███ ▀███ ███ █▀ ███ ▐███ ███▌ ███ ███ █▀ ███ ███ ▄███▄▄▄ ▀███▄███▀ ███▌ ███ ▄███▄▄▄ ███ ███ ▀▀███▀▀▀ ████▀██▄ ███▌ ███ ▀▀███▀▀▀ ███ ███ ███ █▄ ▐███ ▀███ ███ ███ ███ █▄ ███ ███ ███ ███ ▄███ ███▄ ███ ███▌ ▄ ███ ███ ███ ▄███ ██████████ ████ ███▄ █▀ █████▄▄██ ██████████ ████████▀ ▀ ", ConsoleColor.Green); }
public PagesPipeline(IDeliveryClient deliveryClient) { Dependencies.AddRange(nameof(HomepagePipeline), nameof(SiteMetadataPipeline)); InputModules = new ModuleList { new Kontent <Page>(deliveryClient) .WithQuery(new IncludeTotalCountParameter(), new NotEmptyFilter("elements.body")), new SetDestination(Config.FromDocument((doc, ctx) => new NormalizedPath($"pages/{doc.AsKontent<Page>().Url}/index.html"))), }; ProcessModules = new ModuleList { new MergeContent(new ReadFiles(patterns: "Index.cshtml")), new RenderRazor() .WithModel(Config.FromDocument((document, context) => { var menuItem = document.AsKontent <Page>(); var model = new HomeViewModel(menuItem, new SidebarViewModel( context.Outputs.FromPipeline(nameof(HomepagePipeline)).Select(x => x.AsKontent <Homepage>()).FirstOrDefault(), context.Outputs.FromPipeline(nameof(SiteMetadataPipeline)).Select(x => x.AsKontent <SiteMetadata>()).FirstOrDefault(), false, menuItem.Url)); return(model); } ))/*, * new KontentImageProcessor()*/ }; OutputModules = new ModuleList { new WriteFiles(), }; }
public HomePipeline() { Dependencies.AddRange(nameof(BookPipeline), nameof(RatingPipeline), nameof(AuthorPipeline), nameof(ContactPipeline)); InputModules = new ModuleList { new ReadFiles("index.cshtml") }; ProcessModules = new ModuleList { new RenderRazor().WithModel(Config.FromDocument((doc, context) => { var allBooks = XperienceDocumentConverter.ToTreeNodes <Book>(context.Outputs.FromPipeline(nameof(BookPipeline))); var allAuthors = XperienceDocumentConverter.ToTreeNodes <Author>(context.Outputs.FromPipeline(nameof(AuthorPipeline))); var allRatings = XperienceDocumentConverter.ToCustomTableItems <RatingsItem>(context.Outputs.FromPipeline(nameof(RatingPipeline)), RatingsItem.CLASS_NAME); var contactInfo = XperienceDocumentConverter.ToTreeNodes <ContactUs>(context.Outputs.FromPipeline(nameof(ContactPipeline))).FirstOrDefault(); var booksWithReviews = allBooks.Select(b => new BookWithReviews(b, allRatings)); var authorsWithBooks = allAuthors.Select(a => new AuthorWithBooks(a, booksWithReviews)); return(new HomeViewModel() { Authors = authorsWithBooks, Books = booksWithReviews, ContactInfo = contactInfo }); })), new SetDestination(Config.FromDocument((doc, ctx) => { return(new NormalizedPath("index.html")); })) }; OutputModules = new ModuleList { new WriteFiles() }; }
protected override void InitializeDependencies() { Dependencies.AddRange(programs); if (!Context.Instance.NoMingwW64) { Dependencies.Add(mingw); } }
public ModuleManifest(string name, string description, string token, params Dependency[] deps) { Name = name; Description = description; Token = token; Version = Assembly.GetExecutingAssembly().GetName().Version; Dependencies.AddRange(deps); }
public PipDetails(CachedGraph graph, Pip pip) : base(graph.Context, pip) { LongDescription = pip.GetDescription(graph.Context); Tags.AddRange(pip.Tags.Select(tag => new TagRef(graph.Context, tag))); Dependencies.AddRange(GetPipRefs(graph.Context, graph.PipGraph.RetrievePipImmediateDependencies(pip))); Dependents.AddRange(GetPipRefs(graph.Context, graph.PipGraph.RetrievePipImmediateDependents(pip))); }
protected override void InitializeDependencies() { Dependencies.AddRange(commonPackages); if (!Is64Bit) { Dependencies.AddRange(commonPackages64bit); } }
public IntersectionPoint(Point hintPoint, IList <IFigure> dependencies) { Dependencies.AddRange(dependencies); var figure1 = Dependencies.ElementAt(0); var figure2 = Dependencies.ElementAt(1); Algorithm = DoubleDispatchIntersectionAlgorithm(figure1, figure2, hintPoint); }
/// <summary> /// Transfers attributes from another <see cref="Element"/> object to this one. /// Existing values are not replaced. Provides an inheritance-like relation. /// </summary> /// <param name="parent">The object to take the attributes from.</param> internal void InheritFrom([NotNull] Element parent) { #region Sanity checks if (parent == null) { throw new ArgumentNullException(nameof(parent)); } #endregion // Check if values are unset and need inheritance) if (Version == null) { Version = parent.Version; } if (VersionModifier == null) { VersionModifier = parent.VersionModifier; } if (Released == default(DateTime)) { Released = parent.Released; } if (Main == null) { Main = parent.Main; } if (SelfTest == null) { SelfTest = parent.SelfTest; } if (DocDir == null) { DocDir = parent.DocDir; } if (License == null) { License = parent.License; } if (Stability == Stability.Unset) { Stability = parent.Stability; } if (Languages.Count == 0) { Languages = new LanguageSet(parent.Languages); } if (Architecture == default(Architecture)) { Architecture = parent.Architecture; } // Accumulate list entries Commands.AddRange(parent.Commands); Dependencies.AddRange(parent.Dependencies); Restrictions.AddRange(parent.Restrictions); Bindings.AddRange(parent.Bindings); }
public ResourceDefinition SetDependencies(params string[] dependencies) { if (Dependencies == null) { Dependencies = new List <string>(); } Dependencies.AddRange(dependencies); return(this); }
public Content(Templates templates) { Dependencies.AddRange(nameof(Data), nameof(DirectoryMetadata)); InputModules = new ModuleList { new ReadFiles(Config.FromSetting <IEnumerable <string> >(WebKeys.ContentFiles)) }; ProcessModules = new ModuleList { // Concat all documents from externally declared dependencies (exclude explicit dependencies above like "Data") new ConcatDocuments(Config.FromContext <IEnumerable <IDocument> >(ctx => ctx.Outputs.FromPipelines(ctx.Pipeline.GetAllDependencies(ctx).Except(Dependencies).ToArray()))), // Apply directory metadata new ApplyDirectoryMetadata(), // Process front matter and sidecar files new ProcessMetadata(), // Filter out excluded documents new FilterDocuments(Config.FromDocument(doc => !doc.GetBool(WebKeys.Excluded))), // Filter out archive documents (they'll get processed by the Archives pipeline) new FilterDocuments(Config.FromDocument(doc => !Archives.IsArchive(doc))), new EnumerateValues(), new AddTitle(), new SetDestination(".html"), new ExecuteIf(Config.FromSetting(WebKeys.OptimizeContentFileNames, true)) { new OptimizeFileName() }, new RenderProcessTemplates(templates), new GenerateExcerpt(), // Note that if the document was .cshtml the except might contain Razor instructions or might not work at all new GatherHeadings(), new OrderDocuments(), new CreateTree().WithNesting(true, true) }; PostProcessModules = new ModuleList { new FlattenTree(), new FilterDocuments(Config.FromDocument(doc => !doc.GetBool(Keys.TreePlaceholder))), // Don't render placeholder pages new RenderPostProcessTemplates(templates) }; OutputModules = new ModuleList { new FilterDocuments(Config.FromDocument(WebKeys.ShouldOutput, true)), new WriteFiles() }; }
protected override void InitializeDependencies() { base.InitializeDependencies(); if (DebianRelease.Major >= 10 || (IsTesting && String.Compare("buster", CodeName, StringComparison.OrdinalIgnoreCase) == 0)) { Dependencies.AddRange(packages10AndNewer); } else { Dependencies.AddRange(packagesPre10); } }
public DownloadImagesPipeline() { Dependencies.AddRange(nameof(PostsPipeline), nameof(HomePipeline)); PostProcessModules = new ModuleList( // pull documents from other pipelines new ReplaceDocuments(Dependencies.ToArray()), new KontentDownloadImages() ); OutputModules = new ModuleList( new WriteFiles() ); }
public HomePipeline(IStringLocalizer <SharedResource> localizer) { Dependencies.AddRange(nameof(LoadSiteMetadata), nameof(LoadNavigation), nameof(LoadPages)); ProcessModules = new ModuleList { new ReplaceDocuments(nameof(LoadPages)), new FilterDocuments(Config.FromDocument(x => x.AsContentful <Page>().Slug == PageSlugs[x.GetString(RodriBusKeys.Locale)])), new MergeContent(new ReadFiles(patterns: HomeView)), new ExtractFrontMatter(GetFrontMatterModules()), new RenderRazor() .WithModel(Config.FromDocument((document, context) => { var locale = document.GetString(RodriBusKeys.Locale); var page = document.AsContentful <Page>(); var metadata = context.Outputs.FromPipeline(nameof(LoadSiteMetadata)) .Where(d => d.GetString(RodriBusKeys.Locale) == locale) .Select(x => x.AsContentful <SiteMetadata>()) .FirstOrDefault(); var navigation = context.Outputs.FromPipeline(nameof(LoadNavigation)) .Where(d => d.GetString(RodriBusKeys.Locale) == locale) .Select(x => x.AsContentful <Navigation>()) .FirstOrDefault(); var str = metadata.Author.RenderBioAsync().Result; return(new HomeViewModel(page, metadata, navigation, localizer, locale)); } )), new SetDestination(Config.FromDocument(doc => { var path = HomePage; var locale = doc.GetString(RodriBusKeys.Locale); var pathStart = Locales.GetPath(locale); if (!string.IsNullOrEmpty(pathStart)) { path = $"{pathStart}/{path}"; } return(new NormalizedPath(path)); })), }; OutputModules = new ModuleList { new ExecuteIf(Config.FromSetting(RodriBusKeys.MinifyPages, true), new MinifyHtml()) .Else(new BeautifyHtml()), new WriteFiles(), }; }
private bool AddDependenciesIfMatches(string path, Dependency dependency) { var dependencyManifest = Get(path); if (dependencyManifest.IsValid && dependencyManifest.PackageName.Equals(dependency.Name, StringComparison.InvariantCultureIgnoreCase)) { Dependencies.AddRange(dependencyManifest.Dependencies); Dependencies.Add(path); dependencyManifest.IsDependency = true; return(true); } return(false); }
protected override bool InitOS() { if (!base.InitOS()) { return(false); } if (NeedLibtool) { Dependencies.AddRange(libtoolPackages); } return(true); }
public virtual ManifestModuleInfo LoadFromExternalManifest(ExternalModuleManifest manifest, ExternalModuleManifestVersion version) { if (manifest == null) { throw new ArgumentNullException(nameof(manifest)); } ModuleName = manifest.Id; if (version.Dependencies != null) { foreach (var dependency in version.Dependencies) { DependsOn.Add(dependency.Id); } } Id = manifest.Id; Version = version.SemanticVersion; VersionTag = version.VersionTag; PlatformVersion = version.PlatformSemanticVersion; ReleaseNotes = version.ReleaseNotes; Ref = version.PackageUrl; if (version.Dependencies != null) { Dependencies.AddRange(version.Dependencies.Select(x => new ModuleIdentity(x.Id, SemanticVersion.Parse(x.Version)))); } if (version.Incompatibilities != null) { Incompatibilities.AddRange(version.Incompatibilities.Select(x => new ModuleIdentity(x.Id, SemanticVersion.Parse(x.Version)))); } Title = manifest.Title; Description = manifest.Description; Authors = manifest.Authors; Owners = manifest.Owners; LicenseUrl = manifest.LicenseUrl; ProjectUrl = manifest.ProjectUrl; IconUrl = manifest.IconUrl; RequireLicenseAcceptance = manifest.RequireLicenseAcceptance; Copyright = manifest.Copyright; Tags = manifest.Tags; Identity = new ModuleIdentity(Id, Version); if (manifest.Groups != null) { Groups.AddRange(manifest.Groups); } return(this); }
public Publish() { ExecutionPolicy = ExecutionPolicy.Manual; Deployment = true; Dependencies.AddRange(nameof(Pack), nameof(Zip)); OutputModules = new ModuleList { new ThrowException(Config.FromSettings(settings => settings.ContainsKey("NUGET_KEY") ? null : "The setting NUGET_KEY is required")), new ThrowException(Config.FromSettings(settings => settings.ContainsKey("GITHUB_TOKEN") ? null : "The setting GITHUB_TOKEN is required")), new ExecuteModules { new ReadFiles(Config.FromContext(ctx => $"{ctx.FileSystem.GetOutputDirectory("packages")}/*.nupkg")), new StartProcess("dotnet") .WithArgument("nuget") .WithArgument("push") .WithArgument("--api-key", Config.FromSetting <string>("NUGET_KEY")) .WithArgument("--source", "https://api.nuget.org/v3/index.json", true) .WithArgument(Config.FromDocument(doc => doc.Source.FullPath), true) .WithSequentialExecution() .LogOutput() }, new ExecuteModules { new ReadFiles(Config.FromContext(ctx => $"{ctx.FileSystem.GetOutputDirectory("zip")}/*.zip")), new ExecuteConfig(Config.FromContext(async ctx => { GitHubClient github = new GitHubClient(new ProductHeaderValue(nameof(NetlifySharp))); github.Credentials = new Credentials(ctx.GetString("GITHUB_TOKEN")); Release release = github.Repository.Release.Create("daveaglick", "NetlifySharp", new NewRelease(ctx.GetString(BuildVersion)) { Name = ctx.GetString(BuildVersion), Body = string.Join(Environment.NewLine, ctx.GetString(ReleaseNotes)), TargetCommitish = "master" }).Result; foreach (IDocument input in ctx.Inputs) { using (Stream stream = input.GetContentStream()) { await github.Repository.Release.UploadAsset( release, new ReleaseAssetUpload(input.Source.FileName.FullPath, "application/zip", stream, null)); } } })) } }; }
public SearchIndex() { Dependencies.AddRange(nameof(Posts)); PostProcessModules = new ModuleList( // pull documents from other pipelines new ReplaceDocuments(Dependencies.ToArray()), new LunrIndexer(), new AppendContent(Config.FromContext(ctx => ctx.FileSystem.GetInputFile("assets/js/lunrsearchengine.js").ReadAllTextAsync())), new SetDestination("assets/js/lunrsearchengine.js") ); OutputModules = new ModuleList( new WriteFiles() ); }
protected override void InitializeDependencies() { base.InitializeDependencies(); if (DebianRelease.Major >= 10 || (IsTesting && String.Compare("buster", CodeName, StringComparison.OrdinalIgnoreCase) == 0)) { if (Context.IsRunningOnHostedAzureAgent) { Dependencies.AddRange(packages10AndNewerBuildBots); } } else { Dependencies.AddRange(packagesPre10); } }
public LinkValidation() { Deployment = true; ExecutionPolicy = ExecutionPolicy.Normal; Dependencies.AddRange(nameof(Content), nameof(Archives)); OutputModules = new ModuleList { new ReplaceDocuments(Dependencies.ToArray()), new ValidateLinks() .ValidateRelativeLinks(Config.FromSetting(WebKeys.ValidateRelativeLinks, true)) .ValidateAbsoluteLinks(Config.FromSetting <bool>(WebKeys.ValidateAbsoluteLinks)) .AsError(Config.FromSetting <bool>(WebKeys.ValidateLinksAsError)) }; }
protected override void InitializeDependencies() { base.InitializeDependencies(); if (UbuntuRelease.Major < 18 || (UbuntuRelease.Major == 18 && UbuntuRelease.Minor < 10)) { Dependencies.AddRange(preCosmicPackages); } else { Dependencies.AddRange(cosmicPackages); if (UbuntuRelease.Major < 19) { Dependencies.AddRange(preDiscoPackages); } } }
/// <summary> /// Runs the plugin manager, by loading all dependencies, plugins, configs and then enables all plugins. /// </summary> /// <param name="dependencies">The dependencies that could have been loaded by Exiled.Bootstrap.</param> public static void Run(Assembly[] dependencies = null) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? CheckUAC() : geteuid() == 0) { ServerConsole.AddLog("YOU ARE RUNNING THE SERVER AS ROOT / ADMINISTRATOR. THIS IS HIGHLY UNRECOMMENDED. PLEASE INSTALL YOUR SERVER AS A NON-ROOT/ADMIN USER.", ConsoleColor.Red); Thread.Sleep(5000); } if (dependencies?.Length > 0) { Dependencies.AddRange(dependencies); } LoadDependencies(); LoadPlugins(); ConfigManager.Reload(); TranslationManager.Reload(); if (!Config.IsEnabled) { Log.Warn("Loading EXILED has been disabled in a config. No plugins will be enabled."); return; } EnablePlugins(); BuildInfoCommand.ModDescription = string.Join( "\n", AppDomain.CurrentDomain.GetAssemblies() .Where(a => a.FullName.StartsWith("Exiled.", StringComparison.OrdinalIgnoreCase)) .Select(a => $"{a.GetName().Name} - Version {a.GetName().Version.ToString(3)}")); ServerConsole.AddLog( @"Welcome to ▄████████ ▀████ ▐████▀ ▄█ ▄█ ▄████████ ████████▄ ███ ███ ███▌ ████▀ ███ ███ ███ ███ ███ ▀███ ███ █▀ ███ ▐███ ███▌ ███ ███ █▀ ███ ███ ▄███▄▄▄ ▀███▄███▀ ███▌ ███ ▄███▄▄▄ ███ ███ ▀▀███▀▀▀ ████▀██▄ ███▌ ███ ▀▀███▀▀▀ ███ ███ ███ █▄ ▐███ ▀███ ███ ███ ███ █▄ ███ ███ ███ ███ ▄███ ███▄ ███ ███▌ ▄ ███ ███ ███ ▄███ ██████████ ████ ███▄ █▀ █████▄▄██ ██████████ ████████▀ ▀ ", ConsoleColor.Green); }
public NewsFeed() { Dependencies.AddRange( nameof(Blogs.Posts), nameof(Broadcasts.Episodes)); ProcessModules = new ModuleList { new ReplaceDocuments( nameof(Blogs.Posts), nameof(Broadcasts.Episodes)), new ExecuteConfig(Config.FromDocument((doc, ctx) => { // Expand the feed items into documents (I.e. SelectMany) return(doc.Get <FeedItem[]>(SiteKeys.FeedItems) .Select(x => ctx.CreateDocument(new MetadataItems { { SiteKeys.FeedItem, x } }))); })), new FilterDocuments(Config.FromDocument(doc => doc.Get <FeedItem>(SiteKeys.FeedItem).Recent)), new OrderDocuments(Config.FromDocument(doc => doc.Get <FeedItem>(SiteKeys.FeedItem).Published)).Descending(), new GenerateFeeds() .WithAtomPath("feeds/news.atom") .WithRssPath("feeds/news.rss") .WithFeedTitle("Recent News From Discover .NET") .WithFeedDescription("A roundup of recent blog posts, podcasts, and more.") .WithItemTitle(Config.FromDocument(doc => doc.Get <FeedItem>(SiteKeys.FeedItem).Title)) .WithItemDescription(Config.FromDocument(doc => doc.Get <FeedItem>(SiteKeys.FeedItem).Description)) .WithItemPublished(Config.FromDocument(doc => (DateTime?)doc.Get <FeedItem>(SiteKeys.FeedItem).Published.DateTime)) .WithItemLink(Config.FromDocument(doc => TypeHelper.Convert <Uri>(doc.Get <FeedItem>(SiteKeys.FeedItem).Link))) .WithItemId(Config.FromDocument(doc => TypeHelper.Convert <Uri>(doc.Get <FeedItem>(SiteKeys.FeedItem).Link).ToString())) .WithItemAuthor(Config.FromDocument(doc => doc.Get <FeedItem>(SiteKeys.FeedItem).Author ?? doc.GetString(SiteKeys.Author) ?? doc.GetString(SiteKeys.Title))) .WithItemImageLink(null) }; OutputModules = new ModuleList { new WriteFiles() }; }