|
17 | 17 |
|
18 | 18 | namespace Documentation.Assembler.Exporters; |
19 | 19 |
|
20 | | -public class ConfigurationExporter(ILoggerFactory logFactory, AssembleContext context) : IMarkdownExporter |
21 | | -{ |
22 | | - private readonly ILogger<ConfigurationExporter> _logger = logFactory.CreateLogger<ConfigurationExporter>(); |
23 | | - |
24 | | - /// <inheritdoc /> |
25 | | - public ValueTask StartAsync(CancellationToken ctx = default) => default; |
26 | | - |
27 | | - /// <inheritdoc /> |
28 | | - public ValueTask StopAsync(CancellationToken ctx = default) => default; |
29 | | - |
30 | | - /// <inheritdoc /> |
31 | | - public ValueTask<bool> ExportAsync(MarkdownExportFileContext fileContext, CancellationToken ctx) => default; |
32 | | - |
33 | | - /// <inheritdoc /> |
34 | | - public ValueTask<bool> FinishExportAsync(IDirectoryInfo outputFolder, CancellationToken ctx) |
35 | | - { |
36 | | - var fs = context.WriteFileSystem; |
37 | | - var configFolder = fs.DirectoryInfo.New(Path.Combine(context.OutputDirectory.FullName, "config")); |
38 | | - if (!configFolder.Exists) |
39 | | - configFolder.Create(); |
40 | | - |
41 | | - _logger.LogInformation("Exporting configuration"); |
42 | | - |
43 | | - var assemblerConfig = context.ConfigurationFileProvider.AssemblerFile; |
44 | | - _logger.LogInformation("Exporting {Name} to {ConfigFolder}", assemblerConfig.Name, configFolder.FullName); |
45 | | - context.WriteFileSystem.File.Copy(assemblerConfig.FullName, Path.Combine(configFolder.FullName, assemblerConfig.Name), true); |
46 | | - |
47 | | - var navigationConfig = context.ConfigurationFileProvider.NavigationFile; |
48 | | - _logger.LogInformation("Exporting {Name} to {ConfigFolder}", navigationConfig.Name, configFolder.FullName); |
49 | | - context.WriteFileSystem.File.Copy(navigationConfig.FullName, Path.Combine(configFolder.FullName, navigationConfig.Name), true); |
50 | | - |
51 | | - var legacyUrlMappingsConfig = context.ConfigurationFileProvider.LegacyUrlMappingsFile; |
52 | | - _logger.LogInformation("Exporting {Name} to {ConfigFolder}", legacyUrlMappingsConfig.Name, configFolder.FullName); |
53 | | - context.WriteFileSystem.File.Copy(legacyUrlMappingsConfig.Name, Path.Combine(configFolder.FullName, legacyUrlMappingsConfig.Name), true); |
54 | | - |
55 | | - var versionsConfig = context.ConfigurationFileProvider.VersionFile; |
56 | | - _logger.LogInformation("Exporting {Name} to {ConfigFolder}", versionsConfig.Name, configFolder.FullName); |
57 | | - context.WriteFileSystem.File.Copy(versionsConfig.Name, Path.Combine(configFolder.FullName, versionsConfig.Name), true); |
58 | | - |
59 | | - return default; |
60 | | - } |
61 | | -} |
62 | | - |
63 | 20 | public class ElasticsearchMarkdownExporter : IMarkdownExporter, IDisposable |
64 | 21 | { |
65 | 22 | private readonly DiagnosticsCollector _collector; |
|
0 commit comments