Parse and extract a module's version

moduleVersion(module, path, sim, envir = NULL)

# S4 method for character,character,missing
moduleVersion(module, path, envir)

# S4 method for character,missing,missing
moduleVersion(module, envir)

# S4 method for character,missing,simList
moduleVersion(module, sim, envir)

Arguments

module

Character string. Your module's name.

path

Character string specifying the file path to modules directory. Default is to use the spades.modulePath option.

sim

A simList simulation object, generally produced by simInit.

envir

Optional environment in which to store parsed code. This may be useful if the same file is being parsed multiple times. This function will check in that envir for the parsed file before parsing again. If the envir is transient, then this will have no effect.

Value

numeric_version indicating the module's version.

See also

Author

Alex Chubaty

Examples

# using filepath path <- system.file("sampleModules", package = "SpaDES.core") moduleVersion("caribouMovement", path)
#> [1] ‘1.6.0’
# using simList options("spades.useRequire" = FALSE) mySim <- simInit( times = list(start = 2000.0, end = 2002.0, timeunit = "year"), params = list( .globals = list(stackName = "landscape", burnStats = "nPixelsBurned") ), modules = list("caribouMovement"), paths = list(modulePath = path) )
#> Setting: #> options( #> spades.modulePath = '/tmp/RtmpcJlADb/temp_libpath210dfc3d37b12d/SpaDES.core/sampleModules' #> )
#> Paths set to: #> options( #> rasterTmpDir = '/tmp/RtmpEykBFD/raster' #> reproducible.cachePath = '/tmp/RtmpEykBFD/Require/cache' #> spades.inputPath = '/tmp/Rtmpz5Ma2s/SpaDES/inputs' #> spades.outputPath = '/tmp/Rtmpz5Ma2s/SpaDES/outputs' #> spades.modulePath = '/tmp/RtmpcJlADb/temp_libpath210dfc3d37b12d/SpaDES.core/sampleModules' #> )
#> caribouMovement: module code: landscape, caribou are declared in metadata inputObjects, but no default(s) are provided in .inputObjects
#> caribouMovement: inputObjects: habitatQuality is used from sim inside Move, but is not declared in metadata inputObjects
#> Global parameter(s) not used in any module: burnStats.
moduleVersion("caribouMovement", sim = mySim)
#> [1] ‘1.6.0’