Skip to content

Commit

Permalink
prep for cran
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherkenny committed Jun 11, 2024
1 parent 3a79b34 commit 88f7514
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 10 deletions.
20 changes: 14 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
Package: redistverse
Title: Easily Install and Load Redistricting Software
Version: 0.1.0.9000
Version: 0.1.0
Authors@R: c(
person("Christopher T.", "Kenny", email = "christopherkenny@fas.harvard.edu", role = c("aut", "cre")),
person("Cory", "McCartan", email = "cmccartan@g.harvard.edu", role = "aut"),
person(given = "Christopher T.",
family = "Kenny",
role = c("aut", "cre"),
email = "christopherkenny@fas.harvard.edu",
comment = c(ORCID = "0000-0002-9386-6860")),
person(given = "Cory", family = "McCartan", email = "mccartan@psu.edu",
role = "aut", comment = c(ORCID = "0000-0002-6251-669X")),
person("tidyverse contributors", role = "ctb", comment = "attach code adapted from tidyverse."))
Description: The 'redistverse' is a set of packages for redistricting
data downloading, spatial preprocessing, simulation, analysis, and
Expand All @@ -22,14 +27,17 @@ Imports:
easycensus,
PL94171,
alarmdata,
cli
cli,
birdie
Suggests:
wacolors,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
spelling
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
URL: https://github.com/alarm-redist/redistverse, https://alarm-redist.org/redistverse/
BugReports: https://github.com/alarm-redist/redistverse/issues
Config/testthat/edition: 3
Language: en-US
2 changes: 1 addition & 1 deletion R/attach.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# adopted from `tidyverse`

core_pkgs <- c("redist", "redistmetrics", "ggredist", "geomander", "sf")
xtra_pkgs <- c("PL94171", "tinytiger", "alarmdata", "censable", "easycensus")
xtra_pkgs <- c("PL94171", "tinytiger", "alarmdata", "censable", "easycensus", "birdie")
# geocoder? birdie?

core_unloaded <- function() {
Expand Down
48 changes: 48 additions & 0 deletions R/cache.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#" Summarize caches for `redistverse` packages
#"
#" @param packages character vector of package names. Default is `c("alarmdata", "tinytiger")`.
#"
#" @return a vector of paths to the cache directories for the specified packages
#" @export
#"
#" @examples
#" redistverse_cache_status()
redistverse_cache_status <- function(packages = c("alarmdata", "tinytiger")) {
if ("alarmdata" %in% packages) {
packages[packages == "alarmdata"] <- "alarm"
}

check_fns <- c(
tinytiger = tinytiger::tt_cache_path,
alarm = alarmdata::alarm_cache_path
)

use_cache <- logical(length(packages))
paths <- character(length(packages))
for (i in seq_along(packages)) {
use_cache[i] <- getOption(x = paste0(packages[i], ".use_cache"), default = FALSE)
if (use_cache[i] && !is.null(check_fns[[packages[i]]])) {
paths[i] <- check_fns[[packages[i]]]()
} else {
paths[i] <- getOption(paste0(packages[i], ".cache_dir"), default = NA_character_)
}
}

ul <- cli::cli_ul()
for (i in seq_along(packages)) {
if (is.na(paths[i])) {
if (isFALSE(use_cache[i])) {
cli::cli_li("{.pkg {packages[i]}}: cache is not enabled.")
} else {
cli::cli_li("{.pkg {packages[i]}}: cache enabled but not found.")
}
} else {
cli::cli_li("{.pkg {packages[i]}}: cache is {.path {paths[i]}}.")
}
}
cli::cli_end(ul)

names(paths) <- packages

invisible(paths)
}
1 change: 1 addition & 0 deletions R/redistverse-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ ignore_unused_imports <- function() {
redistmetrics::by_plan
sf::st_crs
tinytiger::tt_voting_districts
birdie::birdie
}
4 changes: 4 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ knitr::opts_chunk$set(
# redistverse <img src="man/figures/logo.png" align="right" height="208" />

<!-- badges: start -->
[![redistverse status
badge](https://alarm-redist.r-universe.dev/badges/redistverse)](https://alarm-redist.r-universe.dev/redistverse)
[![R-CMD-check](https://github.com/alarm-redist/redistverse/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/alarm-redist/redistverse/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

The `redistverse` is a set of packages for redistricting data downloading, spatial
Expand Down Expand Up @@ -53,3 +56,4 @@ Related packages are installed:
- [alarmdata](https://alarm-redist.org/alarmdata/)
- [easycensus](https://corymccartan.com/easycensus/)
- [censable](https://christophertkenny.com/censable/)
- [birdie](https://corymccartan.com/birdie/)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ Related packages are installed:
- [alarmdata](https://alarm-redist.org/alarmdata/)
- [easycensus](https://corymccartan.com/easycensus/)
- [censable](https://christophertkenny.com/censable/)
- [birdie](https://corymccartan.com/birdie/)
11 changes: 11 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CMD
ORCID
alarmdata
censable
easycensus
geomander
ggredist
redist
redistmetrics
tidyverse
tinytiger
6 changes: 3 additions & 3 deletions man/redistverse-package.Rd

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

3 changes: 3 additions & 0 deletions tests/spelling.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if(requireNamespace('spelling', quietly = TRUE))
spelling::spell_check_test(vignettes = TRUE, error = FALSE,
skip_on_cran = TRUE)

0 comments on commit 88f7514

Please sign in to comment.