install_bitbucket
allows users to install R packages
hosted on Bitbucket without needing to install or load the heavy
dependencies required by devtools. ghit provides a drop-in replacement that
provides (almost) identical functionality to
devtools::install_bitbucket()
. The install_bitbucket_server
interface provides some convenient default values for host
and
credentials
for corporate users.
install_bitbucket(repo, host = "bitbucket.org", credentials = NULL,
build_args = NULL, build_vignettes = TRUE, uninstall = FALSE,
verbose = FALSE, repos = NULL, type = "source", dependencies = NA,
...)install_bitbucket_server(repo, host = Sys.getenv("BITBUCKET_HOST"),
credentials = bitbucket_cred(), build_args = NULL,
build_vignettes = TRUE, uninstall = FALSE, verbose = FALSE,
repos = NULL, type = if (.Platform[["pkgType"]] %in% "win.binary")
"both" else "source", dependencies = c("Depends", "Imports"), ...)
A character vector naming one or more GitHub repository containing an R package to install (e.g., “imanuelcostigan/devtest”), or optionally a branch (“imanuelcostigan/devtest[dev]”), a reference (“imanuelcostigan/devtest@309fa0a”), tag (“imanuelcostigan/devtest@v0.1”), or subdirectory (“imanuelcostigan/samplepackage/R”). These arguments can be placed in any order and in any combination (e.g., “imanuelcostigan/devtest[master]@abc123/R”). As the use of pull request (PR) references are not supported by Bitbucket, you should install from the PR's source repository and branch.
A character string naming a host. This defaults to
bitbucket.org
when using the install_bitbucket()
interface
and can be set other values to enable installation of Bitbucket Server
packages. However, the install_bitbucket_server()
provides a more
convenient default value sourced from the BITBUCKET_HOST
environment
variable by default.
An argument passed to the credentials
argument to
fetch
. See cred_user_pass
or
cred_ssh_key
. This defaults to: using the use the SSH
key via cred_ssh_key
when using the
install_bitbucket()
interface; and supplying to
cred_user_pass
the username and password values stored
in the USERNAME
and BITBUCKET_PASS
environment variables when
using install_bitbucket_server()
interface.
A character string used to control the package build,
passed to R CMD build
.
A logical specifying whether to build package
vignettes, passed to R CMD build
. Can be slow. Note: The default is
TRUE
, unlike in devtools::install_github()
.
A logical specifying whether to uninstall previous
installations using remove.packages
before attempting
install. This is useful for installing an older version of a package than
the one currently installed.
A logical specifying whether to print details of package building and installation.
A character vector specifying one or more URLs for CRAN-like
repositories from which package dependencies might be installed. By
default, value is taken from options("repos")
or set to the CRAN
cloud repository.
A character vector passed to the type
argument of
install.packages
.
A character vector specifying which dependencies to install (of “Depends”, “Imports”, “Suggests”, etc.).
Additional arguments to control installation of package, passed
to install.packages
.
A named character vector of R package versions installed.
tmp <- file.path(tempdir(), "tmplib")
dir.create(tmp)
# install a single package. Multiple package install is also supported.
install_bitbucket("imanuelcostigan/devtest", lib = tmp)
# Install from Bitbucket Server
install_bitbucket_server("projectname/reponame")
# cleanup
unlink(tmp, recursive = TRUE)
Run the code above in your browser using DataLab