PackageRepository: Class: PackageRepository

Description Usage Format Fields Methods Author(s) References Examples

Description

Class representing package repositories.

Usage

1

Format

1
2
Class 'R6ClassGenerator' <environment: 0x0000000014828188> 
 - attr(*, "name")= chr "PackageRepository_generator"

Fields

root

character. Repository's root path.

scheme

character. Repository URL scheme.

normalize

logical. TRUE: normalize repository root; FALSE: take repository root "as is" (for relative paths).

detect_scheme

logical. TRUE: detect scheme from repository root; FALSE: no scheme detection.

packrat

logical. TRUE: a project-based package repository is created that integrates seamlessly with https://github.com/rstudio/packrat; FALSE: no project-based repository is created.

Methods

testMethod

Author(s)

Janko Thyson janko.thyson@gmail.com

References

http://github.com/rappster/reposr

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
##------------------------------------------------------------------------------
## Preliminaries //
##------------------------------------------------------------------------------

## Choose root directory //
root <- file.path(tempdir(), "cran")

## Create instance //
repo <- PackageRepository$new(root)

## Investigate object structure //
repo
print(repo, full = TRUE)

## Most important fields //
repo$root
repo$root_atomic
repo[[getOption("pkgType")]]
repo$win.binary
repo$mac.binary
repo$source

repo$scheme
repo$normalize 
repo$detect_scheme 

##------------------------------------------------------------------------------
## Top-level methods (in alphabetical order) //
##------------------------------------------------------------------------------

#######
## A ##
#######

## As URL path //
repo$asUrl()
repo$asUrl(scheme = "http")
repo$asUrl(scheme = "ftp")

repo$asUrl(archive = TRUE)
repo$asUrl(scheme = "http", archive = TRUE)
repo$asUrl(scheme = "ftp", archive = TRUE)

#######
## B ##
#######

## Build into //
repo$ensure()
repo$buildInto()

## Check how repo has changed:
repo$browse(getOption("pkgType"))

## Browse //
repo$ensure()
repo$browse()
repo$browse("win.binary")
repo$browse("mac.binary")
repo$browse("source")

repo$ensure(archive = TRUE)
repo$browse(archive = TRUE)
repo$browse("win.binary", archive = TRUE)
repo$browse("mac.binary", archive = TRUE)
repo$browse("source", archive = TRUE)

#######
## C ##
#######

## Clean //
repo$clean()

#######
## D ##
#######

## Delete //
repo$delete()
repo$ensure()
repo$delete(ask = FALSE)
repo$delete(ask = FALSE)
## --> trying to delete a non-existing repo

repo$delete(archive = TRUE)
repo$ensure(archive = TRUE)
repo$delete(archive = TRUE, ask = FALSE)

#######
## E ##
#######

## Ensure //
repo$ensure()
repo$ensure(overwrite = TRUE)

repo$ensure(archive = TRUE)

## Ensure existence //
file.exists(repo$root)
repo$ensure()
file.exists(repo$root)

file.exists(repo$root_atomic)
repo$ensure(archive = TRUE)
file.exists(repo$root_atomic)

## Exists //
repo$exists()
repo$ensure()
repo$exists()

repo$exists(archive = TRUE)
repo$ensure(archive = TRUE)
repo$exists(archive = TRUE)

#######
## H ##
#######

## Has any packages //
repo$hasAny()
repo$hasAny(atomic = FALSE)

## Has packages //
repo$has()
repo$buildInto()
repo$has()
repo$has(atomic = FALSE)
repo$has(type = "source", atomic = FALSE)
repo$has(type = "mac.binary", atomic = FALSE)
repo$has(type = "win.binary", atomic = FALSE)

repo$has("devtools")
repo$has(c("testthat", "devtools"))

#######
## R ##
#######

## Refresh //
repo$refresh()

## Register //
repo$register()

## Remove packages //
repo$remove()

## Reset //
repo$reset()

#######
## S ##
#######

## Show //
repo$show()
## --> if empty data frame call '$buildInto()` before
# repo$buildInto()
repo$show()

rappster/reposr documentation built on May 26, 2019, 11:57 p.m.