Polishing.

Use correct documentation URL.

See #207
This commit is contained in:
Mark Paluch
2022-03-22 14:27:29 +01:00
parent a3a390fad0
commit 15661e087e
2 changed files with 19 additions and 14 deletions

View File

@@ -21,6 +21,7 @@ import org.springframework.data.release.git.GitProject;
import org.springframework.data.release.git.Tag;
import org.springframework.data.release.git.VersionTags;
import org.springframework.data.release.model.ArtifactVersion;
import org.springframework.data.release.model.DocumentationMetadata;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.Project;
@@ -31,32 +32,27 @@ import org.springframework.data.release.model.Project;
@RequiredArgsConstructor
public class StaticResources {
private static final String URL_TEMPLATE = "https://docs.spring.io/spring-data/%s/docs/%s";
private final String baseUrl;
private final DocumentationMetadata metadata;
private final String releaseUrl;
public StaticResources(ModuleIteration module) {
this.metadata = DocumentationMetadata.of(module.getProject(), ArtifactVersion.of(module), false);
Project project = module.getProject();
ArtifactVersion version = ArtifactVersion.of(module);
this.baseUrl = String.format(URL_TEMPLATE, project.getName().toLowerCase(), version);
GitProject gitProject = GitProject.of(project);
Tag tag = VersionTags.empty(module.getProject()).createTag(module);
this.releaseUrl = String.format("%s/releases/tag/%s", gitProject.getProjectUri(), tag.getName());
}
public String getDocumentationUrl() {
return baseUrl.concat("/reference/html");
return metadata.getReferenceDocUrl();
}
public String getJavaDocUrl() {
return baseUrl.concat("/api");
return metadata.getApiDocUrl();
}
public String getChangelogUrl() {

View File

@@ -47,10 +47,19 @@ public class DocumentationMetadata {
}
if (Projects.BUILD.equals(project)) { // Report Commons Docs for Spring Data Build
return String.format(JAVADOC, Projects.COMMONS.getName().toLowerCase(Locale.US), getDocumentationVersion());
return String.format(JAVADOC, getProjectName(Projects.COMMONS), getDocumentationVersion());
}
return String.format(JAVADOC, project.getName().toLowerCase(Locale.US), getDocumentationVersion());
return String.format(JAVADOC, getProjectName(project), getDocumentationVersion());
}
private String getProjectName(Project project) {
if (project == Projects.RELATIONAL) {
return "jdbc";
}
return project.getName().toLowerCase(Locale.US);
}
/**
@@ -65,10 +74,10 @@ public class DocumentationMetadata {
}
if (Projects.BUILD.equals(project)) { // Report Commons Docs for Spring Data Build
return String.format(DOCS, Projects.COMMONS.getName().toLowerCase(Locale.US), getDocumentationVersion());
return String.format(DOCS, getProjectName(Projects.COMMONS), getDocumentationVersion());
}
return String.format(DOCS, project.getName().toLowerCase(Locale.US), getDocumentationVersion());
return String.format(DOCS, getProjectName(project), getDocumentationVersion());
}
public String getVersionOrTrainName(Train train) {