Skip to content

Commit

Permalink
Update examples and tests to ignore the return value from uploadDirec…
Browse files Browse the repository at this point in the history
…tory.
  • Loading branch information
LTLA committed Apr 22, 2024
1 parent f1cc9ef commit 30d6b0b
Show file tree
Hide file tree
Showing 35 changed files with 45 additions and 47 deletions.
2 changes: 1 addition & 1 deletion R/approveProbation.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' # Mocking up an upload.
#' src <- allocateUploadDirectory(info$staging)
#' write(file=file.path(src, "foo"), "BAR")
#' res <- uploadDirectory("test", "probation", "v1", src,
#' uploadDirectory("test", "probation", "v1", src,
#' staging=info$staging, url=info$url, probation=TRUE)
#' fetchSummary("test", "probation", "v1", registry=info$registry)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/cloneVersion.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#' # Mocking up an upload.
#' src <- allocateUploadDirectory(info$staging)
#' write(file=file.path(src, "foo"), "BAR")
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#'
#' # Creating a clone.
#' dest <- tempfile()
Expand Down
2 changes: 1 addition & 1 deletion R/fetchDirectory.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#' dir.create(file.path(src, "whee"))
#' write(file=file.path(src, "whee", "blah"), "stuff")
#' write(file=file.path(src, "whee2"), "more-stuff")
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#'
#' # Now fetching the directory.
#' dir <- fetchDirectory("test/simple/v1", registry=info$registry, url=info$url)
Expand Down
4 changes: 2 additions & 2 deletions R/fetchLatest.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#'
#' # Mocking up a few uploads.
#' src <- allocateUploadDirectory(info$staging)
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' res <- uploadDirectory("test", "simple", "v2", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v2", src, staging=info$staging, url=info$url)
#'
#' # Obtaining the latest version of this asset.
#' fetchLatest("test", "simple", registry=info$registry, url=info$url)
Expand Down
2 changes: 1 addition & 1 deletion R/fetchManifest.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#' write(file=file.path(src, "foo"), "BAR")
#' dir.create(file.path(src, "whee"))
#' write(file=file.path(src, "whee", "blah"), "stuff")
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#'
#' # Obtaining the manifest for this version.
#' fetchManifest("test", "simple", "v1", registry=info$registry, url=info$url)
Expand Down
2 changes: 1 addition & 1 deletion R/fetchSummary.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' # Mocking up an upload.
#' src <- allocateUploadDirectory(info$staging)
#' write(file=file.path(src, "foo"), "BAR")
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#'
#' # Obtain a summary for this version.
#' fetchSummary("test", "simple", "v1", registry=info$registry, url=info$url)
Expand Down
2 changes: 1 addition & 1 deletion R/fetchUsage.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#' src <- allocateUploadDirectory(info$staging)
#' write(file=file.path(src, "foo"), "BAR")
#' write(file=file.path(src, "whee"), "stuff")
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#'
#' # Obtaining the project usage.
#' fetchUsage("test", registry=info$registry)
Expand Down
2 changes: 1 addition & 1 deletion R/listFiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' dir.create(file.path(src, "whee"))
#' write(file=file.path(src, "whee", "blah"), "stuff")
#' write(file=file.path(src, "whee2"), "more-stuff")
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#'
#' # List files, with or without a prefix.
#' listFiles("test", "simple", "v1", registry=info$registry, url=info$url)
Expand Down
2 changes: 1 addition & 1 deletion R/refreshUsage.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' src <- allocateUploadDirectory(info$staging)
#' write(file=file.path(src, "foo"), "BAR")
#' write(file=file.path(src, "whee"), "stuff")
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#'
#' # Messing with the project usage:
#' write(file=file.path(info$registry, "test", "..usage"), '{ "total": 0 }')
Expand Down
2 changes: 1 addition & 1 deletion R/rejectProbation.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' # Mocking up an upload.
#' src <- allocateUploadDirectory(info$staging)
#' write(file=file.path(src, "foo"), "BAR")
#' res <- uploadDirectory("test", "probation", "v1", src,
#' uploadDirectory("test", "probation", "v1", src,
#' staging=info$staging, url=info$url, probation=TRUE)
#' listVersions("test", "probation", registry=info$registry)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/removeAsset.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' # Mocking up an asset so we have something to remove.
#' src <- allocateUploadDirectory(info$staging)
#' write(file=file.path(src, "foo"), "BAR")
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' listAssets("test", registry=info$registry)
#'
#' # Removing the asset.
Expand Down
2 changes: 1 addition & 1 deletion R/removeVersion.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' # Mocking up a version if it doesn't already exist.
#' src <- allocateUploadDirectory(info$staging)
#' write(file=file.path(src, "foo"), "BAR")
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' listVersions("test", "simple", registry=info$registry)
#'
#' # Removing the version.
Expand Down
2 changes: 1 addition & 1 deletion R/setPermissions.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#' # Mocking up an upload.
#' src <- allocateUploadDirectory(info$staging)
#' write(file=file.path(src, "foo"), "BAR")
#' res <- uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' uploadDirectory("test", "simple", "v1", src, staging=info$staging, url=info$url)
#' fetchPermissions("test", registry=info$registry)
#'
#' # Setting them to something else.
Expand Down
3 changes: 1 addition & 2 deletions R/uploadDirectory.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
#' src <- allocateUploadDirectory(info$staging)
#' write(file=file.path(src, "foo"), "BAR")
#'
#' res <- uploadDirectory(
#' uploadDirectory(
#' project="test",
#' asset="simple",
#' version="v1",
#' directory=src,
#' staging=info$staging,
#' url=info$url
#' )
#' res
#'
#' @seealso
#' \code{\link{createProject}}, to create a new project for uploads.
Expand Down
2 changes: 1 addition & 1 deletion man/approveProbation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cloneVersion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fetchDirectory.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/fetchLatest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fetchManifest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fetchSummary.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/fetchUsage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/listFiles.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/refreshUsage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/rejectProbation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/removeAsset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/removeVersion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/setPermissions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/uploadDirectory.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-cloneVersion.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ write(file=file.path(src, "foo"), "BAR")
dir.create(file.path(src, "whee"))
write(file=file.path(src, "whee", "blah"), "stuff")

res <- uploadDirectory("test", "clone", "v1", src, staging=info$staging, url=info$url)
uploadDirectory("test", "clone", "v1", src, staging=info$staging, url=info$url)

test_that("cloneVersion works as expected with existing files", {
dest <- tempfile()
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-fetch.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ write(file=file.path(src, "foo"), "BAR")
dir.create(file.path(src, "whee"))
write(file=file.path(src, "whee", "blah"), "stuff")

res <- uploadDirectory("test", "fetch", "v1", src, staging=info$staging, url=info$url)
res <- uploadDirectory("test", "fetch", "v2", src, staging=info$staging, url=info$url)
uploadDirectory("test", "fetch", "v1", src, staging=info$staging, url=info$url)
uploadDirectory("test", "fetch", "v2", src, staging=info$staging, url=info$url)

test_that("fetchManifest works as expected", {
man <- fetchManifest("test", "fetch", "v1", registry=info$registry, url=info$url)
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-latest.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ removeProject("test", staging=info$staging, url=info$url)
createProject("test", staging=info$staging, url=info$url)

src <- allocateUploadDirectory(info$staging)
res <- uploadDirectory("test", "latest", "v1", src, staging=info$staging, url=info$url)
uploadDirectory("test", "latest", "v1", src, staging=info$staging, url=info$url)
Sys.sleep(1.1) # force timestamps to be different for next versions.
res <- uploadDirectory("test", "latest", "v2", src, staging=info$staging, url=info$url)
uploadDirectory("test", "latest", "v2", src, staging=info$staging, url=info$url)
Sys.sleep(1.1)
res <- uploadDirectory("test", "latest", "v3", src, staging=info$staging, url=info$url)
uploadDirectory("test", "latest", "v3", src, staging=info$staging, url=info$url)

test_that("latest setting works as expected", {
expect_identical(fetchLatest("test", "latest", registry=info$registry), "v3")
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-list.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ dir.create(file.path(src, "whee"))
write(file=file.path(src, "whee", "blah"), "stuff")
write(file=file.path(src, "whee2"), LETTERS)

res <- uploadDirectory("test", "list", "v1", src, staging=info$staging, url=info$url)
res <- uploadDirectory("test", "list", "v2", src, staging=info$staging, url=info$url)
res <- uploadDirectory("test", "more-list", version="foo", src, staging=info$staging, url=info$url)
res <- uploadDirectory("more-list-test", "list", version="bar", src, staging=info$staging, url=info$url)
uploadDirectory("test", "list", "v1", src, staging=info$staging, url=info$url)
uploadDirectory("test", "list", "v2", src, staging=info$staging, url=info$url)
uploadDirectory("test", "more-list", version="foo", src, staging=info$staging, url=info$url)
uploadDirectory("more-list-test", "list", version="bar", src, staging=info$staging, url=info$url)

test_that("listVersions works as expected", {
versions <- listVersions("test", "list", registry=info$registry, url=info$url)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-probation.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ createProject("test", staging=info$staging, url=info$url)
# Mocking up an upload.
src <- allocateUploadDirectory(info$staging)
write(file=file.path(src, "foo"), "BAR")
res <- uploadDirectory("test", "probation", "good", src, staging=info$staging, url=info$url, probation=TRUE)
res <- uploadDirectory("test", "probation", "bad", src, staging=info$staging, url=info$url, probation=TRUE)
uploadDirectory("test", "probation", "good", src, staging=info$staging, url=info$url, probation=TRUE)
uploadDirectory("test", "probation", "bad", src, staging=info$staging, url=info$url, probation=TRUE)

test_that('probation approval works as expected', {
expect_true(fetchSummary("test", "probation", "good", registry=info$registry)$on_probation)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-quota.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ createProject("test-usage", info$staging, url=info$url)
src <- allocateUploadDirectory(info$staging)
write(file=file.path(src, "foo"), "BAR")
write(file=file.path(src, "whee"), "stuff")
res <- uploadDirectory("test-usage", "simple", "v1", src, staging=info$staging, url=info$url)
uploadDirectory("test-usage", "simple", "v1", src, staging=info$staging, url=info$url)

test_that("usage refreshment works as expected", {
write(file=file.path(info$registry, "test-usage", "..usage"), '{ "total": 0 }')
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-remove.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ removeProject("test-R-remove", staging=info$staging, url=info$url)
createProject("test-R-remove", staging=info$staging, url=info$url)

src <- allocateUploadDirectory(info$staging)
res <- uploadDirectory("test-R-remove", "sacrifice", "v1", src, staging=info$staging, url=info$url)
uploadDirectory("test-R-remove", "sacrifice", "v1", src, staging=info$staging, url=info$url)
Sys.sleep(1.1) # force timestamps to be different for next versions.
res <- uploadDirectory("test-R-remove", "sacrifice", "v2", src, staging=info$staging, url=info$url)
uploadDirectory("test-R-remove", "sacrifice", "v2", src, staging=info$staging, url=info$url)

test_that("removal functions work as expected", {
expect_true(file.exists(file.path(info$registry, "test-R-remove", "sacrifice", "v2")))
Expand Down

0 comments on commit 30d6b0b

Please sign in to comment.