-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from ThinkR-open/startupmessage
Create a startup message displaying thinkr
- Loading branch information
Showing
7 changed files
with
129 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
Package: thinkr | ||
Title: Tools for Cleaning Up Messy Files | ||
Version: 0.15 | ||
Authors@R: | ||
c(person(given = "Vincent", | ||
family = "Guyader", | ||
role = c("aut", "cre"), | ||
email = "[email protected]", | ||
comment = c(ORCID = "0000-0003-0671-9270")), | ||
person(given = "Sébastien", | ||
family = "Rochette", | ||
role = "aut", | ||
email = "[email protected]", | ||
comment = c(ORCID = "0000-0002-1565-9313")), | ||
person(given = "ThinkR", | ||
role = "cph")) | ||
Authors@R: c( | ||
person("Vincent", "Guyader", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(ORCID = "0000-0003-0671-9270")), | ||
person("Sébastien", "Rochette", , "[email protected]", role = "aut", | ||
comment = c(ORCID = "0000-0002-1565-9313")), | ||
person("ThinkR", role = "cph") | ||
) | ||
Description: Some tools for cleaning up messy 'Excel' files to be suitable | ||
for R. People who have been working with 'Excel' for years built more | ||
or less complicated sheets with names, characters, formats that are | ||
|
@@ -27,6 +21,7 @@ Depends: | |
R (>= 3.1) | ||
Imports: | ||
assertthat, | ||
cli, | ||
devtools, | ||
dplyr, | ||
ggplot2, | ||
|
@@ -40,7 +35,8 @@ Imports: | |
stringi, | ||
stringr, | ||
tidyr, | ||
utils | ||
utils, | ||
withr | ||
Suggests: | ||
knitr, | ||
rmarkdown, | ||
|
@@ -49,4 +45,4 @@ VignetteBuilder: | |
knitr | ||
Encoding: UTF-8 | ||
LazyData: TRUE | ||
RoxygenNote: 7.1.1 | ||
RoxygenNote: 7.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,38 @@ | ||
globalVariables(c(".","Var2","Var1")) | ||
globalVariables(c(".", "Var2", "Var1")) | ||
|
||
#' ThinkR welcome message | ||
#' | ||
#' @return a package startup message | ||
#' @importFrom withr with_preserve_seed | ||
#' @noRd | ||
.onAttach <- function(...) { | ||
withr::with_preserve_seed({ | ||
if (!interactive() | stats::runif(1) > 0.02) { | ||
return() | ||
} | ||
|
||
packageStartupMessage(startupmessage()) | ||
}) | ||
} | ||
|
||
#' ThinkR message | ||
#' | ||
#' @importFrom cli cat_line | ||
#' | ||
#' @return thinkr message | ||
#' @noRd | ||
startupmessage <- function() { | ||
cat_line(c( | ||
" ################################################################# ", | ||
" ############################# #################################### ", | ||
"#### # ### ####### #### ## ### ## ####", | ||
"######### ##### ### ## ## ### ## ## #### ## ####", | ||
"######## ##### ## ## # # ## ##### ######" | ||
), col = "#f05622") | ||
cat_line(c( | ||
"####### ##### ### ## ## ### ## ## #### ## ######", | ||
"###### ##### ### ## ## #### ## #### ## #### #####", | ||
" #################################################################### ", | ||
" ################################################################## " | ||
), col = "#20b8d6") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
test_that("Startup message is ok", { | ||
expect_equal( | ||
capture_output_lines(startupmessage()), | ||
c( | ||
" ################################################################# ", | ||
" ############################# #################################### ", | ||
"#### # ### ####### #### ## ### ## ####", | ||
"######### ##### ### ## ## ### ## ## #### ## ####", | ||
"######## ##### ## ## # # ## ##### ######", | ||
"####### ##### ### ## ## ### ## ## #### ## ######", | ||
"###### ##### ### ## ## #### ## #### ## #### #####", | ||
" #################################################################### ", | ||
" ################################################################## " | ||
) | ||
) | ||
}) |