Do the same thing for getFromTag
This commit is contained in:
parent
887d1d2233
commit
e9c5038010
|
@ -9,7 +9,6 @@ import org.jetbrains.annotations.Nullable;
|
|||
import java.io.IOException;
|
||||
|
||||
public class GitHubFetcher extends PackFetcher {
|
||||
|
||||
@Override
|
||||
public String getSourceTypeName() {
|
||||
return "github";
|
||||
|
@ -23,12 +22,12 @@ public class GitHubFetcher extends PackFetcher {
|
|||
throw new Exception("Minimum source must contain \"user/repo\".");
|
||||
}
|
||||
|
||||
/* "user/repo" - Gets from latest commit of main/master branch. */
|
||||
//"user/repo" - Gets from latest commit of main/master branch.
|
||||
else if (parts.length == 2) {
|
||||
return getFromBranch(parts[0] + "/" + parts[1], null);
|
||||
return getFromBranch(baseUrl, null);
|
||||
}
|
||||
|
||||
/* "user/repo/branch/branchName" - Gets from latest commit of specified branch. */
|
||||
//"user/repo/branch/branchName" - Gets from latest commit of specified branch.
|
||||
else if (parts[2].equalsIgnoreCase("branch")) {
|
||||
if (parts.length < 4) throw new Exception("Missing branch name in source definition.");
|
||||
else {
|
||||
|
@ -37,7 +36,7 @@ public class GitHubFetcher extends PackFetcher {
|
|||
}
|
||||
}
|
||||
|
||||
/* "user/repo/release" - Gets from the latest release. */
|
||||
//"user/repo/release" - Gets from the latest release.
|
||||
else if (parts[2].equalsIgnoreCase("release")) {
|
||||
try {
|
||||
JsonObject latestRelease = UrlUtils.readJsonFromURL("https://api.github.com/repos/" + parts[0] + "/" + parts[1] + "/releases/latest", JsonObject.class);
|
||||
|
@ -61,11 +60,11 @@ public class GitHubFetcher extends PackFetcher {
|
|||
}
|
||||
}
|
||||
|
||||
/* "user/repo/tag/tagNum" - Gets from a specified tag. */
|
||||
//"user/repo/tag/tagNum" - Gets from a specified tag.
|
||||
else if (parts[2].equalsIgnoreCase("tag")) {
|
||||
if (parts.length < 4) throw new Exception("Missing tag number in source definition.");
|
||||
else {
|
||||
return getFromTag(parts[0], parts[1], parts[3]);
|
||||
return getFromTag(parts[0] + "/" + parts[1], parts[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,9 +84,8 @@ public class GitHubFetcher extends PackFetcher {
|
|||
return "https://codeload.github.com/" + repo + "/legacy.zip/refs/heads/" + branch;
|
||||
}
|
||||
|
||||
private String getFromTag(String user, String repo, String tag) {
|
||||
private String getFromTag(String repo, String tag) {
|
||||
Resclone.LOGGER.info("Getting from tag " + tag + ".");
|
||||
return "https://codeload.github.com/" + user + "/" + repo + "/legacy.zip/refs/tags/" + tag;
|
||||
return "https://codeload.github.com/" + repo + "/legacy.zip/refs/tags/" + tag;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue