-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci_test.R
35 lines (29 loc) · 1.2 KB
/
ci_test.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# config
deps <- 'overview.R';
expected_out <- c('data','dictionary','example_analysis'
,'prep_deps','simdata');
cleanup_files <- '*\\.html$|*\\.R.rdata$|_files$|_cache$';
# cleanup
unlink(list.files(pattern=cleanup_files),recursive = TRUE, force = TRUE);
# load scripts
if(file.exists(scripts<-normalizePath('scripts/functions.R',winslash='/'))){
source(scripts);
message('Project functions loaded.')
} else stop(scripts,' not found!');
# verify that required files exist and run the render
if(!file.exists('config.R')) stop('config.R not found!');
if(!all(deps_found<-file.exists(deps))) {
stop('scripts missing:\n',paste(names(deps)[!deps_found],collapse=', '))
} else {
load_deps2(deps,debug = TRUE);
message('load_deps2() has run');
}
# verify that RData files were created
if(!all(rdata_found<-file.exists(paste0(expected_out,'.R.rdata')))){
stop('RData missing:\n',paste(names(rdata_found)[!rdata_found],collapse=', '));
} else message('All RData created');
# verify that HTML files were created
if(!all(html_found<-file.exists(paste0(expected_out,'.html')))){
stop('html missing:\n',paste(names(html_found)[!html_found],collapse=', '));
} else message('All HTML created');
c()