-
Notifications
You must be signed in to change notification settings - Fork 283
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
Consider use_repo_template function? #109
Comments
@jennybc bought this up too. To me, the big question is whether usethis should support template customisation/composition with files or with functions? (But even then having |
Maybe something like: create_from_github <- function(repo, path = ".", fork = TRUE) {
}
create_from_github("hadley/ggplot2")
# would clone using github api
# then checkout using git2r
# would create ggplot2 directory in wd |
LMK what you think of this first quick attempt. |
Nice! However, it doesn't seem to handle the case I am most interested in, where it could take a new name for the repo rather than creating a github fork, e.g., something like: create_from_github("cboettig/template", destination = "cboettig/my-paper") GitHub's forking buttons already make getting a copy of a repo with the same name as the parent easy, but getting a copy with a different name requires more git commands than can be done in RStudio git gui. (For instance, I wish my students could run: Also noticed a few minor issues:
since it can get Second, looks like you use |
You could just do Can you please file an new issues for the other bugs? |
Sorry if I'm missing something obvious, but I don't think Current With Will open other issues for the minor things, thanks! |
Ooooh, |
usethis has great utilities for setting up a vanilla template using
create_package()
, along withuse_git()
,use_github()
, as @jennybc describes in https://community.rstudio.com/t/procedure-to-create-a-project-for-a-package-destined-for-github/2054/4.But this twitter thread got me thinking: often rather start with my own template: don't have to enter my name, choose my usual license, and other tweaks. Moreover, sometimes my template isn't a package, but a more minimal project repo; or maybe it's a specific template for some classroom assignment I want students to use.
It would be nice to have a function to deploy some existing template repo. e.g. this is basically what GitHub forking does, without creating the 'fork' connection, and allowing a new repo name. (Similar also to what GitHub Classroom does, but that's bound to a single organization destination).
I think this would be a straight-forward wrapper around existing
git2r
/ command-line git calls to rename the remote origin; possibly with agh
wrapper (or just single github API call via httr to avoid the dependency?) to create the new repo on GitHub. I sketched a prototype of this here: https://github.com/cboettig/template/blob/master/R/template.R. Would be happy to send a PR if something along these lines makes sense, though no doubt theusethis
team could manage a more robust implementation more efficiently anyhow, if it's worth doing.Thanks for your thoughts.
The text was updated successfully, but these errors were encountered: