Skip to content

Commit

Permalink
Polishing.
Browse files Browse the repository at this point in the history
Use correct documentation URL.

See #207
  • Loading branch information
mp911de committed Mar 22, 2022
1 parent a3a390f commit 15661e0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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;

Expand All @@ -31,32 +32,27 @@
@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) {

Project project = module.getProject();
ArtifactVersion version = ArtifactVersion.of(module);

this.baseUrl = String.format(URL_TEMPLATE, project.getName().toLowerCase(), version);
this.metadata = DocumentationMetadata.of(module.getProject(), ArtifactVersion.of(module), false);

Project project = module.getProject();
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,19 @@ public String getApiDocUrl() {
}

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);
}

/**
Expand All @@ -65,10 +74,10 @@ public String getReferenceDocUrl() {
}

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) {
Expand Down

0 comments on commit 15661e0

Please sign in to comment.