package com.metacodestudio.hotsuploader.versions;

import java.util.Comparator;

public class ReleaseComparator implements Comparator<GitHubRelease> {

    public int compare(final GitHubRelease release1, final GitHubRelease release2) {
        if (release1.isPrerelease() && !release2.isPrerelease()) {
            return 1;
        } else if (!release1.isPrerelease() && release2.isPrerelease()) {
            return -1;
        }

        String release1Version = stripVersion(release1.getTagName());
        String release2Version = stripVersion(release2.getTagName());

        return -release1Version.compareTo(release2Version);
    }

    private String stripVersion(final String tagName) {
        return tagName.replaceFirst("v", "").replaceAll("-\\w*", "");
    }
}

@@ -145,16 +145,224 @@
 ase%3E %7B%0A%0A
+    /**%0A     *%0A     * @param release1 The first %7B@link GitHubRelease%7D%0A     * @param release2 The second %7B@link GitHubRelease%7D%0A     * @return 1 if the second release is considered newer than the first%0A     */%0A
     publ

add barebone documentation for ReleaseComparator