From 44cc1b11561e3089562b49ccda04550fbf634aad Mon Sep 17 00:00:00 2001 From: Delaigue Olivier <olivier.delaigue@irstea.fr> Date: Tue, 24 Mar 2020 11:58:06 +0100 Subject: [PATCH] v0.2.9.0 NEW: add .CheckUrl function in order to to test if a remote url exists #10 --- DESCRIPTION | 4 ++-- NAMESPACE | 1 + NEWS.md | 5 +++++ R/Utils.R | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index df9c397..b12eba6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: airGRteaching Type: Package Title: Teaching Hydrological Modelling with the GR Rainfall-Runoff Models ('Shiny' Interface Included) -Version: 0.2.8.69 -Date: 2020-02-28 +Version: 0.2.9.0 +Date: 2020-03-24 Authors@R: c( person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"), person("Laurent", "Coron", role = c("aut"), comment = c(ORCID = "0000-0002-1503-6204")), diff --git a/NAMESPACE b/NAMESPACE index 6f16c37..92e2e83 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -36,6 +36,7 @@ exportPattern(".DiagramGR") exportPattern(".TypeModelGR") exportPattern(".StartStop") exportPattern(".DyShadingMulti") +exportPattern(".CheckUrl") diff --git a/NEWS.md b/NEWS.md index a233da7..c7acd73 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,11 @@ +### 0.2.9.0 Release Notes (2020-03-24) + +____________________________________________________________________________________ + + ### 0.2.8.69 Release Notes (2020-02-28) diff --git a/R/Utils.R b/R/Utils.R index a6a34b6..0f1df34 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -25,6 +25,20 @@ if (getRversion() >= "2.15.1") { +## ================================================================================= +## function to test if a remote url exists +## ================================================================================= + +.CheckUrl <- function(url, timeout = 2) { + con <- url(description = url) + check <- suppressWarnings(try(open.connection(con = con, open = "rt", timeout = t), silent = TRUE)[1]) + suppressWarnings(try(close.connection(con), silent = TRUE)) + is.null(check) +} + + + + ## ================================================================================= ## function to compute the start and stop id of equal values in a vector ## ================================================================================= -- GitLab