@@ -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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user