Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
achubaty committed Feb 16, 2016
2 parents ab27dba + 10642ea commit 5ffff62
Show file tree
Hide file tree
Showing 39 changed files with 1,331 additions and 373 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ last.dump.rda
cache/
figure/
man/spadesEnv.Rd
myModule.md
output/
tests/testthat/*.pdf
tests/testthat/*.RData
Expand Down
18 changes: 6 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,26 @@
# https://github.com/craigcitro/r-travis/wiki

language: r

cran: http://cran.rstudio.com/

sudo: required
cran: http://cran.rstudio.com/

env:
global:
- secure: "KxcKSH4TFMbNMKAj6ePl4yq6SCeYQJcDkw0PMuEdImomwxqY3mP8p+GWVmNN1PKl8k7C/rgLNPAiBoJmddXMzFvGoGRWvyeER0lDN49rzNPHANF9wnMBBYN27mp98hBZlX2Vxu48M3jbmy+wRpmKKvKxTxOa8tUkt0GVEUTPeGQ="

before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- tlmgr install xcolor
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- echo "options(repos = c(CRAN='http://cran.rstudio.com'))" >> ~/.Rprofile
- "chmod 755 ./_push_vignettes.sh"
- chmod 755 ./_push_vignettes.sh

r_build_args: " "

r_check_args: "--as-cran"

warnings_are_errors: true

apt_packages:
- curl
- latex-xcolor
- libcurl4-openssl-dev

r_binary_packages:
- chron
- circstats
Expand Down Expand Up @@ -69,7 +63,7 @@ r_binary_packages:
r_github_packages:
- s-u/fastshp
- jimhester/covr
- rich-iannone/DiagrammeR
- MangoTheCat/visualTest

after_success:
- ./_push_vignettes.sh
Expand Down
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Description: Easily implement a variety of simulation models, with a focus on
installed with `install.packages("fastshp", repos="http://rforge.net",
type="source")`.
URL: https://github.com/PredictiveEcology/SpaDES
Version: 1.1.0
Date: 2016-01-25
Version: 1.1.1
Date: 2016-02-16
Authors@R: c(
person(c("Alex", "M"), "Chubaty", email="[email protected]",
role=c("aut", "cre")),
Expand All @@ -33,16 +33,17 @@ Suggests:
fastshp,
knitr,
Matrix,
png,
RColorBrewer,
rgdal,
rmarkdown,
testthat,
tkrplot
Imports:
archivist,
archivist (>= 2.0),
CircStats,
data.table,
DiagrammeR,
DiagrammeR (>= 0.8.2),
digest,
dplyr,
ff,
Expand Down
5 changes: 4 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export(checkModule)
export(checkObject)
export(checkParams)
export(checkPath)
export(checkTimeunit)
export(checkpointFile)
export(checkpointInterval)
export(checkpointLoad)
Expand Down Expand Up @@ -209,6 +210,7 @@ exportMethods(cache)
exportMethods(cachePath)
exportMethods(checkObject)
exportMethods(checkPath)
exportMethods(checkTimeunit)
exportMethods(checkpointFile)
exportMethods(checkpointInterval)
exportMethods(clearPlot)
Expand Down Expand Up @@ -296,7 +298,7 @@ importFrom(RandomFields,RMexp)
importFrom(RandomFields,round)
importFrom(archivist,cache)
importFrom(archivist,loadFromLocalRepo)
importFrom(archivist,rmFromRepo)
importFrom(archivist,rmFromLocalRepo)
importFrom(archivist,saveToRepo)
importFrom(archivist,showLocalRepo)
importFrom(compiler,cmpfun)
Expand Down Expand Up @@ -391,6 +393,7 @@ importFrom(raster,extent)
importFrom(raster,extract)
importFrom(raster,freq)
importFrom(raster,getValues)
importFrom(raster,is.factor)
importFrom(raster,maxValue)
importFrom(raster,minValue)
importFrom(raster,ncell)
Expand Down
8 changes: 8 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Known issues: https://github.com/PredictiveEcology/SpaDES/issues

version 1.1.1
=============
* require `archivist` version 2.0 or greater
* improved `moduleCoverage` testing and template (PR257)
* correct legends from rasters so that `is.factor(raster)` is `TRUE`
* user defined time units can be used in module metadata "timeunit".
* add module timeunits to simList show method (#260)

version 1.1.0
=============
* require R version 3.2.2 or higher
Expand Down
10 changes: 5 additions & 5 deletions R/checkpoint.R
Original file line number Diff line number Diff line change
Expand Up @@ -291,24 +291,24 @@ setMethod(
#' will use the repoDir specified in \code{archivist::setLocalRepo}.
#'
#' @export
#' @importFrom archivist showLocalRepo rmFromRepo
#' @importFrom archivist showLocalRepo rmFromLocalRepo
#' @docType methods
#' @rdname clearStubArtifacts
#' @author Eliot McIntire
setGeneric("clearStubArtifacts", function(repoDir = NULL) {
standardGeneric("clearStubArtifacts")
})
standardGeneric("clearStubArtifacts")
})

#' @export
#' @rdname clearStubArtifacts
setMethod(
"clearStubArtifacts",
definition = function(repoDir) {
md5hashInBackpack = showLocalRepo(repoDir=repoDir)$md5hash
md5hashInBackpack = showLocalRepo(repoDir = repoDir)$md5hash
listFiles <- dir(file.path(repoDir, "gallery")) %>% strsplit(".rda") %>% unlist()
toRemove <- !(md5hashInBackpack %in% listFiles)
md5hashInBackpack[toRemove] %>%
sapply(., rmFromRepo, repoDir=repoDir)
sapply(., rmFromLocalRepo, repoDir = repoDir)
return(invisible(md5hashInBackpack[toRemove]))
}
)
Expand Down
4 changes: 2 additions & 2 deletions R/environment.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ setGeneric(".assignSpaDES", function(x, value, ...) {
setMethod(".assignSpaDES",
signature(x = "character", value = "ANY"),
definition = function(x, value, ...) {
assign(x, value, envir=.spadesEnv, ...)
assign(x, value, envir = .spadesEnv, ...)
})

#' @rdname assignSpaDES
Expand Down Expand Up @@ -199,6 +199,6 @@ setMethod(
"changeObjEnv",
signature = c("list", "ANY", "ANY", "ANY"),
definition = function(x, toEnv, fromEnv, rmSrc) {
list2env(x, envir=toEnv)
list2env(x, envir = toEnv)

})
2 changes: 1 addition & 1 deletion R/load.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ setMethod(
# The actual load call
if(identical(loadFun[x], "load")) {
do.call(getFromNamespace(loadFun[x], loadPackage[x]),
args = argument, envir=envir(sim))
args = argument, envir = envir(sim))

} else {
sim[[objectName[x]]] <- do.call(getFromNamespace(loadFun[x], loadPackage[x]),
Expand Down
44 changes: 43 additions & 1 deletion R/misc-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,11 @@ setMethod("normPath",
normalizePath(x, winslash = "/", mustWork = FALSE)
}
}) %>%
unlist %>%
unlist() %>%
gsub("^[.]", paste0(getwd()), .) %>%
gsub("\\\\", "//", .) %>%
gsub("//", "/", .) %>%
gsub("^/private/var/", "/var/", .) %>%
gsub("/$", "", .)
})

Expand Down Expand Up @@ -674,3 +675,44 @@ sortDotsFirst <- function(obj) {
append(obj[dotObjs][order(names(obj[dotObjs]))],
obj[-dotObjs][order(names(obj[-dotObjs]))])
}

#' Compare module version against SpaDES package version and warn if incompatible
#'
#' Performs a basic check to ensure the module version is compatible with the
#' SpaDES package version.
#' Compatibility is best assured when both versions are equal.
#' If module version < spades version, there is likely no problem, as SpaDES
#' should be backwards compatible.
#' However, if module version > spades version, the user needs to update their
#' version of SpaDES because module compatibility cannot be assured.
#'
#' @param moduleName Character string providing the module name.
#' @param moduleVersion The module version as either a character, numeric, or
#' numeric version (e.g., extracted from module metadata).
#' Is coerced to \code{numeric_version}.
#' @return Logical (invisibly) indicating whether the module is compatible with
#' the version of the SpaDES package.
#' Will also produce a warning if not compatible.
#'
#' @author Alex Chubaty
#'
setGeneric("versionWarning", function(moduleName, moduleVersion) {
standardGeneric("versionWarning")
})

#' @rdname versionWarning
setMethod(
"versionWarning",
signature(moduleName = "character", moduleVersion = "ANY"),
definition = function(moduleName, moduleVersion) {
moduleVersion <- as.numeric_version(moduleVersion)
pkgVersion <- packageVersion("SpaDES")

isOK <- (pkgVersion >= moduleVersion)

if (!isOK) {
warning("Module version (", moduleVersion, ") does not match ",
"SpaDES package version (", pkgVersion, ").\n")
}
return(invisible(isOK))
})
10 changes: 3 additions & 7 deletions R/module-repository.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### deal with spurious httr warnings
if(getRversion() >= "3.1.0") {
if (getRversion() >= "3.1.0") {
utils::globalVariables(c("actualFile", "content", "result"))
}

Expand Down Expand Up @@ -161,11 +161,7 @@ setMethod(
checkModule(name, repo)
if (is.na(version)) version <- getModuleVersion(name, repo)

if (packageVersion("SpaDES") != as.numeric_version(version)) {
warning("Module version (", as.numeric_version(version),
") does not match SpaDES package version (",
packageVersion("SpaDES"), ").\n")
}
versionWarning(name, version)

zip <- paste0("https://raw.githubusercontent.com/", repo,
"/master/modules/", name, "/", name, "_", version, ".zip")
Expand All @@ -181,7 +177,7 @@ setMethod(
stringsAsFactors = FALSE)
if (!is.null(children)) {
if ( all( nzchar(children) & !is.na(children) ) ) {
tmp <- lapply(children, function (x) {
tmp <- lapply(children, function(x) {
f <- downloadModule(x, path = path, data = data)
files2 <<- append(files2, f[[1]])
dataList2 <<- bind_rows(dataList2, f[[2]])
Expand Down
Loading

0 comments on commit 5ffff62

Please sign in to comment.