mirror of
https://gitee.com/dcren/initializr.git
synced 2025-05-12 08:38:34 +08:00
Replace {bootVersion} in HELP.md links
Closes gh-1009
This commit is contained in:
parent
252ee887f7
commit
2f4eeb07d6
@ -42,9 +42,12 @@ public class RequestedDependenciesHelpDocumentCustomizer implements HelpDocument
|
||||
|
||||
private final InitializrMetadata metadata;
|
||||
|
||||
private final String defaultPlatformVersion;
|
||||
|
||||
public RequestedDependenciesHelpDocumentCustomizer(ProjectDescription description, InitializrMetadata metadata) {
|
||||
this.description = description;
|
||||
this.metadata = metadata;
|
||||
this.defaultPlatformVersion = metadata.getBootVersions().getDefault().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,7 +85,8 @@ public class RequestedDependenciesHelpDocumentCustomizer implements HelpDocument
|
||||
String description = (link.getDescription() != null) ? link.getDescription()
|
||||
: defaultDescription.apply(links);
|
||||
if (description != null) {
|
||||
section.get().addItem(new GettingStartedSection.Link(link.getHref(), description));
|
||||
String url = link.getHref().replace("{bootVersion}", this.defaultPlatformVersion);
|
||||
section.get().addItem(new GettingStartedSection.Link(url, description));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -42,11 +42,12 @@ class RequestedDependenciesHelpDocumentCustomizerTests {
|
||||
@Test
|
||||
void dependencyWithReferenceDocLink() {
|
||||
Dependency dependency = createDependency("example",
|
||||
Link.create("reference", "https://example.com/doc", "Reference doc example"));
|
||||
Link.create("reference", "https://example.com/{bootVersion}/doc", "Reference doc example"));
|
||||
this.metadataBuilder.addDependencyGroup("test", dependency);
|
||||
HelpDocument document = customizeHelp("example");
|
||||
assertThat(document.gettingStarted().isEmpty()).isFalse();
|
||||
assertSingleLink(document.gettingStarted().referenceDocs(), "https://example.com/doc", "Reference doc example");
|
||||
assertSingleLink(document.gettingStarted().referenceDocs(), "https://example.com/2.1.1.RELEASE/doc",
|
||||
"Reference doc example");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -72,11 +73,12 @@ class RequestedDependenciesHelpDocumentCustomizerTests {
|
||||
@Test
|
||||
void dependencyWithGuideLink() {
|
||||
Dependency dependency = createDependency("example",
|
||||
Link.create("guide", "https://example.com/how-to", "How-to example"));
|
||||
Link.create("guide", "https://example.com/{bootVersion}/how-to", "How-to example"));
|
||||
this.metadataBuilder.addDependencyGroup("test", dependency);
|
||||
HelpDocument document = customizeHelp("example");
|
||||
assertThat(document.gettingStarted().isEmpty()).isFalse();
|
||||
assertSingleLink(document.gettingStarted().guides(), "https://example.com/how-to", "How-to example");
|
||||
assertSingleLink(document.gettingStarted().guides(), "https://example.com/2.1.1.RELEASE/how-to",
|
||||
"How-to example");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -102,11 +104,12 @@ class RequestedDependenciesHelpDocumentCustomizerTests {
|
||||
@Test
|
||||
void dependencyWithAdditionalLink() {
|
||||
Dependency dependency = createDependency("example",
|
||||
Link.create("something", "https://example.com/test", "Test App"));
|
||||
Link.create("something", "https://example.com/{bootVersion}/test", "Test App"));
|
||||
this.metadataBuilder.addDependencyGroup("test", dependency);
|
||||
HelpDocument document = customizeHelp("example");
|
||||
assertThat(document.gettingStarted().isEmpty()).isFalse();
|
||||
assertSingleLink(document.gettingStarted().additionalLinks(), "https://example.com/test", "Test App");
|
||||
assertSingleLink(document.gettingStarted().additionalLinks(), "https://example.com/2.1.1.RELEASE/test",
|
||||
"Test App");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user