Skip to content

Commit

Permalink
undo roxygen2's hack r-lib/roxygen2#568 because importRd() will try t…
Browse files Browse the repository at this point in the history
…o import/export objects from base R, which is because getNamespaceExports(pkg) will return wrong objects
  • Loading branch information
yihui committed Aug 2, 2018
1 parent 61bd574 commit 6a86932
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: Rd2roxygen
Type: Package
Title: Convert Rd to 'Roxygen' Documentation
Version: 1.6.2
Version: 1.6.3
Date: 2017-03-30
Authors@R: c(
person("Hadley", "Wickham", role = "aut"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
CHANGES IN Rd2roxygen VERSION 1.7

BUG FIXES

o importRd() fails due to a change in roxygen2 (https://github.com/klutometis/roxygen/issues/568).

CHANGES IN Rd2roxygen VERSION 1.6.2

MAJOR CHANGES
Expand Down
9 changes: 7 additions & 2 deletions R/build.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@ roxygen_and_build = function(
if (length(pkg) != 1) stop('The package directory must be one character string')
in_dir(pkg, before)
roxygen2::roxygenize(pkg, ...)
desc = file.path(pkg, 'DESCRIPTION')
pv = read.dcf(desc, fields = c('Package', 'Version'))
# undo roxygen2's hack https://github.com/klutometis/roxygen/issues/568
# because it affects importRd()
for (name in intersect(c('devtools_shims', paste0('package:', pv[1, 1])), search())) {
detach(name, unload = TRUE, character.only = TRUE)
}
if (reformat) {
message('Reformatting usage and examples')
rd.list = list.files(
file.path(pkg, 'man'), '.*\\.Rd$', all.files = TRUE, full.names = TRUE
)
for (f in rd.list) reformat_code(f)
}
desc = file.path(pkg, 'DESCRIPTION')
pv = read.dcf(desc, fields = c('Package', 'Version'))
# delete existing tarballs
unlink(sprintf('%s_*.tar.gz', pv[1, 1]))
if (build) {
Expand Down

0 comments on commit 6a86932

Please sign in to comment.