Convenience function for sourcing a remake script (or other
arbitrary code) that is present as a character vector rather than
saved in a file. This just takes
care of writing the character vector to a temporary file and
running R's source() over it. It will also source
other arbitrary sets of R code that are character vectors rather
than files.
A character vector containing code to be sourced. Each
element of the vector will be treated as a separate line.
envir
An environment to source into (by default the global
environment).
rewrite_source
Because calls to source() within a
script will still be evaluated in the global environment, so this
may have side-effects when running in a non-global
environment. Setting rewrite_source=TRUE (the default)
attempts to rewrite top-level calls to source() to source
locally. This is likely error prone but the current
implementation matches the way that make_script() produces
calls to source().
Value
The environment into which the code is sourced,
invisibly. This is primarily useful when used as
source_remake_script(script, envir=new.env()), as the
environment created in the call is returned.