You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: split asimov into a launcher, a library, and data files (AsimovMac#126)
The single 1645-line script becomes bin/asimov (launcher), lib/asimov/*.sh
(eleven modules, none over ~320 lines), and data/*.tsv (the directory lists).
Installed, the library and data live at <prefix>/libexec/asimov and
<prefix>/share/asimov. The launcher resolves its own physical path through
symlinks, as Homebrew creates, and probes for both that layout and the repo
layout, so ./bin/asimov works straight from a checkout. ASIMOV_LIB and
ASIMOV_DATA override the probe.
Sentinels, fixed directories and skip paths are now tab-separated records
carrying their ecosystem or owning tool as a real field, loaded into parallel
arrays (bash 3.2 has no associative arrays). sentinel_active_pairs() applies
the config disabled/extra lists once and is the single source of active pairs
for both find and Spotlight discovery, replacing the two copies of that
filtering that had drifted apart.
Behaviour is unchanged: all 219 existing tests pass untouched under bash 5 and
bash 3.2. Adds tests/data.bats (13 tests) covering the record schemas and the
loader, including a missing data file and a contributor-added sentinel.
Sources are listed one per line rather than looped so that
'shellcheck -x --source-path=. bin/asimov' checks the whole program as a single
unit; linting a module alone reports false unused-variable warnings.
Co-authored-by: django23 <827397+django23@users.noreply.github.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
8
8
9
9
### Added
10
10
11
+
-`asimov doctor` now checks the data files and reports how many sentinels and fixed directories are loaded, so an incomplete install is diagnosed rather than just failing.
12
+
11
13
### Changed
12
14
15
+
-**Asimov is no longer a single file.** The launcher lives at `bin/asimov`, the logic in `lib/asimov/*.sh`, and the directory lists in `data/*.tsv`. Installed, those become `<prefix>/bin/asimov`, `<prefix>/libexec/asimov/` and `<prefix>/share/asimov/`. Behaviour is unchanged; every existing test passes untouched.
16
+
- Sentinels, fixed directories and skip paths are now tab-separated data files instead of bash arrays. Each record carries its ecosystem or owning tool as a real field, so adding a pattern is a one-line edit with no bash syntax involved.
17
+
- The remote installer (`scripts/install-remote.sh`) downloads a tarball instead of a single script, and installs under `~/.local`.
18
+
- Release assets are now `asimov-<version>.tar.gz` rather than a bare `asimov` script.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+40-9Lines changed: 40 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,20 +58,22 @@ The main script supports `--help`, `--version`, `--dry-run`, `--verbose`, and `-
58
58
59
59
## Adding a new dependency pattern
60
60
61
-
This is the most common type of contribution. To add a new ecosystem or dependency directory:
61
+
This is the most common type of contribution, and it needs no bash: sentinels live in a data file.
62
62
63
-
1.**Add the sentinel pair** to the `ASIMOV_VENDOR_DIR_SENTINELS` array in [`asimov`](asimov) — one `'directory sentinel'` entry per pattern.
64
-
2.**Add a test** in [`tests/sentinels.bats`](tests/sentinels.bats) using `create_project` to build the fixture. Keep this file in sync with `ASIMOV_VENDOR_DIR_SENTINELS` (one test per sentinel pair).
63
+
1.**Add a row** to [`data/sentinels.tsv`](data/sentinels.tsv) — one per pattern, fields separated by a **tab**.
64
+
2.**Add a test** in [`tests/sentinels.bats`](tests/sentinels.bats) using `create_project` to build the fixture. Keep this file in sync with `data/sentinels.tsv` (one test per row).
65
65
3.**Run `make check`** to verify your changes pass tests and linting.
66
66
4.**Add a changelog entry** under the `[Unreleased]` section in [`CHANGELOG.md`](CHANGELOG.md).
This means: exclude `.zig-cache/` only when `build.zig` exists in the same directory.
74
+
This means: exclude `.zig-cache/` only when `build.zig` exists in the same directory. Glob metacharacters are allowed in the sentinel, e.g. `DerivedData *.xcodeproj`.
75
+
76
+
The same applies to global caches ([`data/fixed-dirs.tsv`](data/fixed-dirs.tsv)) and skipped directories ([`data/skip-paths.tsv`](data/skip-paths.tsv)). Paths in those two are **relative to the home directory** — write `.npm/_cacache`, not `~/.npm/_cacache`.
75
77
76
78
## Commit conventions
77
79
@@ -105,10 +107,28 @@ type(scope): short description
105
107
## Project structure
106
108
107
109
```
108
-
asimov # Main bash script
110
+
bin/asimov # Launcher: finds the library and data, then runs it
111
+
lib/asimov/
112
+
bootstrap.sh # Colours, constants, root and state-path resolution
113
+
config.sh # ~/.config/asimov/config
114
+
data.sh # Loaders for the data/ entities
115
+
cache.sh # ~/.cache/asimov state and the path cache
116
+
scan.sh # Which dirs to scan, and the find expression
117
+
discover.sh # Spotlight top-up on a cached run
118
+
exclude.sh # tmutil addexclusion, with its filters
119
+
report.sh # Usage, size formatting, run summary
120
+
prune.sh # The prune subcommand
121
+
doctor.sh # The doctor subcommand
122
+
main.sh # Argument parsing and dispatch
123
+
data/
124
+
sentinels.tsv # Directory + sentinel pairs
125
+
fixed-dirs.tsv # Global tool caches, always excluded
126
+
skip-paths.tsv # Directories never descended into
109
127
tests/
110
128
sentinels.bats # Tests for each dependency pattern
111
129
behavior.bats # Tests for edge cases and general behavior
130
+
cache.bats # Tests for the path cache
131
+
doctor.bats # Tests for the doctor subcommand
112
132
format.bats # Unit tests for format_size_kb()
113
133
plist.bats # Tests for the LaunchAgent plist
114
134
test_helper.bash # Shared setup/teardown and assertions
Installs `v0.10.0`to `~/.local/bin`. Found a bug? [Open an issue](https://github.com/AsimovMac/asimov/issues).
33
+
Installs to `~/.local` (`bin/asimov`, plus its library and data files under `libexec/` and `share/`). Found a bug? [Open an issue](https://github.com/AsimovMac/asimov/issues).
0 commit comments