Fixes #976 Now uses GitHub to retrieve most current version

Reworked whole Version Checker with an extensible interface to add any other service later on easier.
The version checker now has its own config file, to collect the different options and extract them from the main config file.
In that you can specify how fine the versions should be checked.
This commit is contained in:
thatsIch
2015-03-09 17:35:19 +01:00
parent 720b38442e
commit 6baf952904
33 changed files with 2023 additions and 169 deletions
@@ -0,0 +1,39 @@
package appeng.services.version;
/**
* Wrapper for {@link VersionParser} to check if the check is happening in developer environment or in a pull request.
*
* In that case ignore the check.
*/
public final class ModVersionFetcher implements VersionFetcher
{
private final String rawModVersion;
private final VersionParser parser;
public ModVersionFetcher( String rawModVersion, VersionParser parser )
{
this.rawModVersion = rawModVersion;
this.parser = parser;
}
/**
* Parses only, if not checked in developer environment or in a pull request
*
* @return {@link DoNotCheckVersion} if in developer environment or pull request, else the parsed {@link Version}
*/
@Override
public Version get()
{
if ( this.rawModVersion.equals( "@version@" ) || this.rawModVersion.contains( "pr" ) )
{
return new DoNotCheckVersion();
}
else
{
final Version version = this.parser.parse( this.rawModVersion );
return version;
}
}
}