Skip to content

Commit

Permalink
Revert "Replace repo_dir in other files as well"
Browse files Browse the repository at this point in the history
This reverts commit 527fddd.
  • Loading branch information
karangattu committed Oct 27, 2023
1 parent 527fddd commit 11381ea
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 26 deletions.
4 changes: 2 additions & 2 deletions R/accept_snaps.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' @inheritParams fix_snaps
#' @export
accept_snaps <- function(
repo_dir = rprojroot::find_package_root_file()
repo_dir = "."
) {

app_paths <- repo_apps_paths(repo_dir)
Expand All @@ -32,7 +32,7 @@ accept_snaps <- function(


# Removes all snaps that are below the minimum R version
remove_snaps_cruft <- function(repo_dir = rprojroot::find_package_root_file(), min_r_version = "3.6") {
remove_snaps_cruft <- function(repo_dir = ".", min_r_version = "3.6") {
app_paths <- repo_apps_paths(repo_dir)

pb <- progress_bar(
Expand Down
8 changes: 4 additions & 4 deletions R/apps.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ is_manual_app <- function(app_dir) {


### Start GHA
apps_with_tests <- function(repo_dir = rprojroot::find_package_root_file()) {
apps_with_tests <- function(repo_dir = ".") {
basename(Filter(x = repo_apps_paths(repo_dir), has_tests_folder))
}
repo_apps_path <- function(repo_dir = rprojroot::find_package_root_file()) {
repo_apps_path <- function(repo_dir = ".") {
file.path(repo_dir, "inst", "apps")
}
repo_apps_paths <- function(repo_dir = rprojroot::find_package_root_file()) {
repo_apps_paths <- function(repo_dir = ".") {
dir(repo_apps_path(repo_dir), pattern = "^\\d\\d\\d-", full.names = TRUE)
}
repo_app_path <- function(app_name, repo_dir = rprojroot::find_package_root_file()) {
repo_app_path <- function(app_name, repo_dir = ".") {
file.path(repo_apps_path(repo_dir), app_name)
}

Expand Down
9 changes: 3 additions & 6 deletions R/fix_snaps.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fix_snaps <- function(
ask_apps = FALSE,
ask_branches = TRUE,
ask_if_not_main = TRUE,
repo_dir = rprojroot::find_package_root_file()
repo_dir = "."
) {
original_sys_call <- sys.call()
ask_apps <- as.logical(ask_apps)
Expand All @@ -38,9 +38,6 @@ fix_snaps <- function(
# validate_core_pkgs()

apps_folder <- file.path(repo_dir, "inst", "apps")
if (!dir.exists(apps_folder)) {
stop("Apps folder does not exist: ", apps_folder)
}

verify_if_not_main_branch(ask_if_not_main, repo_dir = repo_dir)
verify_no_git_changes(repo_dir = repo_dir, apps_folder = apps_folder)
Expand Down Expand Up @@ -278,7 +275,7 @@ fix_snaps <- function(
f = function(app_name) {
pb$tick(tokens = list(name = app_name))
# Use `.` as `git_cmd_` runs within `repo_dir`
app_path <- repo_app_path(repo_dir = rprojroot::find_package_root_file(), app_name = app_name)
app_path <- repo_app_path(repo_dir = ".", app_name = app_name)
git_cmd_("git checkout -- ", app_path)
git_cmd_("git clean -df -- ", app_path)
}
Expand All @@ -294,7 +291,7 @@ fix_snaps <- function(


# Note: Logic should be duplicated in pre-check GHA workflow
verify_no_new_snaps <- function(repo_dir = rprojroot::find_package_root_file(), folder = "inst/apps") {
verify_no_new_snaps <- function(repo_dir = ".", folder = "inst/apps") {
new_snaps <- dir(file.path(repo_dir, folder), pattern = "\\.new", recursive = TRUE, include.dirs = FALSE)
if (length(new_snaps) > 0) {
message("There should be no `.new` _snaps in `", folder, "`. Found: \n", paste0("* ", new_snaps, collapse = "\n"))
Expand Down
2 changes: 1 addition & 1 deletion R/save-test-results.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @inheritParams test_in_local
#' @rdname test-results
#' @export
save_test_results <- function(output, gha_branch_name, pr_number, username, repo_dir = rprojroot::find_package_root_file()) {
save_test_results <- function(output, gha_branch_name, pr_number, username, repo_dir = ".") {
if (!inherits(output, "shinycoreci_test_output")) {
stop("`output` must be an object returned by test_in_local()", call. = FALSE)
}
Expand Down
2 changes: 1 addition & 1 deletion R/test-in-local.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test_in_local <- function(
assert = TRUE,
timeout = 10 * 60,
retries = 2,
repo_dir = rprojroot::find_package_root_file()
repo_dir = "."
) {
retries <- as.numeric(retries)
repo_dir <- normalizePath(repo_dir, mustWork = TRUE)
Expand Down
2 changes: 1 addition & 1 deletion R/view-test-images.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' @param repo_dir directory to the shinycoreci repo
#' @export
view_test_images <- function(repo_dir = rprojroot::find_package_root_file()) {
view_test_images <- function(repo_dir = ".") {
app_folders <- Filter(repo_apps_paths(repo_dir), f = function(app_folder) {
dir.exists(file.path(app_folder, "tests/testthat/_snaps"))
})
Expand Down
2 changes: 1 addition & 1 deletion man/accept_snaps.Rd

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

2 changes: 1 addition & 1 deletion man/fix_snaps.Rd

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

8 changes: 1 addition & 7 deletions man/test-results.Rd

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

2 changes: 1 addition & 1 deletion man/test_in_local.Rd

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

2 changes: 1 addition & 1 deletion man/view_test_images.Rd

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

0 comments on commit 11381ea

Please sign in to comment.