forked from rstudio/packrat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.R
More file actions
executable file
·32 lines (25 loc) · 824 Bytes
/
configure.R
File metadata and controls
executable file
·32 lines (25 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env Rscript
library(utils)
args <- commandArgs(TRUE)
# Extract the Version field from the DESCRIPTION.
DESCRIPTION <- readLines("DESCRIPTION")
idx <- grep("^Version:", DESCRIPTION)
field <- DESCRIPTION[[idx]]
# Figure out what the minor-patch bumped version is.
bumpedDescVersion <- if (!grepl("-", DESCRIPTION[[idx]])) {
paste(field, "-1", sep = "")
} else {
minorVersion <- as.numeric(gsub(".*-", "", DESCRIPTION[[idx]]))
minorVersion <- minorVersion + 1
gsub("-.*", paste("-", minorVersion, sep = ""), DESCRIPTION[[idx]])
}
# Set the version field (use command line args if appropriate)
version <- if (length(args)) {
paste("Version:", args[[1]])
} else {
bumpedDescVersion
}
DESCRIPTION[[idx]] <- version
cat(DESCRIPTION, file = "DESCRIPTION", sep = "\n")
source("R/update.R")
updateInit()