Skip to content

Commit

Permalink
Save roxygen version in description.
Browse files Browse the repository at this point in the history
Fixes #338
  • Loading branch information
hadley committed Oct 6, 2015
1 parent c0f9c95 commit cbbf8c7
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 15 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ Collate:
'usage.R'
'util-locale.R'
'utils.R'
RoxygenNote: 4.1.1.9000
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by roxygen2 (4.1.1.9000): do not edit by hand
# Generated by roxygen2: do not edit by hand

S3method(c,rd)
S3method(clean,had)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# roxygen2 4.1.1.9000

* Roxygen now records its version in a single place: the `RoxygenNote`
field in the `DESCRIPTION` (#338).

* `\usage{}` is correctly generated for functions with string arguments
containing `"\""` (#265).

Expand Down
1 change: 1 addition & 0 deletions R/roxygenize.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ roxygenize <- function(package.dir = ".",
base_path <- normalizePath(package.dir)
man_path <- file.path(base_path, "man")
dir.create(man_path, recursive = TRUE, showWarnings = FALSE)
update_roxygen_version(base_path)

options <- load_options(base_path)
roclets <- roclets %||% options$roclets
Expand Down
16 changes: 14 additions & 2 deletions R/safety.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ check_made_by <- function(first) {
}

made_by <- function(comment) {
paste0(comment, " Generated by roxygen2 (", packageVersion("roxygen2"),
"): do not edit by hand\n")
paste0(comment, " Generated by roxygen2: do not edit by hand\n")
}

update_roxygen_version <- function(base_path) {
desc_path <- file.path(base_path, "DESCRIPTION")
old <- read.description(desc_path)

new <- old
new$RoxygenNote <- packageVersion("roxygen2")

if (!identical(old, new)) {
cat('Updating roxygen version in ', desc_path, "\n")

This comment has been minimized.

Copy link
@krlmlr

krlmlr Oct 6, 2015

Member

Would message work here?

This comment has been minimized.

Copy link
@hadley

hadley Oct 7, 2015

Author Member

I just copied what the equivalent collate update code does

write.description(new, desc_path)
}
}
2 changes: 1 addition & 1 deletion man/is_s3_generic.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/namespace_roclet.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/new_roclet.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/object.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/rd_roclet.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/register-parser.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/roc_proc_text.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/roxygen.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/roxygenize.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/source_package.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/update_collate.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/vignette_roclet.Rd

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

0 comments on commit cbbf8c7

Please sign in to comment.