Skip to content

Commit c03a0f3

Browse files
committed
add desc pre-commit hook
1 parent c85ea4d commit c03a0f3

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: allcontributors
22
Title: Acknowledge all Contributors to a Project
3-
Version: 0.2.2.003
3+
Version: 0.2.2.004
44
Authors@R: c(
55
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre")),
66
person("Chris", "Hartgerink", role = "aut"),

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"codeRepository": "https://github.com/ropensci/allcontributors",
88
"issueTracker": "https://github.com/ropensci/allcontributors/issues",
99
"license": "https://spdx.org/licenses/GPL-3.0",
10-
"version": "0.2.2.003",
10+
"version": "0.2.2.004",
1111
"programmingLanguage": {
1212
"@type": "ComputerLanguage",
1313
"name": "R",

inst/precommit/description

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env Rscript
2+
3+
s <- gert::git_status()
4+
chk <- ("DESCRIPTION" %in% s$file &&
5+
(s$status [s$file == "DESCRIPTION"] == "modified" |
6+
s$status [s$file == "DESCRIPTION"] == "new"))
7+
if (!chk)
8+
stop ("DESCRIPTION has not been updated")
9+
10+
f <- file.path (here::here(), "DESCRIPTION")
11+
x <- system2 ("git", args = c ("diff", "--cached", "-U0", f), stdout = TRUE)
12+
if (!any (grepl ("^\\+Version", x)))
13+
stop ("Version number in DESCRIPTION has not been incremented")

0 commit comments

Comments
 (0)