checksums | R Documentation |
Verify (and optionally write) checksums for data files in a module's
‘data/’ subdirectory. The file ‘data/CHECKSUMS.txt’ contains the
expected checksums for each data file.
Checksums are computed using reproducible:::.digest
, which is simply a
wrapper around digest::digest
.
checksums(module, path, ...)
module |
Character string giving the name of the module. |
path |
Character string giving the path to the module directory. |
... |
Passed to |
Modules may require data that for various reasons cannot be distributed with the module source code. In these cases, the module developer should ensure that the module downloads and extracts the data required. It is useful to not only check that the data files exist locally but that their checksums match those expected.
In version 1.2.0 and earlier, two checksums per file were required because of differences in the checksum hash values on Windows and Unix-like platforms. Recent versions use a different (faster) algorithm and only require one checksum value per file. To update your ‘CHECKSUMS.txt’ files using the new algorithm:
specify your module (moduleName <- "my_module"
);
use a temporary location to ensure all modules get fresh copies of the data
(tmpdir <- file.path(tempdir(), "SpaDES_modules")
);
download your module's data to the temp dir (downloadData(moduleName, tmpdir)
);
initialize a dummy simulation to ensure any 'data prep' steps in the
.inputObjects
section are run (simInit(modules = moduleName)
);
recalculate your checksums and overwrite the file
(checksums(moduleName, tmpdir, write = TRUE)
);
copy the new checksums file to your working module directory
(the one not in the temp dir)
(file.copy(from = file.path(tmpdir, moduleName, 'data', 'CHECKSUMS.txt'), to = file.path('path/to/my/moduleDir', moduleName, 'data', 'CHECKSUMS.txt'), overwrite = TRUE)
).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.