public void CanLoadLayouts() { var path = Path.GetFullPath(@"data\layouts\"); var command = new LoadLayoutsCommand(path, null, null); var layouts = command.ExecuteAsync().Result; Assert.NotEmpty(command.Layouts); Assert.NotEmpty(layouts); }
private async Task<Site> LoadSite(SiteConfig config, IEnumerable<LastRunDocument> lastRunState, IEnumerable<string> renderedExtensions) { Site site; using (var capture = Statistics.Current.Start(StatisticTiming.LoadedSite)) { // Load layouts. LayoutFileCollection layouts; { var load = new LoadLayoutsCommand(config.LayoutsPath, config.AdditionalMetadataForFiles, config.IgnoreFiles); var loaded = await load.ExecuteAsync(); layouts = new LayoutFileCollection(loaded); } // Load data files. IEnumerable<DataFile> data; { var load = new LoadDataFilesCommand(config.DataPath, config.AdditionalMetadataForFiles, config.IgnoreFiles); data = await load.ExecuteAsync(); } // Load documents. IEnumerable<DocumentFile> documents; { var load = new LoadDocumentsCommand(); load.Author = config.Author; load.OutputRootPath = config.OutputPath; load.Layouts = layouts; load.RenderedExtensions = renderedExtensions; load.DefaultLayoutForExtension = config.DefaultLayoutForExtension; load.DocumentsPath = config.DocumentsPath; load.RootUrl = config.RootUrl; load.ApplicationUrl = config.Url; load.AdditionalMetadataForFiles = config.AdditionalMetadataForFiles; load.IgnoreFiles = config.IgnoreFiles; documents = await load.ExecuteAsync(); } // Load files. IEnumerable<StaticFile> files; { var load = new LoadFilesCommand(); load.OutputPath = config.OutputPath; load.FilesPath = config.FilesPath; load.RootUrl = config.RootUrl; load.Url = config.Url; files = load.Execute(); } // Calculate unmodified state. { var unmodified = new SetUnmodifiedCommand(config.SitePath, documents, files, this.InitialLastRunState); unmodified.Execute(); } site = new Site(config, data, documents, files, layouts); } Statistics.Current.SiteFiles = site.Documents.Count + site.Files.Count + site.Layouts.Count; return site; }