Skip to content

Commit 79e3d71

Browse files
committed
Add Claude init, ignored by Rbuildignore.
1 parent c921681 commit 79e3d71

3 files changed

Lines changed: 51 additions & 12 deletions

File tree

.Rbuildignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
^LICENSE\.md$
2-
^CLAUDE\.md$
32
Makefile
43
^_pkgdown\.yml$
54
^\.github$
5+
^\.claude$
66
^docs$

.claude/CLAUDE.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Overview
6+
7+
`versioning` is an **R package** that parses YAML config files to simplify versioned data pipeline management. It provides a `Config` R6 class for accessing config values and dispatching file reads/writes based on extension.
8+
9+
## Common Commands
10+
11+
```bash
12+
make build # Build the package tarball
13+
make install # Build and install locally
14+
make build-docs # Regenerate man pages from roxygen2 comments (devtools::document())
15+
make check # Run CRAN check (devtools::check(cran = TRUE))
16+
```
17+
18+
Run tests (in an R session):
19+
```r
20+
devtools::test() # All tests
21+
testthat::test_file("tests/testthat/test-example_config.R") # Single file
22+
```
23+
24+
## Documentation
25+
26+
Docs are built with **pkgdown** and auto-deployed to GitHub Pages on push to `main` via `.github/workflows/pkgdown.yml`.
27+
28+
- When adding a new exported function or class, add a `@export` roxygen tag and run `make build-docs` to regenerate `NAMESPACE` and `man/` files.
29+
- The pkgdown reference page layout is configured in `_pkgdown.yml` — update it when adding new public symbols.
30+
- Package version is in `DESCRIPTION`; update it when releasing.
31+
32+
## Architecture
33+
34+
### Core Components
35+
36+
**[R/Config.R](R/Config.R)** — The main `Config` R6 class. Loaded from a YAML file with two special top-level keys:
37+
- `directories`: named list of directory definitions, each with `path`, optional `versioned: true`, and a `files` map of logical names to filenames.
38+
- `versions`: current version strings for each versioned directory.
39+
40+
Key methods: `$get(...)` for arbitrary config values, `$get_dir_path(dir)` for resolving directory paths (inserting version if versioned), `$get_file_path(dir, file)` for full file paths, `$read(dir, file)` and `$write(x, dir, file)` for dispatched I/O.
41+
42+
**[R/autoread.R](R/autoread.R) / [R/autowrite.R](R/autowrite.R)** — Dispatcher functions that route file I/O to the appropriate reader/writer based on file extension. `get_file_reading_functions()` and `get_file_writing_functions()` return the extension→function maps. Supported formats: csv, rds, rda, yaml, txt, shp, tif, xls/xlsx, dta, dbf, and additional sf/terra spatial drivers.
43+
44+
**[R/utilities.R](R/utilities.R)**`pull_from_list(x, ..., fail_if_null)` for safe nested list indexing with informative errors.
45+
46+
**[R/misc.R](R/misc.R)** — Internal helpers: `qstop()` (stop without call context), `require_namespace_or_stop(pkg)` (lazy-load optional packages).
47+
48+
### Dependency Strategy
49+
50+
Core imports: `R6`, `assertthat`, `glue`, `yaml`. Heavy optional packages (`data.table`, `sf`, `terra`, `readxl`, `haven`, `foreign`) are listed under `Suggests:` and loaded lazily via `require_namespace_or_stop()` only when the relevant file format is used.

CLAUDE.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)