diff --git a/DESCRIPTION b/DESCRIPTION index 949976c..cdc0091 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,6 +12,8 @@ Imports: bslib, downlit, fs, + glue, + readr, sessioninfo, xml2 Encoding: UTF-8 diff --git a/child-create-a-github-repo.Rmd b/child-create-a-github-repo.Rmd new file mode 100644 index 0000000..c606498 --- /dev/null +++ b/child-create-a-github-repo.Rmd @@ -0,0 +1,26 @@ +Go to and make sure you are logged in. + +Near "Repositories", click the big green "New" button. +Or, if you are on your own profile page, click on "Repositories", then click the big green "New" button. + +How to fill this in: + +* Repository template: No template. +* Repository name: <<>> +* Description: <<>> +* Public. +* Initialize this repository with: Add a README file. + +Click the big green button that says "Create repository". + +Now click the big green button that says "<> Code". + +Copy a clone URL to your clipboard. +If you're taking our default advice, copy the HTTPS URL. +But if you're opting for SSH, then make sure to copy the SSH URL. + +```{r} +#| echo = FALSE, fig.align = "center", out.width = "100%", +#| fig.alt = "Selecting an HTTPS vs SSH URL on GitHub" +knitr::include_graphics("img/github-https-or-ssh-url-annotated.png") +``` diff --git a/connect-git-github.Rmd b/connect-git-github.Rmd index 551737f..047169a 100644 --- a/connect-git-github.Rmd +++ b/connect-git-github.Rmd @@ -10,31 +10,21 @@ I assume you've decided whether to use HTTPS (see chapter \@ref(https-pat) or SS ## Make a repo on GitHub -Go to and make sure you are logged in. - -Near "Repositories", click the big green "New" button. -Or, if you are on your own profile page, click on "Repositories", then click the big green "New" button. - -How to fill this in: - -* Repository template: No template. -* Repository name: `myrepo` (or whatever you wish, we'll delete this soon anyway). -* Description: "testing my setup" (or whatever, but some text is good for the README). -* Public. -* Initialize this repository with: Add a README file. - -Click the big green button that says "Create repository". - -Now click the big green button that says "<> Code". - -Copy a clone URL to your clipboard. -If you're taking our default advice, copy the HTTPS URL. -But if you're opting for SSH, then make sure to copy the SSH URL. - -```{r} -#| echo = FALSE, fig.align = "center", out.width = "100%", -#| fig.alt = "Selecting an HTTPS vs SSH URL on GitHub" -knitr::include_graphics("img/github-https-or-ssh-url-annotated.png") +```{r echo = FALSE, results = "asis"} +dat <- list( + repository_name_text = glue::glue(" + `myrepo` or whatever you wish (we'll delete this soon)."), + description_text = glue::glue(" + \"Repository for testing my Git/GitHub setup\" or similar. It's nice to \\ + have something here, so you'll see it appear in the README.") +) +insert <- glue::glue_data( + dat, + readr::read_file("child-create-a-github-repo.Rmd"), + .open = "<<<", .close = ">>>" +) +res <- knitr::knit_child(text = insert, quiet = TRUE) +cat(res, sep = '\n') ``` ## Clone the repo to your local computer diff --git a/connect-rstudio-git-github.Rmd b/connect-rstudio-git-github.Rmd index 72f1a81..63127ca 100644 --- a/connect-rstudio-git-github.Rmd +++ b/connect-rstudio-git-github.Rmd @@ -34,31 +34,21 @@ If you don't have a suitable test repository on GitHub, follow the instructions ## Make a repo on GitHub -Go to and make sure you are logged in. - -Near "Repositories", click the big green "New" button. -Or, if you are on your own profile page, click on "Repositories", then click the big green "New" button. - -How to fill this in: - -* Repository template: No template. -* Repository name: `myrepo` (or whatever you wish, we'll delete this soon anyway). -* Description: "testing my setup" (or whatever, but some text is good for the README). -* Public. -* Initialize this repository with: Add a README file. - -Click the big green button that says "Create repository". - -Now click the big green button that says "<> Code". - -Copy a clone URL to your clipboard. -If you're taking our default advice, copy the HTTPS URL. -But if you're opting for SSH, then make sure to copy the SSH URL. - -```{r} -#| echo = FALSE, fig.align = "center", out.width = "100%", -#| fig.alt = "Selecting an HTTPS vs SSH URL on GitHub" -knitr::include_graphics("img/github-https-or-ssh-url-annotated.png") +```{r echo = FALSE, results = "asis"} +dat <- list( + repository_name_text = glue::glue(" + `myrepo` or whatever you wish (we'll delete this soon)."), + description_text = glue::glue(" + \"Repository for testing my Git/GitHub setup\" or similar. It's nice to \\ + have something here, so you'll see it appear in the README.") +) +insert <- glue::glue_data( + dat, + readr::read_file("child-create-a-github-repo.Rmd"), + .open = "<<<", .close = ">>>" +) +res <- knitr::knit_child(text = insert, quiet = TRUE) +cat(res, sep = '\n') ``` ## Clone the test GitHub repository to your computer via RStudio diff --git a/usage-existing-project-github-first.Rmd b/usage-existing-project-github-first.Rmd index cd195f9..891a306 100644 --- a/usage-existing-project-github-first.Rmd +++ b/usage-existing-project-github-first.Rmd @@ -1,25 +1,35 @@ # Existing project, GitHub first {#existing-github-first} -A novice-friendly workflow for bringing an existing R project into the RStudio and Git/GitHub universe. +This is a novice-friendly workflow for bringing an existing R project into the RStudio and Git/GitHub universe. -We do this in a slightly awkward way, in order to avoid using Git at the command line. You won't want to work this way forever, but it's perfectly fine as you're getting started! +We do this in a slightly awkward way, in order to avoid using Git at the command line. +You won't want to work this way forever, but it's perfectly fine as you're getting started! -We assume you've got your existing R project isolated in a directory on your computer. If that's not already true, make it so. Create a directory and marshal all the existing data and R scripts there. It doesn't really matter where you do this, but note where the project currently lives. +We assume you've got your existing R project isolated in a directory on your computer. +If that's not already true, make it so. +Create a directory and marshal all the existing data and R scripts there. +It doesn't really matter where you do this, but note where the project currently lives. ## Make a repo on GitHub -Go to and make sure you are logged in. - -Click the green "New repository" button. Or, if you are on your own profile page, click on "Repositories", then click the green "New" button. - -Pick a repository name that actually reminds you what the project is about! But try to be concise. - -Public -YES Initialize this repository with a README - -Click the big green button "Create repository." - -Copy the HTTPS clone URL to your clipboard via the green "Clone or Download" button. Or copy the SSH URL if you chose to set up SSH keys. +```{r echo = FALSE, results = "asis"} +dat <- list( + repository_name_text = glue::glue(" + `myrepo` or a similarly short name for this existing project. Approach \\ + this similar to a variable name, in code: descriptive but brief, no \\ + whitespace. Letters, digits, `-`, `.`, or `_` are allowed."), + description_text = glue::glue(" + \"Analysis of the stuff\" or any short description of the project. Write \\ + this for humans.") +) +insert <- glue::glue_data( + dat, + readr::read_file("child-create-a-github-repo.Rmd"), + .open = "<<<", .close = ">>>" +) +res <- knitr::knit_child(text = insert, quiet = TRUE) +cat(res, sep = '\n') +``` ## New RStudio Project via git clone diff --git a/usage-new-project-github-first.Rmd b/usage-new-project-github-first.Rmd index 0ea0f26..6dd5ef4 100644 --- a/usage-new-project-github-first.Rmd +++ b/usage-new-project-github-first.Rmd @@ -13,31 +13,23 @@ We will specify below when you may need to do something differently. ## Make a repo on GitHub -Go to and make sure you are logged in. - -Near "Repositories", click the big green "New" button. -Or, if you are on your own profile page, click on "Repositories", then click the big green "New" button. - -How to fill this in: - -* Repository template: No template. -* Repository name: `myrepo` (or whatever you wish, we'll delete this soon anyway). -* Description: "testing my setup" (or whatever, but some text is good for the README). -* Public. -* Initialize this repository with: Add a README file. - -Click the big green button that says "Create repository". - -Now click the big green button that says "<> Code". - -Copy a clone URL to your clipboard. -If you're taking our default advice, copy the HTTPS URL. -But if you're opting for SSH, then make sure to copy the SSH URL. - -```{r} -#| echo = FALSE, fig.align = "center", out.width = "100%", -#| fig.alt = "Selecting an HTTPS vs SSH URL on GitHub" -knitr::include_graphics("img/github-https-or-ssh-url-annotated.png") +```{r echo = FALSE, results = "asis"} +dat <- list( + repository_name_text = glue::glue(" + `myrepo` or whatever you wish to name your new project. Approach this \\ + similar to a variable name, in code: descriptive but brief, no \\ + whitespace. Letters, digits, `-`, `.`, or `_` are allowed."), + description_text = glue::glue(" + \"Analysis of the stuff\" or any short description of the project. Write \\ + this for humans.") +) +insert <- glue::glue_data( + dat, + readr::read_file("child-create-a-github-repo.Rmd"), + .open = "<<<", .close = ">>>" +) +res <- knitr::knit_child(text = insert, quiet = TRUE) +cat(res, sep = '\n') ``` ### GitLab