Skip to content

Commit

Permalink
Eliminated RCurl dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedia committed Apr 7, 2017
1 parent f9c9f0f commit b7ebb21
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 29 deletions.
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ Depends:
R(>= 3.1.0)
Imports:
abind,
transformeR,
RCurl,
transformeR(>= 0.0.7),
parallel
Suggests:
visualizeR,
Expand All @@ -18,8 +17,8 @@ Suggests:
VignetteBuilder: knitr
Type: Package
Title: Fire weather index calculation from station and model data
Version: 1.0.1
Date: 2017-04-04
Version: 1.0.2
Date: 2017-04-07
Authors@R: as.person(c(
"Santander Meteorology Group <http://meteo.unican.es> [aut]",
"Joaquin Bedia <[email protected]> [ctb, cre]",
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

export(fwi1D)
export(fwiGrid)
importFrom(RCurl,getURL)
importFrom(abind,abind)
importFrom(abind,asub)
importFrom(parallel,parLapply)
Expand Down
45 changes: 21 additions & 24 deletions R/onAttach.R
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
#' @importFrom utils packageDescription
#' @importFrom RCurl getURL

.onAttach <- function(...) {
pkgname <- "fireDanger"
lib <- system.file(package = pkgname)
ver <- packageDescription(pkgname)$Version
builddate <- packageDescription(pkgname)$Date
mess <- paste(pkgname, " version ", ver, " (", builddate,") is loaded", sep = "")
packageStartupMessage(mess)
url <- paste0("https://raw.githubusercontent.com/SantanderMetGroup/", pkgname, "/master/DESCRIPTION")
con <- tryCatch(getURL(url, ssl.verifypeer = FALSE), error = function(er) {
er <- NULL
return(er)
})
if (!is.null(con)) {
b <- readLines(textConnection(con))
latest.ver <- package_version(gsub("Version: ", "", b[grep("Version", b)]))
if (ver < latest.ver) {
ver.mess1 <- paste0("WARNING: Your current version of ", pkgname, " (v", ver, ") is not up-to-date")
ver.mess <- paste0("Get the latest stable version (", latest.ver,
") using <devtools::install_github(c('SantanderMetGroup/transformeR','SantanderMetGroup/", pkgname, "'))>")
packageStartupMessage(ver.mess1)
packageStartupMessage(ver.mess)
}
}
packageStartupMessage("Type 'vignette(\"Climate_Services_2017\", package = \"fireDanger\")' for a package overview and worked examples")
pkgname <- "fireDanger"
ver <- packageDescription(pkgname)$Version
builddate <- packageDescription(pkgname)$Date
mess <- paste(pkgname, " version ", ver, " (", builddate,") is loaded", sep = "")
packageStartupMessage(mess)
url <- paste0("https://raw.githubusercontent.com/SantanderMetGroup/", pkgname, "/master/DESCRIPTION")
b <- tryCatch(suppressWarnings(readLines(url)), error = function(er) {
er <- NULL
return(er)
})
if (!is.null(b)) {
latest.ver <- package_version(gsub("Version: ", "", b[grep("^Version", b)]))
if (ver < latest.ver) {
ver.mess1 <- paste0("WARNING: Your current version of ", pkgname, " (v", ver, ") is not up-to-date")
ver.mess <- paste0("Get the latest stable version (", latest.ver,
") using <devtools::install_github('SantanderMetGroup/", pkgname, "')>")
packageStartupMessage(ver.mess1)
packageStartupMessage(ver.mess)
}
}
packageStartupMessage("Type 'vignette(\"Climate_Services_2017\", package = \"fireDanger\")' for package overview and examples")
}
# End

0 comments on commit b7ebb21

Please sign in to comment.