Title: | Generates a Project and Repo for Easy Initialization of a Workshop |
---|---|
Description: | Generates a project and repo for easy initialization of a GitHub repo for R workshops. The repo includes a README with instructions to ensure that all users have the needed packages, an 'RStudio' project with the right directories and the proper data. The repo can then be used for hosting code taught during the workshop. |
Authors: | Jared P. Lander [aut, cre] |
Maintainer: | Jared P. Lander <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.1 |
Built: | 2024-11-11 03:13:46 UTC |
Source: | https://github.com/jaredlander/repogenerator |
Function for interacting with the GitHub API
callGitHubAPI(repoName, token, apiURL = "https://api.github.com", path = "/user/repos", encoding = c("json", "form"), method = httr::POST) createGitHubRepo(repoName, token) deleteGitHubRepo(owner, repoName, token) checkGitHubRepoExists(owner, repoName, token)
callGitHubAPI(repoName, token, apiURL = "https://api.github.com", path = "/user/repos", encoding = c("json", "form"), method = httr::POST) createGitHubRepo(repoName, token) deleteGitHubRepo(owner, repoName, token) checkGitHubRepoExists(owner, repoName, token)
repoName |
Name of repo to interact with |
token |
GitHub Personal Access Token: this should be the actual token, not the name of an environment variable |
apiURL |
The base URL for the GitHub API, this really should not need to be changed |
path |
The API endpoint |
encoding |
The type of encoding for the request, either json of form |
method |
The method to be used, as an R function, such as POST or GET |
owner |
GitHub username |
Builds up and executes a GitHub API request
An API status
createGitHubRepo
: Creating a GitHub Repo
deleteGitHubRepo
: Deleting a GitHub Repo
checkGitHubRepoExists
: Check that a GitHub Repo exists
Jared P. Lander
Builds text for file that downloads data
createDownloadText(info)
createDownloadText(info)
info |
data.frame listing data sources. Must have at least the following columns: Local (the name the file should be on disk after downloaded), Remote (the URL of the file), Mode (the way to write to disk, either 'w' or 'wb'). |
Creates a block of code. The first line is a comment of the file name, then is uses download.file()
using the remote URL and the local filename.
Returns the block of text
Jared P. Lander
dataList <- read.csv(system.file('metadata/DataList.csv', package='RepoGenerator'), stringsAsFactors=FALSE, header=TRUE) cat(RepoGenerator:::createDownloadText(dataList))
dataList <- read.csv(system.file('metadata/DataList.csv', package='RepoGenerator'), stringsAsFactors=FALSE, header=TRUE) cat(RepoGenerator:::createDownloadText(dataList))
Creates a new project and pushes it to GitHub
createRepo(name, path, data, packages = c("here", "knitr", "rmarkdown", "tidyverse", "usethis"), user, organizer = user, token = "GITHUB_PAT", readme, ssh = TRUE)
createRepo(name, path, data, packages = c("here", "knitr", "rmarkdown", "tidyverse", "usethis"), user, organizer = user, token = "GITHUB_PAT", readme, ssh = TRUE)
name |
Name to use for project and repo |
path |
Location for the new project |
data |
data.frame listing data sources. Must have at least the following columns: Local (the name the file should be on disk after downloaded), Remote (the URL of the file), Mode (the way to write to disk, either 'w' or 'wb'). |
packages |
Vector of packages that the user will be instructed to install. |
user |
GitHub username |
organizer |
Name of organizer of class. This can be in the form a a Markdown-style link. |
token |
The name of the environment variable holding the GitHub access token. This can be set with |
readme |
Path to parameterized rmarkdown document with parameters |
ssh |
If |
This is designed to make a bare repo to be used for workshops. It will create a new project with a customized README and customized download file. It then pushes this to GitHub.
If all operations are successful, returns TRUE
Jared P. Lander
A dataset containing information about data to download for a workshop.
datafiles
datafiles
A data frame with 53940 rows and 10 variables:
Colloquial name of data
URL of file
Name to use for file on disc
Type of file, such as CSV, Excel
Way to write file to disc such as 'w' for text files or 'wb' for binary files
Tag for the type of data
What the data is used to show