mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-01-17 04:38:18 +01:00
Merge pull request #9 from ripmeapp2/feature/version-in-code
version string with number of commits since last tag, like 1.7.94-10
This commit is contained in:
commit
9e0b6213cf
22
README.md
22
README.md
@ -1,10 +1,10 @@
|
||||
# RipMe [![Licensed under the MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/RipMeApp/ripme/blob/master/LICENSE.txt) [![Join the chat at https://gitter.im/RipMeApp/Lobby](https://badges.gitter.im/RipMeApp/Lobby.svg)](https://gitter.im/RipMeApp/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Subreddit](https://img.shields.io/badge/discuss-on%20reddit-blue.svg)](https://www.reddit.com/r/ripme/)
|
||||
|
||||
[![Build Status](https://travis-ci.org/RipMeApp/ripme.svg?branch=master)](https://travis-ci.org/RipMeApp/ripme)
|
||||
# RipMe
|
||||
[![Licensed under the MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](/LICENSE.txt)
|
||||
[![Join the chat at https://gitter.im/RipMeApp/Lobby](https://badges.gitter.im/RipMeApp/Lobby.svg)](https://gitter.im/RipMeApp/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[![Subreddit](https://img.shields.io/badge/discuss-on%20reddit-blue.svg)](https://www.reddit.com/r/ripme/)
|
||||
[![example workflow](/../../../actions/workflows/gradle.yml/badge.svg)](/../../../actions/workflows/gradle.yml)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/RipMeApp/ripme/badge.svg?branch=master)](https://coveralls.io/github/RipMeApp/ripme?branch=master)
|
||||
|
||||
# Contribute
|
||||
|
||||
RipMe is maintained with ♥️ and in our limited free time by **[@MetaPrime](https://github.com/metaprime)**, **[@cyian-1756](https://github.com/cyian-1756)** and **[@kevin51jiang](https://github.com/kevin51jiang)**. If you'd like to contribute but aren't good with code, help keep us happy with a small contribution!
|
||||
|
||||
[![Tip with PayPal](https://img.shields.io/badge/PayPal-Buy_us...-lightgrey.svg)](https://www.paypal.me/ripmeapp)
|
||||
@ -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
|
||||
|
||||
@ -37,7 +39,7 @@ brew install --cask ripme && xattr -d com.apple.quarantine /Applications/ripme.j
|
||||
|
||||
## Changelog
|
||||
|
||||
[Changelog](https://github.com/ripmeapp/ripme/blob/master/ripme.json) **(ripme.json)**
|
||||
[Changelog](/ripme.json) **(ripme.json)**
|
||||
|
||||
# Features
|
||||
|
||||
|
@ -44,6 +44,8 @@ java {
|
||||
tasks.withType<Jar> {
|
||||
manifest {
|
||||
attributes["Main-Class"] = "com.rarchives.ripme.App"
|
||||
attributes["Implementation-Version"] = archiveVersion
|
||||
|
||||
}
|
||||
|
||||
// To add all of the dependencies otherwise a "NoClassDefFoundError" error
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import java.util.Set;
|
||||
import com.rarchives.ripme.utils.Utils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class LabelsBundlesTest {
|
||||
|
@ -3,9 +3,11 @@ package com.rarchives.ripme.tst.ui;
|
||||
import com.rarchives.ripme.ui.RipStatusMessage;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class RipStatusMessageTest {
|
||||
|
||||
@Test
|
||||
public void testConstructor() {
|
||||
RipStatusMessage.STATUS loadingResource = RipStatusMessage.STATUS.LOADING_RESOURCE;
|
||||
String path = "path/to/file";
|
||||
|
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