Skip to content

Commit

Permalink
Deprecate beautier functions
Browse files Browse the repository at this point in the history
  • Loading branch information
richelbilderbeek committed Jun 13, 2022
1 parent 7d39a6c commit 7bc8ea1
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 44 deletions.
16 changes: 5 additions & 11 deletions R/create_beautier_tempfolder.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
#' Deprecated function, use \link[beautier]{create_beautier_tempfolder}.
#'
#' Create the default `beautier` temporary folder
#' @return nothing
#' @examples
#' check_empty_beaustier_folders()
#'
#' create_beautier_tempfolder()
#'
#' remove_beaustier_folders()
#' check_empty_beaustier_folders()
#' @author Richèl J.C. Bilderbeek
#' @export
create_beautier_tempfolder <- function() {
dir.create(
dirname(beautier::get_beautier_tempfilename()),
showWarnings = FALSE,
recursive = TRUE
stop(
"'beastier::create_beautier_tempfolder' is deprecated, ",
"use 'beautier::create_beautier_tempfolder' instead"
)
}
2 changes: 1 addition & 1 deletion R/remove_beaustier_folders.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
#' @export
remove_beaustier_folders <- function() {
beastier::remove_beastier_folder()
beastier::remove_beautier_folder()
beautier::remove_beautier_folder()
}
14 changes: 7 additions & 7 deletions R/remove_beautier_folder.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#' Check there are no files in the default `beautier` folder
#' Deprecated function, use \link[beautier]{remove_beautier_folder}.
#'
#' Deprecated function, use \link[beautier]{remove_beautier_folder}.
#'
#' Check there are no files in the default `beautier` folder.
#' The goal is to make sure no temporary files are left undeleted.
#' Will \link{stop} if there are files in the `beautier` folder.
#'
#' @return Nothing.
#' @examples
#' remove_beautier_folder()
#' @author Richèl J.C. Bilderbeek
#' @export
remove_beautier_folder <- function() {
folder_name <- beautier::get_beautier_folder()
if (dir.exists(folder_name)) {
unlink(folder_name, recursive = TRUE)
}
stop(
"'beastier::remove_beautier_folder' is deprecated, ",
"use 'beautier::remove_beautier_folder' instead"
)
}
2 changes: 1 addition & 1 deletion R/run_beast2_from_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ run_beast2_from_options <- function(
# Create the folders needed
##############################################################################

beastier::create_beautier_tempfolder()
beautier::create_beautier_tempfolder()
beastier::create_beastier_tempfolder()
beastier::create_beast2_input_file_folder(beast2_options)
beastier::create_beast2_state_output_file_folder(beast2_options)
Expand Down
10 changes: 1 addition & 9 deletions man/create_beautier_tempfolder.Rd

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

8 changes: 4 additions & 4 deletions man/remove_beautier_folder.Rd

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

16 changes: 5 additions & 11 deletions tests/testthat/test-create_beautier_tempfolder.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
test_that("use", {
check_empty_beaustier_folders()

folder_name <- dirname(beautier::get_beautier_tempfilename())
unlink(folder_name, recursive = TRUE)
expect_false(dir.exists(folder_name))
beastier::create_beautier_tempfolder()
expect_true(dir.exists(folder_name))

remove_beaustier_folders()
check_empty_beaustier_folders()
test_that("deprecated", {
expect_error(
beastier::create_beautier_tempfolder(),
"deprecated"
)
})
6 changes: 6 additions & 0 deletions tests/testthat/test-remove_beautier_folder.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test_that("deprecated", {
expect_error(
beastier::remove_beautier_folder(),
"deprecated"
)
})

0 comments on commit 7bc8ea1

Please sign in to comment.