updateGit: Pull from git and install

View source: R/packageTools.R

updateGitR Documentation

Pull from git and install

Description

Fetches all branches, then pulls the identified branch from git, then runs a digest on the local folders. If that digest is different as a previous one, then the function will run devtools::install(dependencies = FALSE, reload = FALSE, quick = TRUE, ...). This should be safe even in cases where local files have changed. If they were uncommitted, Git will error, and nothing will be pulled, and if they were committed, then it will try a merge. If the automoated merge works, then it will proceed. If automated merge fails, then nothing will be pulled.

Usage

updateGit(
  pkgs = NULL,
  install = TRUE,
  branch = c("development", "master"),
  cacheRepo = getOption("pedev.cacheRepo", "~/.pedevCache"),
  fetch = TRUE,
  submodule = FALSE,
  quick = TRUE,
  dependencies = FALSE,
  reload = FALSE,
  ...
)

Arguments

pkgs

A character vector of package names, which is actually the path names of the packages. i.e., must be absolute or relative path. Defaults to current directory. It will also check in "..", i.e., one folder up from the current active folder if it doesn't find pkgs in the current folder.

install

Logical. If TRUE, then it will run devtools::install if there is new content. If branch was length > 1, only the active, i.e., first branch, will be installed.

branch

A vector of branch names to pull from, in reverse order so that the first one is the active branch after this function call finishes. Default is c("development", "master"), so it will pull from master, then development. If one of them does not exist, it will try, deteremine it doesn't exist, skip it and go to next branch.

cacheRepo

The location where subsequent calls will store their history. To be most effective, this should be "persistent", and not part of any other cacheRepo.

fetch

Logical. Should it fetch before pulling.

submodule

Logical. VERY EXPERIMENTAL. TRUE would mean pull all submodules... the problem is that branch gets complicated.

quick

if TRUE skips docs, multiple-architectures, demos, and vignettes, to make installation as fast as possible.

dependencies

Which dependencies do you want to check? Can be a character vector (selecting from "Depends", "Imports", "LinkingTo", "Suggests", or "Enhances"), or a logical vector.

TRUE is shorthand for "Depends", "Imports", "LinkingTo" and "Suggests". NA is shorthand for "Depends", "Imports" and "LinkingTo" and is the default. FALSE is shorthand for no dependencies (i.e. just check this package, not its dependencies).

The value "soft" means the same as TRUE, "hard" means the same as NA.

You can also specify dependencies from one or more additional fields, common ones include:

  • Config/Needs/website - for dependencies used in building the pkgdown site.

  • Config/Needs/coverage for dependencies used in calculating test coverage.

reload

if TRUE (the default), will automatically reload the package after installing.

...

Passed to devtools::install

Examples

## Not run: 
# This will pull development branch of all these packages, and install them
#    all, if there are any file changes in each respective directory
allPkgs <- c("quickPlot", "reproducible", "SpaDES.core", "SpaDES.tools",
             "pemisc", "map", "LandR", "pedev")
updateGit(allPkgs)

# Will update and install all development branches of all repositories
#   in ~/GitHub folder
pedev::updateGit(dir("~/GitHub"))


## End(Not run)

PredictiveEcology/pedev documentation built on Nov. 30, 2024, 1:18 a.m.