diff --git a/CHANGELOG.md b/CHANGELOG.md index 391deae..eaaa7e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.3.0.5.9000 + +* Started development version and fixed issue with modification + tracking on virtual resources. + ## 0.3.0.5 * Fix an issue where sourcing a virtual resource with a preprocessor diff --git a/DESCRIPTION b/DESCRIPTION index b0995a2..f8a5936 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,7 +5,7 @@ Description: Director is responsible for managing and loading resources in consecutive loads of resources (so that we can tell if a script was modified since we last ran it) and defining parsers that allow us to generalize from the pernicious simple linear execution that is common to R. -Version: 0.3.0.5 +Version: 0.3.0.5.9000 Authors@R: c(person("Robert", "Krzyzanowski", email = "technoguyrob@gmail.com", role = c("aut", "cre"))) Depends: diff --git a/R/resource-modification_tracker.R b/R/resource-modification_tracker.R index 4785bb2..ecde3c8 100644 --- a/R/resource-modification_tracker.R +++ b/R/resource-modification_tracker.R @@ -107,10 +107,16 @@ modification_tracker <- function(object, ..., modification_tracker.return = "obj ## We injected `virtual` in the previous layer, `virtual_checker`, using ## `object$injects %<<% list(virtual = virtual)` if (isTRUE(object$injects$virtual)) { - ## Virtual resources are always considered to be modified, since we have + ## Virtual resources are never considered to be modified, since we have ## have no corresponding file and we have no way to tell. - object$injects %<<% list(modified = TRUE) - yield() + if (identical(modification_tracker.return, "modified")) { + FALSE + } else if (identical(modification_tracker.return, "mtime")) { + NULL + } else { + object$injects %<<% list(modified = FALSE) + yield() + } } else { ## In order to keep track of whether the resource has been modified, ## we will need to store the previous and current modification time diff --git a/R/resource-parser.R b/R/resource-parser.R index fc73c2f..adf0bae 100644 --- a/R/resource-parser.R +++ b/R/resource-parser.R @@ -44,7 +44,8 @@ apply_parser <- function(active_resource, route, args) { environment(parser_function) environment(parser_function) <- - new.env(parent = sourcing_env) %<<% list( + new.env(parent = sourcing_env) %<<% + active_resource$injects %<<% list( # TODO: (RK) Intersect with parser formals. # TODO: (RK) Use alist so these aren't evaluated right away. resource = active_resource$resource$name,