Skip to content

Commit

Permalink
Merge pull request #118 from FelixErnst/tests-docs
Browse files Browse the repository at this point in the history
Tests docs
  • Loading branch information
eddelbuettel committed Apr 8, 2021
2 parents d9517ca + af229c3 commit 7be370d
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 33 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: drat
Type: Package
Title: 'Drat' R Archive Template
Version: 0.1.8.1
Date: 2021-03-13
Version: 0.1.8.2
Date: 2021-04-08
Author: Dirk Eddelbuettel with contributions by Carl Boettiger, Neal Fultz,
Sebastian Gibb, Colin Gillespie, Jan Górecki, Matt Jones, Thomas Leeper,
Steven Pav, Jan Schulz, Christoph Stepper, Felix G.M. Ernst and Patrick
Expand All @@ -21,4 +21,4 @@ License: GPL (>= 2)
URL: https://github.com/eddelbuettel/drat, https://dirk.eddelbuettel.com/code/drat.html
BugReports: https://github.com/eddelbuettel/drat/issues
Encoding: UTF-8
RoxygenNote: 6.0.1
RoxygenNote: 7.1.1
13 changes: 10 additions & 3 deletions R/insertPackage.R
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,24 @@ getPackageInfo <- function(file) {

td <- tempdir()
if (grepl(".zip$", file)) {
unzip(file, exdir = td)
unzip(file, exdir = td) # Windows
} else if (grepl(".tgz$", file)) {
untar(file, exdir = td)
untar(file, exdir = td) # macOS
} else {
# Source
##stop("Not sure we can handle ", file, call.=FALSE)
fields <- c("Source" = TRUE, "Rmajor" = NA, "osxFolder" = "")
return(fields)
}


# Working with data from compressed file only from here on
pkgname <- gsub("^([a-zA-Z0-9.]*)_.*", "\\1", basename(file))
path <- file.path(td, pkgname, "DESCRIPTION")
if(!file.exists(path)){
stop("DESCRIPTION file cannot be opened in '",file,"'. It is expected ",
"to be located in the base directory of compressed file.",
call. = FALSE)
}
builtstring <- read.dcf(path, 'Built')
unlink(file.path(td, pkgname), recursive = TRUE)

Expand Down
1 change: 1 addition & 0 deletions man/addRepo.Rd

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

16 changes: 11 additions & 5 deletions man/archivePackages.Rd

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

7 changes: 5 additions & 2 deletions man/initRepo.Rd

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

12 changes: 9 additions & 3 deletions man/insertPackage.Rd

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

47 changes: 35 additions & 12 deletions man/pruneRepo.Rd

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

17 changes: 12 additions & 5 deletions tests/skeleton_git2r.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

testSkeletonGit2r <- function() {
wd <- tempdir()

testSkeletonGit2r <- function(wd) {
# options(error=traceback)

# make a package to test with
Expand Down Expand Up @@ -268,7 +266,16 @@ testRepoActions <- function(repodir){
}
}

runTest <- function(wd, location = "gh-pages"){
options("dratBranch" = location)
repodir <- testSkeletonGit2r(wd)
testRepoActions(repodir)
unlink(file.path(wd,"foo"), recursive = TRUE)
unlink(file.path(wd,"drat"), recursive = TRUE)
}

wd <- tempdir()
if (requireNamespace("git2r", quietly=TRUE)) {
repodir <- testSkeletonGit2r()
testRepoActions(repodir)
runTest(wd, "gh-pages")
}
runTest(wd, "docs")

0 comments on commit 7be370d

Please sign in to comment.