-
Notifications
You must be signed in to change notification settings - Fork 0
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 #94 from KWB-R/fix/stringi-dependency
Try to avoid issue with stringi installation
- Loading branch information
Showing
17 changed files
with
109 additions
and
113 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
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
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 |
---|---|---|
|
@@ -79,7 +79,7 @@ add_authors <- function(author_meta, role = "ctb", path = getwd()) | |
#' @export | ||
#' @importFrom purrr transpose | ||
convert_author_metadata_tolist <- function( | ||
author_metadata_df = create_author_metadata_from_orcid() | ||
author_metadata_df = create_author_metadata_from_orcid() | ||
) | ||
{ | ||
setNames( | ||
|
@@ -94,31 +94,24 @@ convert_author_metadata_tolist <- function( | |
#' @param orcids named character vector with ORCIDs and names correspondig to | ||
#' to "given_name family name" (defaults: kwb.orcid::get_kwb_orcids()) | ||
#' @importFrom kwb.orcid get_kwb_orcids | ||
#' @importFrom stringr str_trim str_split | ||
#' @importFrom magrittr %>% | ||
#' @importFrom kwb.utils extractSubstring setColumns | ||
#' @return data frame with required metadata for R package DESCRIPTION as | ||
#' required by desc::desc_add_author() | ||
#' @export | ||
create_author_metadata_from_orcid <- function( | ||
orcids = kwb.orcid::get_kwb_orcids() | ||
orcids = kwb.orcid::get_kwb_orcids() | ||
) | ||
{ | ||
orc_ids <- orcids[order(orcids)] | ||
orc_names <- names(orcids) | ||
orc_ids <- sort(orcids) | ||
|
||
orc_names_matrix <- orc_names %>% | ||
stringr::str_trim() %>% | ||
stringr::str_split(pattern = "\\s+", simplify = TRUE, n = 2) | ||
|
||
kwb.utils::noFactorDataFrame( | ||
given = orc_names_matrix[,1], | ||
family = orc_names_matrix[,2], | ||
email = sprintf( | ||
"%s.%[email protected]", | ||
tolower(orc_names_matrix[, 1]), | ||
tolower(orc_names_matrix[, 2]) | ||
), | ||
orcid = orc_ids, | ||
row.names = NULL | ||
) | ||
names(orcids) %>% | ||
kwb.utils::extractSubstring( | ||
pattern = "^\\s*(\\S+)\\s+(\\S+)\\s*$", | ||
index = c(given = 1L, family = 2L) | ||
) %>% | ||
kwb.utils::setColumns( | ||
email = email_kwb(.[["given"]], .[["family"]]), | ||
orcid = orc_ids, | ||
dbg = FALSE | ||
) | ||
} |
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
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
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 |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
#' @return writes DESCRIPTION file using usethis::use_description() with KWB | ||
#' style | ||
#' @importFrom usethis use_description | ||
#' @importFrom stringr str_split | ||
#' @importFrom tools toTitleCase | ||
#' @export | ||
use_description <- function( | ||
|
@@ -37,13 +36,11 @@ use_description <- function( | |
|
||
pkg$title <- tools::toTitleCase(pkg$title) | ||
|
||
full_name <- stringr::str_split(string = author$name,pattern = "\\s+")[[1]] | ||
author_name <- full_name[1] | ||
author_surname <- full_name[2] | ||
full_name <- strsplit(author$name, "\\s+")[[1L]] | ||
author_name <- full_name[1L] | ||
author_surname <- full_name[2L] | ||
|
||
author_email <- sprintf( | ||
'%s.%[email protected]', tolower(author_name), tolower(author_surname) | ||
) | ||
author_email <- email_kwb(given = author_name, family = author_surname) | ||
|
||
author_comment <- if (is.null(author$orcid)) { | ||
"NULL" | ||
|
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
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
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,2 @@ | ||
#ignore docs | ||
docs |
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
Oops, something went wrong.