Skip to content

Commit

Permalink
🚚 Move default config data from external file to internal data
Browse files Browse the repository at this point in the history
  • Loading branch information
NONONOexe committed Dec 22, 2024
1 parent 4125d75 commit 83472f9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
10 changes: 2 additions & 8 deletions R/config.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#' @seealso [reset_config()] for resetting the configuration.
#' @export
#' @examples
#' \dontrun{
#' config <- get_config()
#' }
#' get_config()
get_config <- function() {
config <- getOption("jpaccidents.config")
if (is.null(config)) {
Expand Down Expand Up @@ -53,11 +51,7 @@ load_config <- function(config_path) {
#' @examples
#' reset_config()
reset_config <- function() {
load_config(system.file(
"config",
"jpaccidents-config.yaml",
package = "jpaccidents"
))
options(jpaccidents.config = default_config)
}

#' @export
Expand Down
Binary file added R/sysdata.rda
Binary file not shown.
10 changes: 10 additions & 0 deletions data-raw/default_config.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
library(here)
library(yaml)
library(usethis)

config_path <- here("data-raw", "jpaccidents-config.yaml")
default_config <- read_yaml(config_path)
attr(default_config, "path") <- config_path
class(default_config) <- "jpaccidents_config"

use_data(default_config, overwrite = TRUE, internal = TRUE)
File renamed without changes.
4 changes: 1 addition & 3 deletions man/get_config.Rd

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

0 comments on commit 83472f9

Please sign in to comment.