From 38f4fc46f0824f22771dae5c38fc9b6c94acb81b Mon Sep 17 00:00:00 2001 From: Dony Unardi Date: Thu, 25 Jan 2024 12:45:39 -0800 Subject: [PATCH] add package name when directory not found (#57) * add package name when directory not found * upversion and update news --- DESCRIPTION | 9 ++++++--- NEWS.md | 4 +++- R/add_pkgs.R | 7 ++++++- inst/WORDLIST | 2 ++ man/multiloadr-package.Rd | 5 +++++ tests/testthat/test-add_list_load_rm_pkgs.R | 2 +- 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 564b0a1..ee1fd2c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,11 @@ Package: multiloadr Type: Package Title: Load the packages relevant to a project within a session -Version: 0.0.1.9000 -Authors@R: person("Dony", "Unardi", email = "donyunardi@gmail.com", role = c("aut", "cre")) +Version: 0.0.2 +Authors@R: c( + person("Dony", "Unardi", email = "donyunardi@gmail.com", role = c("aut", "cre")), + person("Vedha", "Viyash", role = "ctb") + ) Description: The purpose of this package is to assist in loading the R packages that serve as immediate dependencies for the R package currently being worked on. This package is useful for developing multiple interdependent R packages. @@ -10,7 +13,7 @@ License: MIT + file LICENSE Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Imports: devtools, stats diff --git a/NEWS.md b/NEWS.md index 4189afa..000d079 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ -# multiloadr 0.0.1.9000 +# multiloadr 0.0.2 * Add the load_verbose argument to the load_pkgs function and improve the warning message when multiloadr is unable to switch or pull the targeted branch. +* Add color utilities for messages for consistency. +* Improve message when a package is not added to multiloadr. # multiloadr 0.0.1 diff --git a/R/add_pkgs.R b/R/add_pkgs.R index b43fa8c..447fcca 100644 --- a/R/add_pkgs.R +++ b/R/add_pkgs.R @@ -52,7 +52,12 @@ add_pkgs <- function(pkg_name, path) { )) } } else { - cat("Package not added to multiloadr. Directory is not an R package.\n") + cat(paste0( + "\n", + package_name_color(pkg_name), + " not added to multiloadr.", + " The directory path does not exist or is not an R package.\n" + )) } invisible() diff --git a/inst/WORDLIST b/inst/WORDLIST index a692bd3..8f42103 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,2 +1,4 @@ Dony Unardi +Vedha +Viyash diff --git a/man/multiloadr-package.Rd b/man/multiloadr-package.Rd index a21b74d..e351b8d 100644 --- a/man/multiloadr-package.Rd +++ b/man/multiloadr-package.Rd @@ -13,5 +13,10 @@ branches \author{ \strong{Maintainer}: Dony Unardi \email{donyunardi@gmail.com} +Other contributors: +\itemize{ + \item Vedha Viyash [contributor] +} + } \keyword{internal} diff --git a/tests/testthat/test-add_list_load_rm_pkgs.R b/tests/testthat/test-add_list_load_rm_pkgs.R index d07970c..b72a0f8 100644 --- a/tests/testthat/test-add_list_load_rm_pkgs.R +++ b/tests/testthat/test-add_list_load_rm_pkgs.R @@ -3,7 +3,7 @@ test_that("add_pkgs, list_pkgs, load_pkgs, rm_pkgs works", { expect_output(list_pkgs(), "No packages to list.") expect_output( add_pkgs("testing", "/path/to/folder"), - "Directory is not an R package" + "directory path does not exist or is not an R package" ) expect_output(load_pkgs(), "No packages to load")