Skip to content

Commit

Permalink
version 0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel authored and cran-robot committed Mar 21, 2024
1 parent b9358ab commit 3b4247a
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 34 deletions.
31 changes: 31 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
2024-03-20 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Release 0.0.2

2024-03-19 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Roll micro reD lease and date

* R/incoming.R: New state variable 'known_folders', more robust error
handling in case of network issues
* man/incoming.Rd: Corresponding documentation

2024-03-17 Dirk Eddelbuettel <edd@debian.org>

* R/incoming.R (ciw): Define as alias for incoming()
* man/incoming.Rd: Document alias 'ciw'
* man/ciw-package.Rd: Remove package alias 'ciw'
* NAMESPACE: Export 'ciw'

2024-03-13 Dirk Eddelbuettel <edd@debian.org>

* README.md: Add three more badges, edits

* DESCRIPTION (URL, BugReports): Added

2024-03-12 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Release 0.0.1

* inst/NEWS.Rd: Added

2024-03-08 Dirk Eddelbuettel <edd@debian.org>

* .github/workflows/ci.yaml: Add continuous integration support
Expand Down
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: ciw
Type: Package
Title: Watch the CRAN Incoming Directories
Version: 0.0.1
Date: 2024-03-12
Version: 0.0.2
Date: 2024-03-20
Authors@R: person(given = "Dirk", family = "Eddelbuettel",
role = c("aut", "cre"), email = "edd@debian.org",
comment = c(ORCID = "0000-0001-6419-907X"))
Expand All @@ -11,11 +11,13 @@ Description: Directory reads and summaries are provided for one or more of the s
The package name is a contraption of 'CRAN Incoming Watcher'.
License: GPL (>= 2)
Imports: curl, XML, data.table (>= 1.5.0)
URL: https://github.com/eddelbuettel/ciw
BugReports: https://github.com/eddelbuettel/ciw/issues
Encoding: UTF-8
RoxygenNote: 6.0.1
NeedsCompilation: no
Packaged: 2024-03-13 00:17:55 UTC; edd
Packaged: 2024-03-20 11:52:03 UTC; edd
Author: Dirk Eddelbuettel [aut, cre] (<https://orcid.org/0000-0001-6419-907X>)
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Repository: CRAN
Date/Publication: 2024-03-13 11:50:02 UTC
Date/Publication: 2024-03-20 12:10:02 UTC
17 changes: 9 additions & 8 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
59f6d40265d3e37b65c55756e6e32077 *ChangeLog
1615703d0d24ebb0619d9d77c871296f *DESCRIPTION
0bc1a2600a9b110f8d0ac1ffdd3275c0 *NAMESPACE
4be5f44740b3ccc2dcc6658ffb935a6a *R/incoming.R
dd6872b946fd655402e3db5676d4fe3d *README.md
f2b9a7d19b0a3e88c205e6b55a17310b *build/partial.rdb
20cc93558e27b899a1bb68560a023d85 *man/ciw-package.Rd
7f106d1af1c71591a2d8895f5f1fd7cc *man/incoming.Rd
1dc0e5c6a99cbfbac4bfd1b20aff6d6d *ChangeLog
7a903f4a61e26b74081d883f22db6e9f *DESCRIPTION
cd38afde88f3d19b79e6f915c2338816 *NAMESPACE
357d93c07f498293cd5d0284675d1843 *R/incoming.R
efc6fde78be8fbc91e50df476057fb60 *README.md
2e961b5eef9917fa502546b5a79e0cd7 *build/partial.rdb
58dd51336cadd4a3723e703ea7758151 *inst/NEWS.Rd
ed08b21563636e18b1fae61892e14f35 *man/ciw-package.Rd
4c3310c19014ddaa1c21f0a9fb838351 *man/incoming.Rd
8bc874a5174a16834c66bb408fbd813c *tests/simpleTests.R
1ec49d271cb8bf7628a1ccec54e8b84a *tests/simpleTests.Rout.save
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export(ciw)
export(incoming)
import(data.table)
importFrom(XML,readHTMLTable)
Expand Down
34 changes: 24 additions & 10 deletions R/incoming.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#' Report on the incoming queue at CRAN
#'
#' Summarizes the current state of the incoming queue at CRAN
#' Summarizes the current state of the incoming queue at CRAN. A shorter alias is provided by
#' function \code{ciw}.
#'
#' @param folder A character variable correponding to one (or more) of the existing directories
#' at the \code{incoming} directory at CRAN, or a meta value. The default value is \sQuote{auto}
#' to designate the combination of \sQuote{pending}, \sQuote{recheck}, \sQuote{inspect} and
#' \sQuote{pretest}
#' \sQuote{pretest}. See also below for \code{known_folders}.
#' @param check A logical variable with a default of \sQuote{TRUE} indicating that the value
#' of \sQuote{folder} should be check against a list of known values. Using \sQuote{FALSE}
#' allows new values, or different combinations not supported by default.
Expand All @@ -17,9 +18,7 @@
#' for package name, upload time and size.
#' @examples
#' incoming()
incoming <- function(folder=c("auto", "archive", "inspect", "newbies", "pending", "pretest", "publish",
"recheck", "waiting", "BA", "KH", "KL", "UL", "VW"),
check = TRUE, sort = TRUE, ping = TRUE) {
incoming <- function(folder=c("auto", known_folders), check = TRUE, sort = TRUE, ping = TRUE) {
if (check) {
folder <- match.arg(folder)
if (folder == "auto") folder <- c("pending", "recheck", "inspect", "pretest", "waiting")
Expand All @@ -43,7 +42,7 @@ incoming <- function(folder=c("auto", "archive", "inspect", "newbies", "pending"
## use curl for parallel reads which requires a 'global' list object and callbacks
results <- list()
.success <- function(x) results <<- append(results, list(x))
.failure <- function(str) cat(paste("Failed request for", str), file = stderr())
.failure <- function(str) cat(paste("Failed request: ", str, "\n"), file = stderr())
for (fldr in folder) {
curl::multi_add(curl::new_handle(url = file.path(url, fldr)),
done = .success,
Expand All @@ -56,8 +55,13 @@ incoming <- function(folder=c("auto", "archive", "inspect", "newbies", "pending"

.transform_one_folder <- function(obj) { # worker function to transform obj returned by curl
folder <- basename(obj[["url"]]) # url is the actual URL called, we recover folder from it
txt <- rawToChar(obj[["content"]]) # content is the payload, by curl convention raw bytes
tab <- XML::readHTMLTable(txt)[[1]] # extract the per-folder directory listing table
if (obj[["status_code"]] == 200) {
txt <- rawToChar(obj[["content"]]) # content is the payload, by curl convention raw bytes
tab <- XML::readHTMLTable(txt)[[1]] # extract the per-folder directory listing table
} else {
tab <- data.table(V1=character(), Name=character(), Description=character(),
`Last modified`=as.POSIXct(double()), Size=character())
}
dir <- data.table::data.table(Folder=folder, tab) # and now some data.table munging
data.table::setnames(dir, "Last modified", "Time")
dir <- dir[is.na(Name) == FALSE & Name != "Parent Directory", ]
Expand All @@ -70,10 +74,20 @@ incoming <- function(folder=c("auto", "archive", "inspect", "newbies", "pending"
}

res <- rbindlist(lapply(results, .transform_one_folder))
if (sort) res <- res[order(Age)]
if (sort && nrow(res) > 0) res <- res[order(Age)]

res
}

utils::globalVariables(c("Name", "Time", "Age"))
#' @rdname incoming
ciw <- incoming

#' @rdname incoming
#' @format \code{known_folders} is an unexported global state variable with a simple vector of
#' the (currently) known directory names \dQuote{archive}, \dQuote{inspect}, \dQuote{newbies},
#' \dQuote{pending}, \dQuote{pretest}, \dQuote{publish}, \dQuote{recheck}, \dQuote{waiting},
#' \dQuote{BA}, \dQuote{KH}, \dQuote{KL}, \dQuote{UL}, and \dQuote{VW}.
known_folders <- c("archive", "inspect", "newbies", "pending", "pretest", "publish",
"recheck", "waiting", "BA", "KH", "KL", "UL", "VW")

utils::globalVariables(c("Name", "Time", "Age"))
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

## ciw -- CRAN Incoming Watcher

[![CI](https://github.com/eddelbuettel/ciw/actions/workflows/ci.yaml/badge.svg)](https://github.com/eddelbuettel/ciw/actions/workflows/ci.yaml)
[![License](https://eddelbuettel.github.io/badges/GPL2+.svg)](https://www.gnu.org/licenses/gpl-2.0.html)
[![CRAN](https://www.r-pkg.org/badges/version/ciw)](https://cran.r-project.org/package=ciw)
[![r-universe](https://eddelbuettel.r-universe.dev/badges/ciw)](https://eddelbuettel.r-universe.dev/ciw)
[![Dependencies](https://tinyverse.netlify.com/badge/ciw)](https://cran.r-project.org/package=ciw)
[![Last Commit](https://img.shields.io/github/last-commit/eddelbuettel/ciw)](https://github.com/eddelbuettel/ciw)

### Example
Expand All @@ -24,12 +27,8 @@ and provides what is shown in the gif above.

### Installation

As the package is not (yet ?) on [CRAN][cran], you have to install it from this repository.

The [littler][littler] script
[`installGithub.r`](https://github.com/eddelbuettel/littler/blob/master/inst/examples/ciw.r))
(wrapping the corresponding function from [remotes][remotes] can help. Or you can just clone the
repo and install locally.
The package is on [CRAN][cran] and can be installed via a simple `install.packages("ciw")`.
Alternatively you can install it from here or from [r-universe][r-universe ciw].

To also run `ciw.r` you need to either install [littler][littler] or just fetch the script (and
maybe tweak it for `Rscript` use of [docopt][docopt]).
Expand All @@ -47,3 +46,4 @@ GPL (>= 2)
[littler]: https://cran.r-project.org/package=littler
[remotes]: https://cran.r-project.org/package=remotes
[docopt]: https://cran.r-project.org/package=docopt
[r-universe ciw]: https://eddelbuettel.r-universe.dev/ciw
Binary file modified build/partial.rdb
Binary file not shown.
20 changes: 20 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
\name{NEWS}
\title{News for Package \pkg{ciw}}
\newcommand{\ghpr}{\href{https://github.com/eddelbuettel/ciw/pull/#1}{##1}}
\newcommand{\ghit}{\href{https://github.com/eddelbuettel/ciw/issues/#1}{##1}}

\section{Changes in version 0.0.2 (2024-03-20)}{
\itemize{
\item The package README and DESCRIPTION have been expanded
\item An alias \code{ciw} can now be used for \code{incoming}
\item Network error handling is now more robist
\item A state variable \code{known_folders} lists all CRAN folders below
\code{incoming}
}
}

\section{Changes in version 0.0.1 (2024-03-12)}{
\itemize{
\item Initial version and CRAN release.
}
}
1 change: 0 additions & 1 deletion man/ciw-package.Rd
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
\name{ciw-package}
\alias{ciw-package}
\alias{ciw}
\docType{package}
\title{\packageTitle{ciw}}
\description{\packageDescription{ciw}}
Expand Down
23 changes: 18 additions & 5 deletions man/incoming.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3b4247a

Please sign in to comment.