Skip to content

Commit

Permalink
Fixing startup message issues
Browse files Browse the repository at this point in the history
  • Loading branch information
john-harrold committed Mar 15, 2024
1 parent a5f9a36 commit 9a1a401
Show file tree
Hide file tree
Showing 34 changed files with 1,682 additions and 234 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export(dwrs_builder)
export(fers_builder)
export(fetch_hold)
export(fetch_package_version)
export(formods_check)
export(has_changed)
export(has_updated)
export(icon_link)
Expand Down
87 changes: 73 additions & 14 deletions R/formods.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,86 @@
#'@importFrom writexl write_xlsx
.onLoad <- function(libname, pkgname){

#------------------------------------
# If all the suggested packages are found this will be true:
suggested_found = TRUE
packageStartupMessage("Loading formods")

fcres = formods_check(verbose = FALSE)
if(!fcres[["all_found"]]){
packageStartupMessage("Missing suggested packages")
for(pkg in fcres[["missing_pkgs"]]){
packageStartupMessage(paste0(" - ",pkg))
}
}
}

#'@export
#'@title Checks 'formods' Dependencies
#'@description Looks at the suggests and Loops through each specified module ID or all modules if no ID
#'was specified. For each ID, an attempt will be made to extract any datasets
#'available.
#'@param verbose Logical indicating if messages should be displayed
#'@return List with the following elements:
#' \itemize{
#' \item{all_found:} Boolean indicating if all packages were found
#' \item{found_pkgs:} Character vector of found packages
#' \item{missing_pkgs:} Character vector of missing packages
#'}
#'@examples
#' fcres = formods_check()
formods_check <- function(verbose=TRUE){

#------------------------------------
# Checking for rxpackages
# If all the suggested packages are found this will be true:
suggested_found = TRUE
# mr = FM_message("Loading formods", entry_type="h1")
# mr = FM_message("Checking for suggested packages", entry_type="h2")

pkgs = c(
"clipr", "devtools", "DT",
"flextable", "ggpubr", "gtools",
"here", "janitor", "plotly",
"prompter", "shinybusy", "shinydashboard")
for(pkg in pkgs){
if(!requireNamespace(pkg, quietly=TRUE)){
# mr = FM_message(paste0("missing ", pkg), entry_type="danger")
} else {
# mr = FM_message(paste0("found ", pkg), entry_type="success")
if(verbose){
mr = FM_message("Checking formods for suggested packages", entry_type="h1")
}

pkgs = c(
"clipr",
"covr",
"devtools",
"DT",
"flextable",
"ggpubr",
"gtools",
"here",
"janitor",
"knitr",
"plotly",
"prompter",
"rmarkdown",
"shinybusy",
"shinydashboard",
"testthat",
"utils")

pkg_found = c()
pkg_missing = c()
for(pkg in pkgs){
if(!requireNamespace(pkg, quietly=TRUE)){
if(verbose){
mr = FM_message(paste0("missing ", pkg), entry_type="danger")
}
pkg_missing = c(pkg_missing, pkg)
suggested_found = FALSE
} else {
if(verbose){
mr = FM_message(paste0("found ", pkg), entry_type="success")
}
pkg_found = c(pkg_found , pkg)
}
}
}

res = list(
all_found = suggested_found,
found_pkgs = pkg_found,
missing_pkgs = pkg_missing
)
res}



Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ reference:
- starts_with("FM_")
- fetch_hold
- fetch_package_version
- formods_check
- has_changed
- has_updated
- icon_link
Expand Down
44 changes: 22 additions & 22 deletions docs/articles/included_modules.html

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions docs/articles/making_modules.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ pkgdown_sha: ~
articles:
included_modules: included_modules.html
making_modules: making_modules.html
last_built: 2024-03-13T02:44Z
last_built: 2024-03-15T02:06Z

67 changes: 65 additions & 2 deletions docs/reference/ASM_fetch_code.html

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

Loading

0 comments on commit 9a1a401

Please sign in to comment.