Skip to content
Permalink
Browse files

Add typecheck to source inject in preprocessor.

  • Loading branch information
robertzk committed Dec 22, 2016
1 parent ed9663b commit 6f0951e1fa2e42274a396b5f5fba8db2299d8da2
Showing with 7 additions and 2 deletions.
  1. +2 −1 CHANGELOG.md
  2. +1 −1 DESCRIPTION
  3. +4 −0 R/resource-preprocessor.R
@@ -1,6 +1,7 @@
## 0.3.0.5.9001
## 0.3.0.5.9001-9002

* Added the `helper` inject to the preprocessor.
* Added a typecheck to the preprocessor `source` inject.

## 0.3.0.5.9000

@@ -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.9001
Version: 0.3.0.5.9002
Authors@R: c(person("Robert", "Krzyzanowski",
email = "technoguyrob@gmail.com", role = c("aut", "cre")))
Depends:
@@ -124,6 +124,10 @@ apply_preprocessor_route <- function(active_resource, route, args, filename) {
filename = active_resource$injects$filename,
source_env = active_resource$state$preprocessor.source_env,
source = function() eval.parent(quote({
if (!is.character(filename)) {
stop("Director of project ", sQuote(crayon::yellow(director$root())),
" attempted to source filename of class ", class(filename)[1L], call. = FALSE)
}
if (!file.exists(filename)) {
stop("Director of project ", sQuote(crayon::yellow(director$root())),
" attempted to source ", sQuote(crayon::red(filename)),

0 comments on commit 6f0951e

Please sign in to comment.
You can’t perform that action at this time.