From feeff771ff360e341571e18d196b40c63a62d767 Mon Sep 17 00:00:00 2001 From: BradL <34219856+bradlindblad@users.noreply.github.com> Date: Mon, 14 Nov 2022 21:27:34 -0600 Subject: [PATCH 1/6] . --- .Rbuildignore | 0 .github/.gitignore | 0 .github/workflows/R-CMD-check.yaml | 0 .github/workflows/pkgdown.yaml | 0 .github/workflows/test-coverage.yaml | 0 .gitignore | 0 DESCRIPTION | 0 LICENSE | 0 LICENSE.md | 0 NAMESPACE | 0 NEWS.md | 0 R/get_proverbs.R | 0 R/proverbs.R | 0 R/utils-pipe.R | 0 README.Rmd | 0 README.md | 0 _pkgdown.yml | 0 codecov.yml | 0 cran-comments.md | 0 man/figures/README-pressure-1.png | Bin man/figures/lifecycle-archived.svg | 0 man/figures/lifecycle-defunct.svg | 0 man/figures/lifecycle-deprecated.svg | 0 man/figures/lifecycle-experimental.svg | 0 man/figures/lifecycle-maturing.svg | 0 man/figures/lifecycle-questioning.svg | 0 man/figures/lifecycle-stable.svg | 0 man/figures/lifecycle-superseded.svg | 0 man/figures/logo.png | Bin man/pipe.Rd | 0 man/proverb.Rd | 0 man/proverbs.Rd | 0 man/translations.Rd | 0 pkgdown/favicon/apple-touch-icon-120x120.png | Bin pkgdown/favicon/apple-touch-icon-152x152.png | Bin pkgdown/favicon/apple-touch-icon-180x180.png | Bin pkgdown/favicon/apple-touch-icon-60x60.png | Bin pkgdown/favicon/apple-touch-icon-76x76.png | Bin pkgdown/favicon/apple-touch-icon.png | Bin pkgdown/favicon/favicon-16x16.png | Bin pkgdown/favicon/favicon-32x32.png | Bin pkgdown/favicon/favicon.ico | Bin proverbs.Rproj | 0 tests/testthat.R | 0 tests/testthat/test-proverb.R | 0 tests/testthat/test-translations.R | 0 vignettes/.gitignore | 0 vignettes/auto_proverb.Rmd | 0 48 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .Rbuildignore mode change 100644 => 100755 .github/.gitignore mode change 100644 => 100755 .github/workflows/R-CMD-check.yaml mode change 100644 => 100755 .github/workflows/pkgdown.yaml mode change 100644 => 100755 .github/workflows/test-coverage.yaml mode change 100644 => 100755 .gitignore mode change 100644 => 100755 DESCRIPTION mode change 100644 => 100755 LICENSE mode change 100644 => 100755 LICENSE.md mode change 100644 => 100755 NAMESPACE mode change 100644 => 100755 NEWS.md mode change 100644 => 100755 R/get_proverbs.R mode change 100644 => 100755 R/proverbs.R mode change 100644 => 100755 R/utils-pipe.R mode change 100644 => 100755 README.Rmd mode change 100644 => 100755 README.md mode change 100644 => 100755 _pkgdown.yml mode change 100644 => 100755 codecov.yml mode change 100644 => 100755 cran-comments.md mode change 100644 => 100755 man/figures/README-pressure-1.png mode change 100644 => 100755 man/figures/lifecycle-archived.svg mode change 100644 => 100755 man/figures/lifecycle-defunct.svg mode change 100644 => 100755 man/figures/lifecycle-deprecated.svg mode change 100644 => 100755 man/figures/lifecycle-experimental.svg mode change 100644 => 100755 man/figures/lifecycle-maturing.svg mode change 100644 => 100755 man/figures/lifecycle-questioning.svg mode change 100644 => 100755 man/figures/lifecycle-stable.svg mode change 100644 => 100755 man/figures/lifecycle-superseded.svg mode change 100644 => 100755 man/figures/logo.png mode change 100644 => 100755 man/pipe.Rd mode change 100644 => 100755 man/proverb.Rd mode change 100644 => 100755 man/proverbs.Rd mode change 100644 => 100755 man/translations.Rd mode change 100644 => 100755 pkgdown/favicon/apple-touch-icon-120x120.png mode change 100644 => 100755 pkgdown/favicon/apple-touch-icon-152x152.png mode change 100644 => 100755 pkgdown/favicon/apple-touch-icon-180x180.png mode change 100644 => 100755 pkgdown/favicon/apple-touch-icon-60x60.png mode change 100644 => 100755 pkgdown/favicon/apple-touch-icon-76x76.png mode change 100644 => 100755 pkgdown/favicon/apple-touch-icon.png mode change 100644 => 100755 pkgdown/favicon/favicon-16x16.png mode change 100644 => 100755 pkgdown/favicon/favicon-32x32.png mode change 100644 => 100755 pkgdown/favicon/favicon.ico mode change 100644 => 100755 proverbs.Rproj mode change 100644 => 100755 tests/testthat.R mode change 100644 => 100755 tests/testthat/test-proverb.R mode change 100644 => 100755 tests/testthat/test-translations.R mode change 100644 => 100755 vignettes/.gitignore mode change 100644 => 100755 vignettes/auto_proverb.Rmd diff --git a/.Rbuildignore b/.Rbuildignore old mode 100644 new mode 100755 diff --git a/.github/.gitignore b/.github/.gitignore old mode 100644 new mode 100755 diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml old mode 100644 new mode 100755 diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml old mode 100644 new mode 100755 diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/DESCRIPTION b/DESCRIPTION old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/LICENSE.md b/LICENSE.md old mode 100644 new mode 100755 diff --git a/NAMESPACE b/NAMESPACE old mode 100644 new mode 100755 diff --git a/NEWS.md b/NEWS.md old mode 100644 new mode 100755 diff --git a/R/get_proverbs.R b/R/get_proverbs.R old mode 100644 new mode 100755 diff --git a/R/proverbs.R b/R/proverbs.R old mode 100644 new mode 100755 diff --git a/R/utils-pipe.R b/R/utils-pipe.R old mode 100644 new mode 100755 diff --git a/README.Rmd b/README.Rmd old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/_pkgdown.yml b/_pkgdown.yml old mode 100644 new mode 100755 diff --git a/codecov.yml b/codecov.yml old mode 100644 new mode 100755 diff --git a/cran-comments.md b/cran-comments.md old mode 100644 new mode 100755 diff --git a/man/figures/README-pressure-1.png b/man/figures/README-pressure-1.png old mode 100644 new mode 100755 diff --git a/man/figures/lifecycle-archived.svg b/man/figures/lifecycle-archived.svg old mode 100644 new mode 100755 diff --git a/man/figures/lifecycle-defunct.svg b/man/figures/lifecycle-defunct.svg old mode 100644 new mode 100755 diff --git a/man/figures/lifecycle-deprecated.svg b/man/figures/lifecycle-deprecated.svg old mode 100644 new mode 100755 diff --git a/man/figures/lifecycle-experimental.svg b/man/figures/lifecycle-experimental.svg old mode 100644 new mode 100755 diff --git a/man/figures/lifecycle-maturing.svg b/man/figures/lifecycle-maturing.svg old mode 100644 new mode 100755 diff --git a/man/figures/lifecycle-questioning.svg b/man/figures/lifecycle-questioning.svg old mode 100644 new mode 100755 diff --git a/man/figures/lifecycle-stable.svg b/man/figures/lifecycle-stable.svg old mode 100644 new mode 100755 diff --git a/man/figures/lifecycle-superseded.svg b/man/figures/lifecycle-superseded.svg old mode 100644 new mode 100755 diff --git a/man/figures/logo.png b/man/figures/logo.png old mode 100644 new mode 100755 diff --git a/man/pipe.Rd b/man/pipe.Rd old mode 100644 new mode 100755 diff --git a/man/proverb.Rd b/man/proverb.Rd old mode 100644 new mode 100755 diff --git a/man/proverbs.Rd b/man/proverbs.Rd old mode 100644 new mode 100755 diff --git a/man/translations.Rd b/man/translations.Rd old mode 100644 new mode 100755 diff --git a/pkgdown/favicon/apple-touch-icon-120x120.png b/pkgdown/favicon/apple-touch-icon-120x120.png old mode 100644 new mode 100755 diff --git a/pkgdown/favicon/apple-touch-icon-152x152.png b/pkgdown/favicon/apple-touch-icon-152x152.png old mode 100644 new mode 100755 diff --git a/pkgdown/favicon/apple-touch-icon-180x180.png b/pkgdown/favicon/apple-touch-icon-180x180.png old mode 100644 new mode 100755 diff --git a/pkgdown/favicon/apple-touch-icon-60x60.png b/pkgdown/favicon/apple-touch-icon-60x60.png old mode 100644 new mode 100755 diff --git a/pkgdown/favicon/apple-touch-icon-76x76.png b/pkgdown/favicon/apple-touch-icon-76x76.png old mode 100644 new mode 100755 diff --git a/pkgdown/favicon/apple-touch-icon.png b/pkgdown/favicon/apple-touch-icon.png old mode 100644 new mode 100755 diff --git a/pkgdown/favicon/favicon-16x16.png b/pkgdown/favicon/favicon-16x16.png old mode 100644 new mode 100755 diff --git a/pkgdown/favicon/favicon-32x32.png b/pkgdown/favicon/favicon-32x32.png old mode 100644 new mode 100755 diff --git a/pkgdown/favicon/favicon.ico b/pkgdown/favicon/favicon.ico old mode 100644 new mode 100755 diff --git a/proverbs.Rproj b/proverbs.Rproj old mode 100644 new mode 100755 diff --git a/tests/testthat.R b/tests/testthat.R old mode 100644 new mode 100755 diff --git a/tests/testthat/test-proverb.R b/tests/testthat/test-proverb.R old mode 100644 new mode 100755 diff --git a/tests/testthat/test-translations.R b/tests/testthat/test-translations.R old mode 100644 new mode 100755 diff --git a/vignettes/.gitignore b/vignettes/.gitignore old mode 100644 new mode 100755 diff --git a/vignettes/auto_proverb.Rmd b/vignettes/auto_proverb.Rmd old mode 100644 new mode 100755 From 844338303d0ed93d1e74a45f5da73834abc5ae35 Mon Sep 17 00:00:00 2001 From: BradL <34219856+bradlindblad@users.noreply.github.com> Date: Tue, 15 Nov 2022 17:57:41 -0600 Subject: [PATCH 2/6] seems to work? --- DESCRIPTION | 2 +- R/get_proverbs.R | 44 +++++++++++++++++++++++++++++++++++++++----- man/proverb.Rd | 9 ++++++++- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ea19fcb..2eb9128 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,5 +23,5 @@ Suggests: testthat (>= 3.0.0) Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.2 VignetteBuilder: knitr diff --git a/R/get_proverbs.R b/R/get_proverbs.R index 8545e99..c832034 100755 --- a/R/get_proverbs.R +++ b/R/get_proverbs.R @@ -5,7 +5,8 @@ #' For example, on the 27th of August, Proverbs 27 would be returned. #' #' @param translation A character string that is available from list returned by `translations()` -#' +#' @param main_color A character string of a color available in the [crayon package](https://github.com/r-lib/crayon#readme). The color for the main body of text. +#' @param accent_color A character string of a color available in the [crayon package](https://github.com/r-lib/crayon#readme). The accent color for the passage. #' @note Several open source translations are available. By default, the World English Bible version is returned. #' To see which translations are available, use the `translations()` function. #' @export @@ -20,8 +21,40 @@ #' # Return the King James version verse of the day #' proverb(translation="kjv") #' +#' # Custom colors +#' proverb(main_color="red", accent_color="silver") +#' #' } -proverb <- function(translation = "web") { +proverb <- function(translation = "web", main_color = "cyan", accent_color = "silver") { + + + good_colors <- c( + 'black', + 'red', + 'green', + 'yellow', + 'blue', + 'magenta', + 'cyan', + 'white', + 'silver' + ) + + if(!main_color %in% good_colors | !accent_color %in% good_colors) { + + stop(cat( + crayon::red("One of those colors is not available!\n"), + cli::symbol$warning, + crayon::green("Check the {crayon} website to see a list of supported colors: https://github.com/r-lib/crayon \n") + ) + ) + + } + + main_color <- getExportedValue('crayon', main_color) + accent_color <- getExportedValue('crayon', accent_color) + + versions <- c( "bbe", @@ -76,7 +109,7 @@ proverb <- function(translation = "web") { n_verses <- length(verses) foo <- seq(1, n_verses, 1) - output <- paste(crayon::silver(foo), crayon::cyan(verses), collapse = " ") + output <- paste(accent_color(foo), main_color(verses), collapse = " ") a <- lubridate::wday(Sys.Date(), label = T, abbr = F) %>% as.character() b <- lubridate::month(Sys.Date(), label = T, abbr = F) %>% as.character() @@ -84,11 +117,12 @@ proverb <- function(translation = "web") { d <- lubridate::year(Sys.Date()) header <- paste0("\n\nProverbs ", c, "\nFor ", a, ", ",b, " ", c, " ", d) - cat(crayon::bold(crayon::silver(header))) + cat(crayon::bold(accent_color(header))) cat("\n \n") cat(crayon::col_align(output, align = "center", width = 20)) cat("\n") - cat(crayon::silver(paste0(crayon::green(cli::symbol$tick), " Translation: ", translation))) + cat(accent_color(paste0(main_color(cli::symbol$tick), " Translation: ", translation))) + } diff --git a/man/proverb.Rd b/man/proverb.Rd index e027230..02c2253 100755 --- a/man/proverb.Rd +++ b/man/proverb.Rd @@ -4,10 +4,14 @@ \alias{proverb} \title{proverb} \usage{ -proverb(translation = "web") +proverb(translation = "web", main_color = "cyan", accent_color = "silver") } \arguments{ \item{translation}{A character string that is available from list returned by \code{translations()}} + +\item{main_color}{A character string of a color available in the \href{https://github.com/r-lib/crayon#readme}{crayon package}. The color for the main body of text.} + +\item{accent_color}{A character string of a color available in the \href{https://github.com/r-lib/crayon#readme}{crayon package}. The accent color for the passage.} } \value{ nothing @@ -28,5 +32,8 @@ proverb() # Return the King James version verse of the day proverb(translation="kjv") +# Custom colors +proverb(main_color="red", accent_color="silver") + } } From a506445382450fc6e196fcc485cd45f57b466409 Mon Sep 17 00:00:00 2001 From: BradL <34219856+bradlindblad@users.noreply.github.com> Date: Tue, 15 Nov 2022 18:46:24 -0600 Subject: [PATCH 3/6] closing, gonna merge to dev --- .github/workflows/R-CMD-check.yaml | 4 ++-- tests/testthat/test-proverb.R | 14 ++++++++++++++ vignettes/auto_proverb.Rmd | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 5bef95c..f5e4a03 100755 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -2,9 +2,9 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main, master] + branches: [main, master, dev] pull_request: - branches: [main, master] + branches: [main, master, dev] name: R-CMD-check diff --git a/tests/testthat/test-proverb.R b/tests/testthat/test-proverb.R index 36fc691..1a097ee 100755 --- a/tests/testthat/test-proverb.R +++ b/tests/testthat/test-proverb.R @@ -40,3 +40,17 @@ test_that("give bad translation", { expect_error(proverb("foo")) }) + + +test_that("give bad main color", { + + expect_error(proverb(main_color = "breh")) + +}) + + +test_that("give bad accent color", { + + expect_error(proverb(accent_color = "bro")) + +}) diff --git a/vignettes/auto_proverb.Rmd b/vignettes/auto_proverb.Rmd index 05d0be6..321dd1c 100755 --- a/vignettes/auto_proverb.Rmd +++ b/vignettes/auto_proverb.Rmd @@ -42,3 +42,17 @@ proverbs::proverb() You'll need to restart your session but you should be greeted with a proverb after that. +If you want to customize the color of the printed output to sing more closely with your theme, for example, we can do that. + + +```{r, eval = FALSE} +if(interactive()) { + +proverbs::proverb(main_color = "black", accent_color = "silver") + +} +``` + +This will print your proverb in black text with silver (grey) highlights. + + From a50657fb597f8759063dfb95494bbb298fb83032 Mon Sep 17 00:00:00 2001 From: BradL <34219856+bradlindblad@users.noreply.github.com> Date: Tue, 15 Nov 2022 19:10:44 -0600 Subject: [PATCH 4/6] prep for release --- NEWS.md | 11 ++++++++--- cran-comments.md | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5f4798e..f13a3c2 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,9 @@ -# proverbs 0.1.0 +# proverbs 0.2.0 -* Initial release of proverbs -* Read the article [here](https://technistema.com/posts/announcing-proverbs-r-package/) +## New features +Added two new arguments to `proverbs::proverb()` + +* main_color +* accent_color + +These allow you to specify the actual colors printed to the terminal. They use the colors from the [crayon package](https://github.com/r-lib/crayon#readme). diff --git a/cran-comments.md b/cran-comments.md index c31fff6..f718c29 100755 --- a/cran-comments.md +++ b/cran-comments.md @@ -2,4 +2,3 @@ 0 errors | 0 warnings | 0 notes -* This is a new release. From 9ad07139edcee8618cdd05bc887da65346b96048 Mon Sep 17 00:00:00 2001 From: BradL <34219856+bradlindblad@users.noreply.github.com> Date: Tue, 15 Nov 2022 19:11:20 -0600 Subject: [PATCH 5/6] increment version --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2eb9128..70721bd 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: proverbs Title: Print a Daily Bible Proverb to Console -Version: 0.1.0.9000 +Version: 0.2.0 Authors@R: person("Brad", "Lindblad", , "me@bradlindblad.com", role = c("aut", "cre", "cph")) Description: A simple package to grab a Bible proverb corresponding to the From 549b61ccf1349d3339df9dda26157b8a22dcb540 Mon Sep 17 00:00:00 2001 From: BradL <34219856+bradlindblad@users.noreply.github.com> Date: Tue, 15 Nov 2022 19:12:32 -0600 Subject: [PATCH 6/6] submitted to CRAN --- .Rbuildignore | 1 + CRAN-SUBMISSION | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 CRAN-SUBMISSION diff --git a/.Rbuildignore b/.Rbuildignore index 6201ffc..212597c 100755 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,4 @@ ^pkgdown$ ^codecov\.yml$ ^CRAN-RELEASE$ +^CRAN-SUBMISSION$ diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..072fe99 --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 0.2.0 +Date: 2022-11-16 01:11:46 UTC +SHA: 9ad07139edcee8618cdd05bc887da65346b96048