diff --git a/NEWS b/NEWS index b3aa02d..9201f65 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +CHANGES IN VERSION 1.68.0 +------------------------- + +NEW FEATURES + + o getPackageNEWS and printNEWS are deprecated from biocViews. + See help('biocViews-deprecated') for more details. + CHANGES IN VERSION 1.67.0 ------------------------- diff --git a/R/getPackageNEWS.R b/R/getPackageNEWS.R index a714b57..0649d8a 100644 --- a/R/getPackageNEWS.R +++ b/R/getPackageNEWS.R @@ -9,13 +9,20 @@ ## collate package NEWS files using starting version number in ## prevRepos, and membership in currRepos as references. Package ## source tree rooted at srcDir, possibiblly as tarred files - +utils::globalVariables("Version") # repo: bioc data/experiment workflows getPackageNEWS <- function(prevRepos="3.6", currRepos="3.7", repo=c("bioc", "data/experiment", "workflows"), srcdir=NULL){ - + .Deprecated( + "getPackagesNEWS", "ReleaseLaunch", + c( + "'getPackageNEWS' is deprecated.\n", + "Use 'ReleaseLaunch::getPackagesNEWS' instead.\n", + "See help(\"biocViews-deprecated\")" + ) + ) repo <- match.arg(repo) URL_BASE <- "http://master.bioconductor.org/packages/" VIEWS <- "%s%s/%s/VIEWS" @@ -73,99 +80,17 @@ getPackageNEWS <- function(prevRepos="3.6", } - -## based on tools:::.build_news_db() -getNEWSFromFile <- function (dir, destfile, format = NULL, reader = NULL, - output=c("md", "text")) -{ - mdIfy <- function(txt) - { - lines <- strsplit(txt, "\n") - segs <- lines[[1]] - segs <- sub("^ o +", "- ", segs) - segs <- sub("^\t", " ", segs) - return(paste(segs, collapse="\n")) - } - - newsRdFile <- file.path(dir, "NEWS.Rd") ## should never be found - newsRdFile2 <- file.path(dir, "inst", "NEWS.Rd") - - if (!file_test("-f", newsRdFile) && !file_test("-f", newsRdFile2)) { - - - newsMdFile <- file.path(dir, "NEWS.md") - newsMdFile2 <- file.path(dir, "inst", "NEWS.md") - - if (!file_test("-f", newsMdFile) && !file_test("-f", newsMdFile2)) { - - - nfile <- file.path(dir, "NEWS") - nfile2 <- file.path(dir, "inst", "NEWS") - - - if (!file_test("-f", nfile) && !file_test("-f", nfile2)) - return(invisible()) - - nfile <- ifelse(file_test("-f", nfile), nfile, nfile2) - - if (!is.null(format)) - .NotYetUsed("format", FALSE) - if (!is.null(reader)) - .NotYetUsed("reader", FALSE) - - file <- file(destfile, "w+") - on.exit(close(file)) - news <- paste(readLines(nfile), collapse="\n") - if ("md" == output) - news = mdIfy(news) - cat(news, file=file) - return(invisible()) - } - - newsMdFile <- ifelse(file_test("-f", newsMdFile), newsMdFile, - newsMdFile2) - file <- file(destfile, "w+") - on.exit(close(file)) - db <- tools:::.build_news_db_from_package_NEWS_md(newsMdFile) - news <- NULL - try(news <- capture.output(print(db))) - if (is.null(news)) - { - message(sprintf("Error building news database for %s/%s", - dir, destfile)) - return(invisible()) - } - news <- paste(news, collapse="\n") - if ("md" == output) - news <- mdIfy(news) - cat(news, file=file) - return(invisible()) - } - - newsRdFile <- ifelse(file_test("-f", newsRdFile), newsRdFile, newsRdFile2) - - file <- file(destfile, "w+") - on.exit(close(file)) - db <- tools:::.build_news_db_from_package_NEWS_Rd(newsRdFile) - news <- NULL - try(news <- capture.output(print(db))) - if (is.null(news)) - { - message(sprintf("Error building news database for %s/%s", - dir, destfile)) - return(invisible()) - } - news <- paste(news, collapse="\n") - if ("md" == output) - news <- mdIfy(news) - cat(news, file=file) - return(invisible()) -} - - printNEWS <- function(dbs, destfile, overwrite=FALSE, width=68, output=c("md", "text"), relativeLink=FALSE, ...) { + .Deprecated( + "printNEWS", "ReleaseLaunch", + c( + "'printNEWS' is deprecated.\n", + "Use 'ReleaseLaunch::printNEWS' instead.\n", + "See help(\"biocViews-deprecated\")" + ) + ) output <- match.arg(output) dbs <- lapply(dbs, function(db) { db[["Text"]] <- sapply(db[["Text"]], function(elt) { diff --git a/R/repository.R b/R/repository.R index eb3b041..b591da8 100644 --- a/R/repository.R +++ b/R/repository.R @@ -308,6 +308,94 @@ extractReadmes <- function(reposRoot, srcContrib, destDir) { extractTopLevelFiles(reposRoot, srcContrib, destDir, "README") } +## based on tools:::.build_news_db() +getNEWSFromFile <- function (dir, destfile, format = NULL, reader = NULL, + output=c("md", "text")) +{ + mdIfy <- function(txt) + { + lines <- strsplit(txt, "\n") + segs <- lines[[1]] + segs <- sub("^ o +", "- ", segs) + segs <- sub("^\t", " ", segs) + return(paste(segs, collapse="\n")) + } + + newsRdFile <- file.path(dir, "NEWS.Rd") ## should never be found + newsRdFile2 <- file.path(dir, "inst", "NEWS.Rd") + + if (!file_test("-f", newsRdFile) && !file_test("-f", newsRdFile2)) { + + + newsMdFile <- file.path(dir, "NEWS.md") + newsMdFile2 <- file.path(dir, "inst", "NEWS.md") + + if (!file_test("-f", newsMdFile) && !file_test("-f", newsMdFile2)) { + + + nfile <- file.path(dir, "NEWS") + nfile2 <- file.path(dir, "inst", "NEWS") + + + if (!file_test("-f", nfile) && !file_test("-f", nfile2)) + return(invisible()) + + nfile <- ifelse(file_test("-f", nfile), nfile, nfile2) + + if (!is.null(format)) + .NotYetUsed("format", FALSE) + if (!is.null(reader)) + .NotYetUsed("reader", FALSE) + + file <- file(destfile, "w+") + on.exit(close(file)) + news <- paste(readLines(nfile), collapse="\n") + if ("md" == output) + news = mdIfy(news) + cat(news, file=file) + return(invisible()) + } + + newsMdFile <- ifelse(file_test("-f", newsMdFile), newsMdFile, + newsMdFile2) + file <- file(destfile, "w+") + on.exit(close(file)) + db <- tools:::.build_news_db_from_package_NEWS_md(newsMdFile) + news <- NULL + try(news <- capture.output(print(db))) + if (is.null(news)) + { + message(sprintf("Error building news database for %s/%s", + dir, destfile)) + return(invisible()) + } + news <- paste(news, collapse="\n") + if ("md" == output) + news <- mdIfy(news) + cat(news, file=file) + return(invisible()) + } + + newsRdFile <- ifelse(file_test("-f", newsRdFile), newsRdFile, newsRdFile2) + + file <- file(destfile, "w+") + on.exit(close(file)) + db <- tools:::.build_news_db_from_package_NEWS_Rd(newsRdFile) + news <- NULL + try(news <- capture.output(print(db))) + if (is.null(news)) + { + message(sprintf("Error building news database for %s/%s", + dir, destfile)) + return(invisible()) + } + news <- paste(news, collapse="\n") + if ("md" == output) + news <- mdIfy(news) + cat(news, file=file) + return(invisible()) +} + extractNEWS <- function(reposRoot, srcContrib, destDir) { if (missing(destDir)) diff --git a/man/getPackageNEWS.Rd b/man/biocViews-deprecated.Rd similarity index 71% rename from man/getPackageNEWS.Rd rename to man/biocViews-deprecated.Rd index b1f7a82..ef54ed9 100644 --- a/man/getPackageNEWS.Rd +++ b/man/biocViews-deprecated.Rd @@ -1,24 +1,28 @@ -\name{getPackageNEWS} +\name{biocViews-deprecated} + \alias{getPackageNEWS} \alias{printNEWS} -\title{ - Retrieve and print package NEWS -} -\description{ +\alias{biocViews-deprecated} - These functions visit two Bioconductor releases, identifying - packages that are present in the \sQuote{current} repository and have - NEWS since the base version of the same package in the - \sQuote{previous} release. All NEWS is reported for packages only - in the current repository. +\title{Deprecated NEWS functions in biocViews} + +\description{ + Functions working with a package's NEWS file have been moved out of the + package. These include \code{getPackageNEWS}, and \code{printNEWS}. + Please see the \code{ReleaseLaunch} package. } + \usage{ -getPackageNEWS(prevRepos="3.6", - currRepos="3.7", - repo=c("bioc", "data/experiment", "workflows"), - srcdir = NULL) -printNEWS(dbs, destfile, overwrite = FALSE, width = 68, - output=c("md", "text"), relativeLink=FALSE, ...) +getPackageNEWS( + prevRepos="3.6", + currRepos="3.7", + repo=c("bioc", "data/experiment", "workflows"), + srcdir = NULL +) +printNEWS( + dbs, destfile, overwrite = FALSE, width = 68, output=c("md", "text"), + relativeLink=FALSE, ... +) } \arguments{ @@ -53,8 +57,8 @@ printNEWS(dbs, destfile, overwrite = FALSE, width = 68, 'https//bioconductor.org'. default: FALSE is full url.} \item{...}{additional arguments, unused.} - } + \value{ A list of \code{news_db} files, as returned by \code{utils::news}, for each package for which relevant NEWS is available. @@ -63,4 +67,6 @@ printNEWS(dbs, destfile, overwrite = FALSE, width = 68, Martin Morgan \url{mtmorgan@fhcrc.org} and Lori Shepherd } +\seealso{\url{https://github.com/Bioconductor/ReleaseLaunch}} + \keyword{manip}% __ONLY ONE__ keyword per line