Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions lib/Git_PoreCov.groovy
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import java.net.URL
import java.net.URLConnection
import groovy.json.JsonSlurper

class Git_PoreCov {

static boolean IsGitAvailable() {
/**
* Gets the latest version of a GitHub repository
* @return Latest version string
*/
static String getLatestVersion() {
try {
final URL url = new URL("https://api.github.com/repos/replikation/poreCov/releases/latest");
final URLConnection conn = url.openConnection();
conn.connect();
conn.getInputStream().close();
return true;
} catch (MalformedURLException e) {
return false;
} catch (IOException e) {
return false;
final URL url = new URL("https://api.github.com/repos/replikation/poreCov/releases/latest")
def response = url.getText(requestProperties: [
Accept: 'application/json'
]);

def json = new JsonSlurper().parseText(response);
return json.tag_name ?: json.name;
} catch (Exception e) {
println "Error fetching version: ${e.message}";
return 'Could not get version info';
}
}
}
}
6 changes: 1 addition & 5 deletions poreCov.nf
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ workflow {

// try to check for poreCov releases

if ( Git_PoreCov.IsGitAvailable().toString() == "true" ) { porecovrelease = 'https://api.github.com/repos/replikation/poreCov/releases/latest'.toURL().text.split('"tag_name":"')[1].split('","')[0] }
else { porecovrelease = 'Could not get version info' }


println " "
println " Latest available poreCov release: " + porecovrelease
println " Latest available poreCov release: " + Git_PoreCov.getLatestVersion()
println " If neccessary update via: nextflow pull replikation/poreCov"
println "________________________________________________________________________________"

Expand Down