Skip to content

Commit

Permalink
Create maintenance.R
Browse files Browse the repository at this point in the history
  • Loading branch information
psolymos committed Dec 22, 2019
1 parent 1e3a149 commit fdb4254
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions inst/tmp/maintenance.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
remotes::install_github("psolymos/bSims")
install.packages("bSims")
library(bSims)

## >>> dowload and revdep stats to save periodically

library("ggplot2")
library("dlstats")
pkg <- "bSims"
dt <- as.POSIXlt(Sys.Date())
yyyymm <- paste0(dt$year+1900, "-",
if (dt$mon < 10) "0" else "", dt$mon) # mon is 0-11
x <- cran_stats(pkg)
rd <- sapply(c("Depends", "Imports", "Suggests", "LinkingTo"),
function(z) devtools::revdep(pkg, z))
p <- ggplot(x[x$start < max(x$start),], aes(end, downloads)) +
geom_line() + geom_smooth() +
labs(title=paste0(pkg, " monthly downloads"))
ggsave(paste0("inst/tmp/bSims-downloads-", yyyymm, ".png"), p)

## >>> prepare CRAN submission

submit_cran_template <- function(path = ".") {
news <- readLines(file.path(path, "NEWS.md"))
i <- which(startsWith(news, "#"))[1L:2L]
latest <- news[i[1L]:(i[2L]-1)]
latest <- latest[-1]
latest <- latest[latest != ""]
descr <- read.dcf(file.path(path, "DESCRIPTION"))
ver <- unname(descr[1L,"Version"])
pkg <- unname(descr[1L,"Package"])
maint <- unname(descr[1L,"Maintainer"])
out <- c(
"Dear CRAN Maintainers,\n\n",
"This is an update (version ", ver, ") of the ",
pkg, " R extension package.\n\n",
"The package includes the following changes:\n\n",
paste(latest, collapse="\n"),
"\n\nThe package tarball passed R CMD check --as-cran ",
"without error/warning/note on Mac (current R), ",
"Linux (old, current, devel), and Windows (current, devel R).\n\n",
"Best wishes,\n\n",
maint, "\npackage maintainer")
out
}

cat(submit_cran_template(), sep="")



0 comments on commit fdb4254

Please sign in to comment.