mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-04-19 11:21:56 +02:00
parent
2347e74970
commit
1a1f31db2c
10
README.md
10
README.md
@ -22,11 +22,13 @@ RipMe is an album ripper for various websites. It is a cross-platform tool that
|
||||
|
||||
## Downloads
|
||||
|
||||
Download `ripme.jar` from the [latest release](https://github.com/ripmeapp/ripme/releases).
|
||||
Download `ripme.jar` from the [latest release](/releases). For information about running the `.jar` file, see
|
||||
[the How To Run wiki](https://github.com/ripmeapp/ripme/wiki/How-To-Run-RipMe).
|
||||
|
||||
**Note: If you're currently using version 1.2.x, 1.3.x or 1.7.49, you will not automatically get updates to the newest versions. We recommend downloading the latest version from the link above.**
|
||||
|
||||
For information about running the `.jar` file, see [the How To Run wiki](https://github.com/ripmeapp/ripme/wiki/How-To-Run-RipMe).
|
||||
The version number like ripme-1.7.94-17-2167aa34-feature_auto_release.jar contains a release number (1.7.94), given by
|
||||
a person the number of commits since this version (17). The commit SHA (2167aa34) is there uniquely referencing the
|
||||
source code ripme was built from. If it is not built from the main branch, the branch name (feature/auto-release) is
|
||||
given.
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -23,7 +23,8 @@ import com.rarchives.ripme.utils.Utils;
|
||||
public class UpdateUtils {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
|
||||
private static final String DEFAULT_VERSION = "1.7.94";
|
||||
// do not update the default version without adjusting the unit test. the real version comes from METAINF.MF
|
||||
private static final String DEFAULT_VERSION = "1.7.94-10-b6345398";
|
||||
private static final String REPO_NAME = "ripmeapp/ripme";
|
||||
private static final String updateJsonURL = "https://raw.githubusercontent.com/" + REPO_NAME + "/master/ripme.json";
|
||||
private static String mainFileName;
|
||||
@ -165,7 +166,7 @@ public class UpdateUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isNewerVersion(String latestVersion) {
|
||||
static boolean isNewerVersion(String latestVersion) {
|
||||
// If we're testing the update utils we want the program to always try to update
|
||||
if (Utils.getConfigBoolean("testing.always_try_to_update", false)) {
|
||||
logger.info("isNewerVersion is returning true because the key \"testing.always_try_to_update\" is true");
|
||||
@ -194,11 +195,18 @@ public class UpdateUtils {
|
||||
}
|
||||
|
||||
private static int[] versionStringToInt(String version) {
|
||||
String strippedVersion = version.split("-")[0];
|
||||
String[] strVersions = strippedVersion.split("\\.");
|
||||
int[] intVersions = new int[strVersions.length];
|
||||
for (int i = 0; i < strVersions.length; i++) {
|
||||
intVersions[i] = Integer.parseInt(strVersions[i]);
|
||||
// a version string looks like 1.7.94, 1.7.94-10-something
|
||||
// 10 is the number of commits since the 1.7.94 tag, so newer
|
||||
// the int array returned then contains e.g. 1.7.94.0 or 1.7.94.10
|
||||
String[] strVersions = version.split("[\\.-]");
|
||||
// not consider more than 4 components of version, loop only the real number
|
||||
// of components or maximum 4 components of the version string
|
||||
int[] intVersions = new int[4];
|
||||
for (int i = 0; i < Math.min(4,strVersions.length); i++) {
|
||||
// if it is an integer, set it, otherwise leave default 0
|
||||
if (strVersions[i].matches("\\d+")) {
|
||||
intVersions[i] = Integer.parseInt(strVersions[i]);
|
||||
}
|
||||
}
|
||||
return intVersions;
|
||||
}
|
||||
|
17
src/test/java/com/rarchives/ripme/ui/UpdateUtilsTest.java
Normal file
17
src/test/java/com/rarchives/ripme/ui/UpdateUtilsTest.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.rarchives.ripme.ui;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class UpdateUtilsTest {
|
||||
|
||||
@Test
|
||||
public void testIsNewerVersion() {
|
||||
UpdateUtils updateUtils = new UpdateUtils();
|
||||
Assertions.assertFalse(updateUtils.isNewerVersion("1.7.94"));
|
||||
Assertions.assertFalse(updateUtils.isNewerVersion("1.7.94-9-asdf"));
|
||||
Assertions.assertTrue(updateUtils.isNewerVersion("1.7.94-11-asdf"));
|
||||
Assertions.assertTrue(updateUtils.isNewerVersion("1.7.95"));
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user