golem
golem copied to clipboard
allow golem::fill_desc to use `person` vector
IE :
golem::fill_desc(
pkg_name = "mapit", # The Name of the package containing the App
pkg_title = "ttt", # The Title of the package containing the App
pkg_description = "xxx ", # The Description of the package containing the App
authors = c(person(given = "Vincent",
family = "Guyader",
role = c("cre", "aut"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-0671-9270")),
person(given = "Colin",
family = "Fay",
role = "aut",
email = "[email protected]",
comment = c(ORCID = "0000-0001-7343-1846")),
person(given = "Sébastien",
family = "Rochette",
role = "aut",
email = "[email protected]",
comment = c(ORCID = "0000-0002-1565-9313")),
person(given = "Cervan",
family = "Girard",
role = "aut",
email = "[email protected]",
comment = c(ORCID = "0000-0002-4816-4624")),
person(given = "Novica",
family = "Nakov",
role = "ctb",
email = "[email protected]"),
person(given = "ThinkR",
role = "cph")) ,
repo_url = NULL # The (optional) URL of the GitHub Repo
) ```
I think this is related to {desc} who can't take this vector.
Maybe the PR should be done in {desc} instead of in {golem}?
For now we can :
dd <- desc::description$new()
lapply(
c(person(given = "Vincent",
family = "Guyader",
role = c("cre", "aut"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-0671-9270")),
person(given = "Colin",
family = "Fay",
role = "aut",
email = "[email protected]",
comment = c(ORCID = "0000-0001-7343-1846"))),
function(x){
dd$add_author(as.character(x))
}
)
Pinging @gaborcsardi here.
Do you think this should be a feature supported by {desc}?
Well, I guess, especially if you create a PR. :) But you can also just use $set(), maybe?
Leaving a comment here after @jennahamlin issue #609, so that it pops on top of the issue board
This is already the case in fusen. https://github.com/ThinkR-open/fusen/blob/main/R/fill_description.R
Hello, I just would like to ask if you have made any advances in repairing this issue.
I also work with a team on my package and based on your previous answers I was able to work around this problem. In my opinion would be natural to be able to add other authors in the function fill_desc(), also with other functions that function persons() offers. I think that this should be included in your package and it shouldn't be necessary for me to look up for workarounds.
In my solution, I create at first a dummy author, then add real authors with additional attributes and then remove the dummy author and at the end the desc file is overwrite with a new values. Here is my solution for others:
golem::fill_desc(
pkg_name = "package ", # The Name of the package containing the App
pkg_title = "package ", # The Title of the package containing the App
pkg_description = "Description of the package", # The Description of the package containing the App
author_first_name = "X", # Your First Name
author_last_name = "X", # Your Last Name
author_email = "X", # Your Email
repo_url = NULL # The URL of the GitHub Repo (optional)
)
description <- desc::description$new()
lapply(
c(person(given = "Vincent",
family = "Guyader",
role = c("cre", "aut"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-0671-9270")),
person(given = "Colin",
family = "Fay",
role = "aut",
email = "[email protected]",
comment = c(ORCID = "0000-0001-7343-1846"))),
function(x){
description$add_author(as.character(x))
}
)
description$del_author("X")
description$write(file = "DESCRIPTION")
@Kyoshido That seems to be an unnecessarily complicated way to assign the authors.
Is it not just easier to use one of the desc functions. E.g. desc_set_authors() as below.
p <- c(person(given = "Name1",
family = "Surname",
role = c("cre", "aut"),
email = "[email protected]",
comment = c(ORCID = "9999-7777-9999-9999")),
person(given = "The",
family = "Supervisor",
role = c("dgs", "ctb"),
email = "[email protected]",
comment = c(ORCID = "9999-7777-9999-7777")))
desc::desc_set_authors(p)
@jmeyer2482 Thanks for the correction. Your solution is better.
@Kyoshido Glad it worked. I was actually using your solution until I did some more investigating. It would be nice to have it clearer in the golem package though.
closed via #1037