feat: package skeleton — DESCRIPTION, NAMESPACE, session/manifest/cache/views

Minimal skeleton for uscogdata v0.1. Internal session layer with lazy
cog_open(), manifest fetch+validate+cache, view registration placeholder.
Depends on DuckDB >=1.0, httr2, jsonlite. inst/schemas/provenance-v1.json
ships the structured provenance JSON Schema.
This commit is contained in:
2026-04-23 09:05:54 -04:00
commit f7035049e7
20 changed files with 305 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
library(testthat)
library(uscogdata)
test_check("uscogdata")
+6
View File
@@ -0,0 +1,6 @@
# tests/testthat/helper-fixture.R
skip_if_no_corpus <- function() {
testthat::skip_if(Sys.getenv("USCOGDATA_FIXTURE_URL", "") == "" &&
!file.exists("~/.cache/R/uscogdata/manifest.json"),
"No fixture corpus available")
}
+5
View File
@@ -0,0 +1,5 @@
# tests/testthat/setup.R
# Point tests at a fixture corpus URL if provided.
if (Sys.getenv("USCOGDATA_FIXTURE_URL", "") != "") {
options(uscogdata.url = Sys.getenv("USCOGDATA_FIXTURE_URL"))
}
+28
View File
@@ -0,0 +1,28 @@
test_that(".cfg resolves defaults, options, and env vars in priority order", {
withr::with_options(list(uscogdata.manifest_ttl_secs = NULL), {
withr::with_envvar(c(USCOGDATA_MANIFEST_TTL_SECS = NA), {
expect_equal(uscogdata:::.cfg("manifest_ttl_secs"), 3600L)
})
})
withr::with_options(list(uscogdata.url = "https://opt.example/"), {
withr::with_envvar(c(USCOGDATA_URL = NA), {
expect_equal(uscogdata:::.cfg("url"), "https://opt.example/")
})
})
withr::with_envvar(c(USCOGDATA_URL = "https://env.example/"), {
withr::with_options(list(uscogdata.url = "https://opt.example/"), {
expect_equal(uscogdata:::.cfg("url"), "https://env.example/")
})
})
})
test_that(".resolve_cache_dir falls back to R_user_dir", {
withr::with_envvar(c(USCOGDATA_CACHE_DIR = NA), {
withr::with_options(list(uscogdata.cache_dir = NULL), {
expect_equal(uscogdata:::.resolve_cache_dir(),
tools::R_user_dir("uscogdata", "cache"))
})
})
})