Skip to content

Commit

Permalink
Adding pre-commit hook for README even when not overwritten. Fixes #2035
Browse files Browse the repository at this point in the history
.
  • Loading branch information
jplecavalier committed Aug 16, 2024
1 parent a225a21 commit 0036333
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Bug fixes and minor improvements

* `use_readme_rmd()` now adds the pre-commit hook for making sure README.Rmd
was knited before commit (@jplecavalier, #2035).

* `use_package()` now decreases a package minimum version required when
`min_version` is lower than what is currently specified in the DESCRIPTION
file (@jplecavalier, #1957).
Expand Down
14 changes: 7 additions & 7 deletions R/readme.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ use_readme_rmd <- function(open = rlang::is_interactive()) {
github_spec = repo_spec
)

if (uses_git()) {
use_git_hook(
"pre-commit",
render_template("readme-rmd-pre-commit.sh")
)
}

new <- use_template(
if (is_pkg) "package-README" else "project-README",
"README.Rmd",
Expand All @@ -65,13 +72,6 @@ use_readme_rmd <- function(open = rlang::is_interactive()) {
))
}

if (uses_git()) {
use_git_hook(
"pre-commit",
render_template("readme-rmd-pre-commit.sh")
)
}

invisible(TRUE)
}

Expand Down

0 comments on commit 0036333

Please sign in to comment.