Repository {PaRe} | R Documentation |
R6 Repository class.
Description
Class representing the Repository
Methods
Public methods
Method new()
Initializer for Repository class
Usage
Repository$new(path)
Arguments
path
(character)
Path to R package project
Returns
invisible(self)
Method getName()
Get method for name.
Usage
Repository$getName()
Returns
(character)
Repository name
Method getPath()
Get method fro path
Usage
Repository$getPath()
Returns
(character)
Path to Repository folder
Method getFiles()
Get method to get a list of File objects.
Usage
Repository$getFiles()
Returns
Method getRFiles()
Get method to get only R-files.
Usage
Repository$getRFiles()
Returns
Method getDescription()
Get method to get the description of the package. See: description.
Usage
Repository$getDescription()
Returns
(description)
Description object.
Method getFunctionUse()
Get method for functionUse, will check if functionUse has already been fetched or not.
Usage
Repository$getFunctionUse()
Returns
(data.frame)
See getFunctionUse.
Method gitCheckout()
Method to run 'git checkout <branch/commit hash>'
Usage
Repository$gitCheckout(branch, ...)
Arguments
Returns
invisible(self)
Method gitPull()
Method to run 'git pull'
Usage
Repository$gitPull(...)
Arguments
...
Further parameters for pull.
Returns
invisible(self)
Method gitBlame()
Method to fetch data generated by 'git blame'.
Usage
Repository$gitBlame()
Returns
(tibble)
column | data type |
repository | character |
author | character |
file | character |
date | character |
lines | integer |
Method clone()
The objects of this class are cloneable with this method.
Usage
Repository$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Other Representations:
Code
,
File
,
Function
Examples
fetchedRepo <- tryCatch(
{
# Set dir to clone repository to.
tempDir <- tempdir()
pathToRepo <- file.path(tempDir, "glue")
# Clone repo
git2r::clone(
url = "https://github.com/tidyverse/glue.git",
local_path = pathToRepo
)
# Create instance of Repository object.
repo <- PaRe::Repository$new(path = pathToRepo)
# Set fetchedRepo to TRUE if all goes well.
TRUE
},
error = function(e) {
# Set fetchedRepo to FALSE if an error is encountered.
FALSE
},
warning = function(w) {
# Set fetchedRepo to FALSE if a warning is encountered.
FALSE
}
)
if (fetchedRepo) {
repo
}