Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Automated generation of inst/CITATION #79

Open
roaldarbol opened this issue Aug 6, 2024 · 3 comments
Open

Feature request: Automated generation of inst/CITATION #79

roaldarbol opened this issue Aug 6, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@roaldarbol
Copy link

It would be great to have the option to only maintain the DESCRIPTION file and then both the CITATION.cff and the inst/CITATION files being updated as part of the workflow. As far as I can tell, one will manually have to re-create inst/CITATION every time the CITATION.cff file is updated. Maybe it is already possible, in which case ignore this.

Also, along the same lines, it might be helpful having an example of the automated generation solutions in the docs. :-)

@njtierney
Copy link

Hello! Just seconding that this would be really handy :)

@dieghernan
Copy link
Member

Hi:

I still have to think about it, since the main purpose of cffr is to provide tools for CITATION.cff files so I am not very sure of expanding the capabilities beyond that scope. However, the implementation would be fairly easy to do, see:

aa <- cffr::cff_create()
cffr::cff_write(aa)
unlink("inst/CITATION") # Remove already present file
cffr::cff_write_citation(aa, file = "inst/CITATION")

And in a github action (see example):

      - name: Update CITATION.cff
        run: |

          # Customize with your own code
          # See https://docs.ropensci.org/cffr/articles/cffr.html

          # Write your own keys
          mykeys <- list()

          # The object
          cffobj <- cffr::cff_create(keys = mykeys)

          # Create your CITATION.cff file
          cffr::cff_write(cffobj)

          # Update inst/CITATION
          unlink("inst/CITATION")
          cffr::cff_write_citation(cffobj, file = "inst/CITATION")

        shell: Rscript {0}

@roaldarbol
Copy link
Author

roaldarbol commented Jan 17, 2025

Ideally, I would also prefer this to be handled by usethis (see r-lib/usethis#2081), as I see that package as one that takes care of package development as a whole. I guess the argument for implementing something like this is that the current state adds friction because it adds extra work for devs having to curate package version in 4 places now (DESCRIPTION, NEWS.md, inst/CITATION, CITATION.cff) and do that every time there's a version bump.
I might write a small package for automating these instead, but it won't be in the coming month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants