-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add function for creating all exercises at once @jimgar
- Loading branch information
Showing
10 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(create_all_exercises) | ||
export(exo_committed_to_main) | ||
export(exo_latest_message) | ||
export(exo_one_small_change) | ||
export(exo_split_changes) | ||
importFrom(rlang,`%||%`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#' Create all exercises folder at once | ||
#' | ||
#' But do not open them! | ||
#' | ||
#' @inheritParams exo_one_small_change | ||
#' | ||
#' @return The parent path | ||
#' @export | ||
#' | ||
create_all_exercises <- function(parent_path) { | ||
rlang::local_interactive(FALSE) | ||
|
||
funs <- getNamespaceExports("saperlipopette") | ||
funs <- setdiff(funs, "create_all_exercises") | ||
purrr::walk(funs, rlang::exec, parent_path = parent_path) | ||
|
||
fs::dir_tree(parent_path) | ||
return(parent_path) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#' @keywords internal | ||
#' @importFrom rlang `%||%` | ||
"_PACKAGE" | ||
|
||
## usethis namespace: start | ||
## usethis namespace: end | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
create_project <- function(path) { | ||
rlang::with_options( | ||
usethis.quiet = FALSE, | ||
usethis.quiet = getOption("usethis.quiet") %||% FALSE, | ||
usethis::create_project(path) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# create_all_exercises() works | ||
|
||
Code | ||
create_all_exercises(parent_path) | ||
Output | ||
+-- committed-to-main | ||
| +-- R | ||
| \-- bla | ||
+-- latest-message | ||
| +-- R | ||
| \-- bla | ||
+-- one-small-change | ||
| +-- R | ||
| \-- bla | ||
\-- split-changes | ||
\-- R | ||
\-- script.R | ||
[1] "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
test_that("create_all_exercises() works", { | ||
rlang::local_options(cli.default_handler = function(msg) invisible(NULL)) | ||
parent_path <- withr::local_tempdir() | ||
expect_snapshot( | ||
create_all_exercises(parent_path), | ||
transform = function(x) gsub(parent_path, "", x, fixed = TRUE) | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters