Skip to content

Commit

Permalink
Pass all run_examples parameters to child process.
Browse files Browse the repository at this point in the history
Squashed commit of the following.

commit dc389c8
Merge: adc3a78 a06b67d
Author: schneidernw <[email protected]>
Date:   Tue Aug 15 12:30:55 2017 -0400

    Merge remote-tracking branch 'hadley/master' into refactor_run_examples_1454

commit adc3a78
Merge: 751aec1 0128ed8
Author: schneidernw <[email protected]>
Date:   Thu Aug 10 16:30:55 2017 -0400

    Merge remote-tracking branch 'hadley/master' into refactor_run_examples_1454

commit 751aec1
Author: Neil-Schneider <[email protected]>
Date:   Thu Aug 10 14:28:52 2017 -0400

    Add leading characters to expected output

    Do this because the test fails because `\n>` is captured by the function in this test environment. Not sure it is a platform issue, but on my windows machine both tests, with and without `\n>` pass.

commit 0cde9d5
Author: schneidernw <[email protected]>
Date:   Wed Aug 9 14:35:13 2017 -0400

    Update documentation

    Do this for the run_example function and the testHelp package.

commit 40fedee
Author: schneidernw <[email protected]>
Date:   Wed Aug 9 14:30:48 2017 -0400

    Update style

    Do this to follow the style guide.

commit 30476c3
Author: Andrew McDavid <[email protected]>
Date:   Fri Jan 27 11:46:38 2017 -0500

    add test for run_examples #1449

commit 2ca091d
Author: schneidernw <[email protected]>
Date:   Wed Aug 9 14:04:28 2017 -0400

    Pass all necessary parameters to secondary call

    Do this because the `run_examples` call in a fresh session should be
    exactly like the first. (Minus `fresh = TRUE`)

commit 4282858
Author: schneidernw <[email protected]>
Date:   Wed Aug 9 14:02:58 2017 -0400

    Place code into else statement

    Do this to avoid running the code twice when `fresh = TRUE`.

commit 5809f12
Author: schneidernw <[email protected]>
Date:   Wed Aug 9 14:01:15 2017 -0400

    Show is deprecated

    Do this because the default value for `show` will trigger the
    deprecated
    warning every time. This shouldn't affect any backward
    compatibility
    since the parameter is currently unused. There is still an
    issue, where the warning is printed from the `callr::r()` when `fresh =
    TRUE`.
  • Loading branch information
schneidernw authored and jimhester committed Aug 15, 2017
1 parent a06b67d commit e215ebf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
24 changes: 13 additions & 11 deletions R/run-examples.r
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,27 @@
#' won't work.
#' @keywords programming
#' @export
run_examples <- function(pkg = ".", start = NULL, show = TRUE, test = FALSE,
run_examples <- function(pkg = ".", start = NULL, show, test = FALSE,
run = TRUE, fresh = FALSE) {
pkg <- as.package(pkg)
document(pkg)

if (!missing(show)) {
warning("`show` is deprecated", call. = FALSE)
}

files <- rd_files(pkg$path, start = start)
if (length(files) == 0)
return()

rule("Running ", length(files), " example files in ", pkg$package)

if (fresh) {
to_run <- eval(substitute(function() devtools::run_examples(path), list(path = pkg$path)))
callr::r(to_run, show = TRUE)
to_run <- eval(substitute(
function() devtools::run_examples(path, start, test, run)
, list(path = pkg$path, start = start, test = test, run = run)))
callr::r(to_run, show = TRUE, spinner = FALSE)
} else {
document(pkg)

files <- rd_files(pkg$path, start = start)
if (length(files) == 0)
return()

rule("Running ", length(files), " example files in ", pkg$package)

load_all(pkg$path, reset = TRUE, export_all = FALSE)
on.exit(load_all(pkg$path, reset = TRUE))

Expand Down
4 changes: 2 additions & 2 deletions man/run_examples.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e215ebf

Please sign in to comment.