Skip to content

Commit

Permalink
Merge pull request #278 from FOR-CAST/startup-msg
Browse files Browse the repository at this point in the history
move packageStartupMessage to .onAttach
  • Loading branch information
kdaust committed May 25, 2024
2 parents e126caf + 411fe1f commit 3cac210
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion R/climr-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
## usethis namespace: end
NULL

.onAttach <- function(libname, pkgname) {
packageStartupMessage(
"climr version 0.1.0 includes an overhaul of the naming conventions ",
"for variables, functions, parameters, and options. ",
"Call `data(name_changes)` for a table specifying the correspondence ",
"between old and new names. ",
"If you have used a previous version of climr you MUST call `cache_clear()` ",
"before using this one."
)
}

# On load, instantiate either as new or from cache
#' @importFrom data.table fwrite
#' @importFrom RPostgres dbGetQuery
Expand All @@ -13,7 +24,6 @@ NULL
.onLoad <- function(libname, pkgname) {
rInfoPath <- file.path(R_user_dir("climr", "data"), "run_info")

packageStartupMessage("climr version 0.1.0 includes an overhaul of the naming conventions for variables, functions, parameters, and options. Call `data(name_changes)` for a table specifying the correspondence between old and new names. If you have used a previous version of climr you MUST call `cache_clear()` before using this one.")
dbCon <- data_connect()
on.exit(try(pool::poolClose(dbCon)), add = TRUE)

Expand Down

0 comments on commit 3cac210

Please sign in to comment.