repos_url: Repository URLs

Description Usage Arguments See Also Examples

Description

Builds full repository URLs based on shortcut repository keys and host names, adding credentials if necessary.

Usage

1
repos_url(repos = getOption("repos"), ..., .netrc = NULL)

Arguments

repos

character vector of repository specifications, either a full URLs, e.g., 'http://repo.host.org' or 'file:///path/to/local/repo', or using repository shortcut keys, e.g., '@myRepo/path/to/repo/root', which is substituted based on the entries in netrc file.

...

other repository specification appended to repos.

.netrc

path or connection to a netrc file, which is looked up for matching repository/host entries. Default is to look for file '.netrc' in the user's home directory.

Repository and host credential entries are defined in an netrc file format (see read_netrc for more details).

Repository shortcut keys start a '@', e.g., '@myRepo/path/to/repo' and are substituted by the URL 'http://<login>:<password>@<machine><path>/path/to/repo', where <machine>, <path>, <login> and <password> are taken from the matched netrc specification.

Regular hosts are also matched against the netrc specification to add credentials if necessary.

See Also

Other auth: read_netrc, repos_auth

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# appending to default repos
repos_url('+')
repos_url('+http://another.repo.org')

# using toy example
f <- system.file('netrc', package = 'repotools')
if( interactive() ) file.show(f) else cat(readLines(f), sep = "\n")

# test different substitutions
spec <- c('@myRepo', '@myRepo/extra/path', 'http://www.public.org'
				, 'http://www.privatehost.org/repo/dir', '@CRAN@')
cbind(Specification = spec, URL = repos_url(spec, .netrc = f))

renozao/repotools documentation built on May 27, 2019, 5:53 a.m.