Package 'gitgadget'

Title: 'Rstudio' Addin for Version Control and Assignment Management using Git
Description: An 'Rstudio' addin for version control that allows users to clone repositories, create and delete branches, and sync forks on GitHub, GitLab, etc. Furthermore, the addin uses the GitLab API to allow instructors to create forks and merge requests for all students/teams with one click of a button.
Authors: Vincent Nijs [aut, cre], Sanjiv Erat [aut]
Maintainer: Vincent Nijs <[email protected]>
License: GPL-3
Version: 0.8.0
Built: 2024-11-14 03:43:37 UTC
Source: https://github.com/vnijs/gitgadget

Help Index


Add users to a repo

Description

Add users to a repo

Usage

add_users_repo(
  token,
  repo,
  userfile,
  permission = 20,
  server = "https://api.github.com/"
)

Arguments

token

GitHub token

repo

Repo to update

userfile

A csv file with student information (i.e., username, token, and email)

permission

Permission setting for the repo (default is 20, i.e., reporter)

server

The GitLab API server

Details

See https://github.com/vnijs/gitgadget for additional documentation


Assign work to each student/team by creating a fork of the main repo

Description

Assign work to each student/team by creating a fork of the main repo

Usage

assign_work(
  token,
  groupname,
  assignment,
  userfile,
  tafile = "",
  type = "individual",
  pre = "",
  server = "https://api.github.com/"
)

Arguments

token

GitLab token

groupname

Group to create on GitLab (defaults to user's namespace)

assignment

Name of the assignment to assign

userfile

A csv file with student information (i.e., username, token, and email)

tafile

A optional csv file with TA information (i.e., username, token, and email)

type

Individual or Team work

pre

Pre-amble for the assignment name, usually groupname + "-"

server

The GitLab API server

Details

See https://github.com/vnijs/gitgadget for additional documentation


Check student tokens

Description

Check student tokens

Usage

check_tokens(
  userfile,
  server = Sys.getenv("git.server", "https://api.github.com/")
)

Arguments

userfile

A csv file with student information (i.e., username, token, and email)

server

The GitLab API server

Details

See https://github.com/vnijs/gitgadget for additional documentation


Check error status

Description

Check error status

Usage

checkerr(code)

Arguments

code

Code returned by an API request

Details

See https://github.com/vnijs/gitgadget for additional documentation


Create merge requests for each student/team

Description

Create merge requests for each student/team

Usage

collect_work(
  token,
  assignment,
  userfile,
  type = "individual",
  server = "https://api.github.com/"
)

Arguments

token

GitHub token

assignment

Name of the assignment (e.g., "class345/class345-assignment1")

userfile

A csv file with student information (i.e., username, token, and email)

type

Individual or Team work

server

The GitLab API server

Details

See https://github.com/vnijs/gitgadget for additional documentation


Create a group on GitLab using the API

Description

Create a group on GitLab using the API

Usage

create_group(
  token,
  groupname = "",
  userfile = "",
  permission = 20,
  server = "https://api.github.com/"
)

Arguments

token

GitLab token

groupname

Group to create on GitLab (defaults to user's namespace)

userfile

A csv file with student information (i.e., username, token, and email)

permission

Permission setting for the group (default is 20, i.e., reporter)

server

The GitLab API server

Details

See https://github.com/vnijs/gitgadget for additional documentation


Create the main repo from a local directory

Description

Create the main repo from a local directory

Usage

create_repo(
  username = Sys.getenv("git.user"),
  token = Sys.getenv("GITHUB_PAT"),
  repo = basename(getwd()),
  base_dir = dirname(getwd()),
  groupname = "",
  pre = "",
  ssh = FALSE,
  server = "https://api.github.com/"
)

Arguments

username

Username

token

Token (e.g., Sys.getenv("GITHUB_PAT") or Sys.getenv("GITHUB_PAT"))

repo

Name of the repo (assignment)

base_dir

Base directory for the repo. file.path(directory, assignment) should exist

groupname

Group to create on GitLab (defaults to user's namespace)

pre

Pre-amble for the repo (assignment) name

ssh

Use SSH for authentication

server

The GitLab API server

Details

See https://github.com/vnijs/gitgadget for additional documentation


Fetch all merge requests as local branches and link to a remote

Description

Fetch all merge requests as local branches and link to a remote

Usage

fetch_work(token, assignment, page = 1, server = "https://api.github.com/")

Arguments

token

GitLab token

assignment

Name of the assignment (e.g., "class345/class345-assignment1")

page

Number of the results page to select

server

The GitLab API server

Details

See https://github.com/vnijs/gitgadget for additional documentation


noRd export

Description

noRd export

Usage

get_port()

gitgadget

Description

Run gitgadget in the Rstudio viewer if available

Usage

gitgadget(port = get_port(), host = "127.0.0.1", launch.browser = TRUE)

Arguments

port

Port to use for the app

host

Host ip to use

launch.browser

Launch app in viewer (browsers) or only show the URL

Details

See https://github.com/vnijs/gitgadget for documentation


Launch gitgadget in a separate process

Description

Launch gitgadget in a separate process

Usage

gitgadget_callr()

Details

Using the callr package to launch gitgadget in a separate process so the console is not blocked. Rstudio viewer is used if available. See https://github.com/vnijs/gitgadget for documentation


Start gitgadget and show url to open the application in an external browser

Description

Start gitgadget and show url to open the application in an external browser

Usage

gitgadget_url()

Details

See https://github.com/vnijs/gitgadget for documentation


Find project ID

Description

Find project ID

Usage

projID(path_with_namespace, token, server, owned = TRUE, search = "")

Arguments

path_with_namespace

Repo name together with the group or user namespace

token

GitLab token

server

The GitLab API server

owned

Restrict listing to only repos owned by the user? TRUE or FALSE

search

Search term to use to narrow down the set of projects

Details

See https://github.com/vnijs/gitgadget for additional documentation


Reach user file

Description

Reach user file

Usage

read_ufile(userfile, cols = c("userid", "team", "token"))

Arguments

userfile

File with student information

cols

Column names that must exists in the file

Details

See https://github.com/vnijs/gitgadget for additional documentation


Remove a project

Description

Remove a project

Usage

remove_project(token, id, server)

Arguments

token

GitLab token

id

Project ID

server

The GitLab API server

Details

See https://github.com/vnijs/gitgadget for additional documentation


Remove users from a repo

Description

Remove users from a repo

Usage

remove_users_repo(token, repo, userfile, server = "https://api.github.com/")

Arguments

token

GitLab token

repo

Repo the update

userfile

A csv file with student information (i.e., username, token, and email)

server

The GitLab API server

Details

See https://github.com/vnijs/gitgadget for additional documentation