From 7b220084cf3951c8cde0582efdfcf628afc64336 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Tue, 28 Jul 2026 12:50:31 +0200 Subject: refactor: remove the niedziela/missalemeum scrapers, bt, traditional_lang The daily view now computes entirely offline (previous commit), so retire the network path and everything that served it: - Delete internal/tradlit (missalemeum) and the niedziela scraper from internal/liturgy (fetch/store/parse + fixtures); keep Section, DayInfo and ExtractCitation. - Remove the "bt" version everywhere (render gatherBT + branches, config, i18n, web form, TUI) and bible.ToEnglishRef (Polish citation converter). A legacy config carrying "bt" migrates to "wuj" on load (config.migrateBT). - Remove the traditional_lang config field and the -g/--lang flag from all three binaries. - Drop the now-dead flags -R/--refresh, -o/--offline, -u/--update, -C/--clean and the harvest/clean commands. - New defaults: versions = wuj,vul,grb,drb; default_version = vul. Update the README (offline-by-design, no harvest/update), help text, and stale niedziela/bt doc comments. Tests updated for the offline reality; go test ./... and go vet ./... are clean, all three binaries build and run offline (OF + EF, compare, web). --- internal/config/config_test.go | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'internal/config/config_test.go') diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 3830cb6..14823b8 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -13,9 +13,20 @@ func TestLoadSeeds(t *testing.T) { if err != nil { t.Fatal(err) } - if cfg.DefaultVersion != "bt" || cfg.Offline { + if cfg.DefaultVersion != "vul" || cfg.Offline { t.Errorf("defaults wrong: %+v", cfg) } + wantVersions := []string{"wuj", "vul", "grb", "drb"} + if len(cfg.Versions) != len(wantVersions) { + t.Errorf("versions default = %v, want %v", cfg.Versions, wantVersions) + } else { + for i, v := range wantVersions { + if cfg.Versions[i] != v { + t.Errorf("versions default = %v, want %v", cfg.Versions, wantVersions) + break + } + } + } if cfg.Lectionary != "new" { t.Errorf("lectionary default wrong: %+v", cfg) } @@ -24,6 +35,32 @@ func TestLoadSeeds(t *testing.T) { } } +// TestLoadMigratesBT checks a legacy config still carrying the retired "bt" +// version (both as default_version and in the versions list) loads and is +// migrated to wuj: bt is dropped from the list when wuj is already present +// (no duplicate column) and default_version bt becomes wuj. +func TestLoadMigratesBT(t *testing.T) { + dir := t.TempDir() + t.Setenv("LECTIO_CONFIG", filepath.Join(dir, "config.ini")) + os.WriteFile(filepath.Join(dir, "config.ini"), + []byte("default_version = bt\nversions = bt, wuj, vul\n"), 0o644) + cfg, err := Load() + if err != nil { + t.Fatal(err) + } + if cfg.DefaultVersion != "wuj" { + t.Errorf("default_version bt not migrated: %q", cfg.DefaultVersion) + } + for _, v := range cfg.Versions { + if v == "bt" { + t.Errorf("versions still carries bt: %v", cfg.Versions) + } + } + if len(cfg.Versions) != 2 || cfg.Versions[0] != "wuj" || cfg.Versions[1] != "vul" { + t.Errorf("versions after migration = %v, want [wuj vul]", cfg.Versions) + } +} + func TestLoadOverride(t *testing.T) { dir := t.TempDir() t.Setenv("XDG_CONFIG_HOME", dir) -- cgit v1.3