-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to the zzz.R file. Added delete_env.R and reset_env.R. Updated NAMESPACE and DESCRIPTION.
- Loading branch information
Showing
7 changed files
with
190 additions
and
58 deletions.
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
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
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,40 @@ | ||
#' Delete the rMIDAS Environment and Configuration | ||
#' | ||
#' Deletes both the virtual environment and the configuration file for the rMIDAS package. | ||
#' After deletion, it is necessary to restart the R session and then load the rMIDAS package once more. | ||
#' This will trigger the setup process again. | ||
#' | ||
#' @name delete_rMIDAS_env | ||
#' @aliases delete_rMIDAS_env | ||
#' @return A message indicating the completion of the deletion process. | ||
#' @export | ||
|
||
delete_rMIDAS_env <- function() { | ||
|
||
if (requireNamespace("rappdirs", quietly = TRUE)) { | ||
config_dir <- rappdirs::user_config_dir(appname = "rMIDAS") | ||
config_file <- file.path(config_dir, ".rMIDAS_config") | ||
|
||
virtual_env_dir <- rappdirs::user_data_dir(appname = "rMIDAS") | ||
virtual_env_name <- file.path(virtual_env_dir, "rMIDAS_env_auto_setup") | ||
|
||
} else { | ||
stop("The 'rappdirs' package is required to determine the directories. Please install it.") | ||
} | ||
|
||
if (dir.exists(virtual_env_name)) { | ||
unlink(virtual_env_name, recursive = TRUE) | ||
message("rMIDAS virtual environment deleted successfully.") | ||
} else { | ||
message("rMIDAS virtual environment not found.") | ||
} | ||
|
||
if (file.exists(config_file)) { | ||
file.remove(config_file) | ||
message("rMIDAS configuration file deleted successfully.") | ||
} else { | ||
message("rMIDAS configuration file not found.") | ||
} | ||
|
||
message("Please restart the R session and then load rMIDAS to set up the environment again.") | ||
} |
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,32 @@ | ||
#' Reset the rMIDAS Environment Configuration | ||
#' | ||
#' Resets the configuration for the rMIDAS package by deleting the configuration file. | ||
#' Once the configuration is reset, it is necessary to restart the R session | ||
#' and then load the rMIDAS package once more. | ||
#' | ||
#' @name reset_rMIDAS_env | ||
#' @aliases reset_rMIDAS_env | ||
#' @return A message indicating the completion of the reset process. | ||
#' @export | ||
|
||
reset_rMIDAS_env <- function() { | ||
# Use rappdirs to get the appropriate user configuration directory | ||
if (requireNamespace("rappdirs", quietly = TRUE)) { | ||
config_dir <- rappdirs::user_config_dir(appname = "rMIDAS") | ||
config_file <- file.path(config_dir, ".rMIDAS_config") | ||
} else { | ||
stop("The 'rappdirs' package is required to determine the configuration directory. Please install it.") | ||
} | ||
|
||
if (!file.exists(config_file)) { | ||
stop("rMIDAS config file doesn't exist.") | ||
} | ||
|
||
# Option 1: Delete the entire config file. | ||
file.remove(config_file) | ||
|
||
# OR Option 2: Overwrite the config file with a default or empty value. | ||
# writeLines("", con = config_file) | ||
|
||
message("rMIDAS configuration reset. Please restart the R session and then load rMIDAS again.") | ||
} |
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.