use of org.nzbhydra.mapping.SemanticVersion in project nzbhydra2 by theotherp.
the class UpdateManager method latestVersionIgnored.
public boolean latestVersionIgnored() throws UpdateException {
SemanticVersion latestVersion = getLatestVersion();
Optional<UpdateData> updateData = updateDataGenericStorage.get(KEY, UpdateData.class);
if (updateData.isPresent() && updateData.get().getIgnoreVersions().contains(latestVersion)) {
logger.debug("Version {} is in the list of ignored updates", latestVersion);
return true;
}
return false;
}
use of org.nzbhydra.mapping.SemanticVersion in project nzbhydra2 by theotherp.
the class UpdateManager method getChangesSinceCurrentVersion.
public List<ChangelogVersionEntry> getChangesSinceCurrentVersion() throws UpdateException {
if (latestVersion == null) {
getLatestVersion();
}
List<ChangelogVersionEntry> allChanges = getAllChanges();
List<ChangelogVersionEntry> collectedVersionChanges = new ArrayList<>();
for (ChangelogVersionEntry changelogVersionEntry : allChanges) {
SemanticVersion version = new SemanticVersion(changelogVersionEntry.getVersion());
if (currentVersion.isSameOrNewer(version)) {
break;
}
if (version.isUpdateFor(latestVersion)) {
// Don't show changes for version not yet released
continue;
}
collectedVersionChanges.add(changelogVersionEntry);
}
return collectedVersionChanges;
}
use of org.nzbhydra.mapping.SemanticVersion in project nzbhydra2 by theotherp.
the class UpdateManager method ignore.
public void ignore(String version) {
SemanticVersion semanticVersion = new SemanticVersion(version);
UpdateData updateData = updateDataGenericStorage.get(KEY, UpdateData.class).orElse(new UpdateData());
if (!updateData.getIgnoreVersions().contains(semanticVersion)) {
updateData.getIgnoreVersions().add(semanticVersion);
}
updateDataGenericStorage.save(KEY, updateData);
logger.info("Version {} ignored. Will not show update notices for this version.", semanticVersion);
}
use of org.nzbhydra.mapping.SemanticVersion in project nzbhydra2 by theotherp.
the class NewsWeb method transform.
private List<NewsEntryForWeb> transform(List<NewsEntry> entries) {
List<NewsEntryForWeb> transformedEntries = new ArrayList<>();
for (NewsEntry entry : entries) {
boolean isForCurrentVersion = entry.getShowForVersion().equals(new SemanticVersion(updateManager.getCurrentVersionString()));
boolean isForNewerVersion = entry.getShowForVersion().isUpdateFor(new SemanticVersion(updateManager.getCurrentVersionString()));
transformedEntries.add(new NewsEntryForWeb(entry.getShowForVersion().getAsString(), Markdown.renderMarkdownAsHtml(entry.getNewsAsMarkdown()), isForCurrentVersion, isForNewerVersion));
}
return transformedEntries;
}
use of org.nzbhydra.mapping.SemanticVersion in project nzbhydra2 by theotherp.
the class UpdateManagerTest method testThatChecksForUpdateAvailable.
@Test
public void testThatChecksForUpdateAvailable() throws Exception {
assertTrue(testee.isUpdateAvailable());
testee.currentVersion = new SemanticVersion("v2.0.0");
assertFalse(testee.isUpdateAvailable());
}
Aggregations