Skip to content
Open
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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ r_packages:
r_github_packages:
- rstudio/rmarkdown
- hadley/pkgdown

- zoonproject/modules@dark_modules

## After success update the code coverage and deploy the pkgdown to gh-pages
after_success:
- Rscript -e 'library(covr);codecov()'
Expand Down
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Description: Reproducible and remixable species distribution modelling. The
SDM workflows and returns output that is fully reproducible.
License: BSD_3_clause + file LICENSE
Imports:
remotes,
gh,
dismo,
methods,
plyr,
Expand Down
7 changes: 2 additions & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ export(FindExtent)
export(GetMaxEnt)
export(GetModuleList)
export(GetPackage)
export(LoadModule)
export(Model)
export(ModuleArguments)
export(ModuleHelp)
export(Occurrence)
export(Output)
export(Process)
Expand All @@ -43,11 +40,11 @@ import(roxygen2)
import(rworldmap)
import(sp)
import(testthat)
importFrom(RCurl,getURL)
importFrom(RCurl,url.exists)
importFrom(SDMTools,auc)
importFrom(SDMTools,confusion.matrix)
importFrom(future,future_lapply)
importFrom(gh,gh)
importFrom(grDevices,dev.off)
importFrom(grDevices,grey)
importFrom(grDevices,png)
Expand All @@ -62,8 +59,8 @@ importFrom(stats,na.omit)
importFrom(utils,browseURL)
importFrom(utils,capture.output)
importFrom(utils,data)
importFrom(utils,download.file)
importFrom(utils,install.packages)
importFrom(utils,installed.packages)
importFrom(utils,methods)
importFrom(utils,packageDescription)
importFrom(utils,sessionInfo)
132 changes: 0 additions & 132 deletions R/HelpFunctions.R

This file was deleted.

45 changes: 0 additions & 45 deletions R/ModuleArguments.R

This file was deleted.

49 changes: 49 additions & 0 deletions R/sync_modules.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# check the modules are up to date and fetch them if not
#' @noRd
#' @importFrom gh gh
latest_sha <- function() {
query <- paste("/repos",
getOption("zoonModulesRepo"),
"branches",
getOption("zoonModulesBranch"),
sep = "/")
branch <- gh::gh(query)
branch$commit$sha
}

#' @noRd
#' @importFrom utils packageDescription
current_sha <- function () {
suppressWarnings(desc <- utils::packageDescription("zoon.modules"))
sha <- ""
if (inherits(desc, "packageDescription")) {
sha <- desc$RemoteSha
if (is.null(sha))
sha <- ""
}
sha
}

sync_modules <- function () {

# see if the modules are out of date
if (latest_sha() != current_sha()) {
message("\nyour zoon modules are out of date")

# give the user the option to update
if (interactive()) {

message("would you like to update them?")
installChoice <- utils::menu(c("yes", "no"))

if (installChoice == 1) {
remotes::install_github(getOption("zoonModulesRepo"), ref = getOption("zoonModulesBranch"),
dependencies = FALSE, quiet = TRUE)
message("zoon modules updated")
}
}
}

# try to load them
suppressWarnings(require("zoon.modules", quietly = TRUE))
}
45 changes: 0 additions & 45 deletions R/test_outputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ test_occurrence_outputs <- function (roxy_parse, modulePath, en) {
NaiveRandomRaster <- Crossvalidate <- LogisticRegression <- NULL
NoProcess <- PrintMap <- NULL

## Move these to the sections where they are needed
LoadModule("Background")
LoadModule("BackgroundAndCrossvalid")
LoadModule("Crossvalidate")
LoadModule("LogisticRegression")
LoadModule("NaiveRandomRaster")
LoadModule("NoProcess")
LoadModule("PrintMap")

# Load the script
source(modulePath)

Expand Down Expand Up @@ -308,13 +299,6 @@ test_covariate_outputs <- function (roxy_parse, modulePath, en) {
LogisticRegression <- NaiveRandomPresence <- NULL
PrintMap <- NULL

## Move these to the sections where they are needed
LoadModule("Background")
LoadModule("BackgroundAndCrossvalid")
LoadModule("LogisticRegression")
LoadModule("NaiveRandomPresence")
LoadModule("PrintMap")

# Load the script
source(modulePath)

Expand Down Expand Up @@ -455,18 +439,6 @@ test_process_outputs <- function (roxy_parse, modulePath, en) {
NoProcess <- NULL
PrintMap <- Domain <- UKAir <- UKAnophelesPlumbeus <- NULL

## Move these to the sections where they are needed
LoadModule("Background")
LoadModule("NaiveRandomPresenceAbsence")
LoadModule("Crossvalidate")
LoadModule("LogisticRegression")
LoadModule("NaiveRandomRaster")
LoadModule("NoProcess")
LoadModule("PrintMap")
LoadModule("Domain")
LoadModule("UKAir")
LoadModule("UKAnophelesPlumbeus")

# Load the script
source(modulePath)

Expand Down Expand Up @@ -780,17 +752,6 @@ test_model_outputs <- function (roxy_parse, modulePath, en) {
NaiveRandomPresenceAbsence <- NoProcess <- PerformanceMeasures <- NULL
PrintMap <- UKAir <- UKAnophelesPlumbeus <- NULL

## Move these to the sections where they are needed
LoadModule("Background")
LoadModule("Crossvalidate")
LoadModule("NaiveRandomRaster")
LoadModule("NaiveRandomPresenceAbsence")
LoadModule("NoProcess")
LoadModule("PerformanceMeasures")
LoadModule("PrintMap")
LoadModule("UKAir")
LoadModule("UKAnophelesPlumbeus")

# Load the script
source(modulePath)

Expand Down Expand Up @@ -1120,12 +1081,6 @@ test_output_outputs <- function (roxy_parse, modulePath, en) {
Background <- LogisticRegression <- NULL
UKAir <- UKAnophelesPlumbeus <- NULL

## Move these to the sections where they are needed
LoadModule("Background")
LoadModule("LogisticRegression")
LoadModule("UKAir")
LoadModule("UKAnophelesPlumbeus")

# Load the script
source(modulePath)

Expand Down
Loading