Skip to content

Commit 09e1432

Browse files
committed
Refactor writing linkRegistrySnapshot to AssemblerRepositorySourcer method
1 parent 8ef5f22 commit 09e1432

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/tooling/docs-assembler/Cli/RepositoryCommands.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,7 @@ public async Task<int> BuildAll(
125125
var builder = new AssemblerBuilder(logger, assembleContext, navigation, htmlWriter, pathProvider, historyMapper);
126126
await builder.BuildAllAsync(assembleSources.AssembleSets, ctx);
127127

128-
if (checkoutResult.LinkRegistrySnapshot is { } linkRegistry)
129-
{
130-
await File.WriteAllTextAsync(
131-
Path.Combine(assembleContext.OutputDirectory.FullName, "docs", CheckoutResult.LinkRegistrySnapshotFileName),
132-
LinkRegistry.Serialize(linkRegistry),
133-
ctx
134-
);
135-
}
128+
await cloner.WriteLinkRegistrySnapshot(checkoutResult.LinkRegistrySnapshot, ctx);
136129

137130
var sitemapBuilder = new SitemapBuilder(navigation.NavigationItems, assembleContext.WriteFileSystem, assembleContext.OutputDirectory);
138131
sitemapBuilder.Generate();

src/tooling/docs-assembler/Sourcing/RepositorySourcesFetcher.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ await File.WriteAllTextAsync(
113113
LinkRegistrySnapshot = linkRegistry
114114
};
115115
}
116+
117+
public Task WriteLinkRegistrySnapshot(LinkRegistry linkRegistrySnapshot, Cancel ctx = default) => await File.WriteAllTextAsync(
118+
Path.Combine(context.OutputDirectory.FullName, "docs", CheckoutResult.LinkRegistrySnapshotFileName),
119+
LinkRegistry.Serialize(linkRegistrySnapshot),
120+
ctx
121+
);
116122
}
117123

118124

0 commit comments

Comments
 (0)