Skip to content

Commit

Permalink
Check status code
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikl committed Aug 2, 2019
1 parent d1125fa commit 0abb93a
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
getLibs <- Sys.getenv("OMERO_LIBS_DOWNLOAD", unset = NA)
if (!is.na(getLibs) && startsWith(tolower(getLibs), 'http')) {
git_info <- GET(getLibs)
git_info <- content(git_info, "text")
ex <- "(OMERO\\.java-\\S+\\.zip)"
r <- gregexpr(ex, git_info)
res <- regmatches(git_info, r)
zipFile <- res[[1]][[2]]
baseURL <- "https://merge-ci.openmicroscopy.org/jenkins/job/OMERO-build/lastBuild/artifact/src/target"
acc <- 'y'
status <- status_code(git_info)
if (status != 200) {
packageStartupMessage("Request failed. ", getLibs, " returned ", status)
acc <- 'n'
} else {
git_info <- content(git_info, "text")
ex <- "(OMERO\\.java-\\S+\\.zip)"
r <- gregexpr(ex, git_info)
res <- regmatches(git_info, r)
zipFile <- res[[1]][[2]]
baseURL <- getLibs
if (endsWith(getLibs, '/'))
baseURL <- substr(baseURL, 1, nchar(baseURL)-1)
acc <- 'y'
}
}
else if (!is.na(getLibs) && as.logical(getLibs) == TRUE) {
acc <- 'y'
Expand Down

0 comments on commit 0abb93a

Please sign in to comment.