forked from wlkns-dev/stimmwerk
Arch-Paket (pacman) mit Beispielen; App findet mitgelieferte Charts; Release-Workflow
- App: Installationsordner /usr/share/singtrainer (überschreibbar mit SINGTRAINER_SHARE_DIR) als zusätzlicher Chart-Ordner; fehlt der Standard-Chart (charts/test.toml), startet der mitgelieferte Beispielsong; gleiche Titel erscheinen nur einmal - packaging/arch: PKGBUILD (aus dem Checkout), Starter-Datei; Paket enthält Programm, Starter, Beispiele, Lizenz, Doku - .gitea/workflows/release.yml: baut das Paket in einem Arch-Container auf dem Runner (Trockenlauf bei Pull-Anfragen, Release mit angehängtem Paket bei Tags v*) - README: Install mit Paket; .gitignore: makepkg-Ausgaben - Tests: Startchart-Rückfall, Chart-Liste ohne Doppelte Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -87,6 +87,9 @@ pub fn list_charts(dirs: &[std::path::PathBuf]) -> Vec<ChartEntry> {
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
// Gleicher Titel in mehreren Ordnern (z. B. Entwicklungsordner und Installation): die frühere Fundstelle gewinnt.
|
||||
let mut seen = std::collections::HashSet::new();
|
||||
out.retain(|e| seen.insert(e.title.to_lowercase()));
|
||||
out.sort_by_key(|e| e.title.to_lowercase());
|
||||
out
|
||||
}
|
||||
@ -1215,6 +1218,7 @@ impl App {
|
||||
self.charts = list_charts(&[
|
||||
std::path::PathBuf::from("charts"),
|
||||
Config::data_dir().join("charts"),
|
||||
Config::share_dir().join("charts"),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -2324,6 +2328,24 @@ mod tests {
|
||||
["Anton", "zebra Lied"]
|
||||
);
|
||||
assert!(list[0].path.ends_with("a.toml"));
|
||||
// Derselbe Titel in zwei Ordnern (Entwicklungsordner und Installation) erscheint nur einmal, die frühere
|
||||
// Fundstelle gewinnt.
|
||||
let other = dir.join("zweiter");
|
||||
std::fs::create_dir_all(&other).unwrap();
|
||||
std::fs::write(
|
||||
other.join("anton-kopie.toml"),
|
||||
format!("title=\"anton\"\n{note}"),
|
||||
)
|
||||
.unwrap();
|
||||
let twice = list_charts(&[dir.clone(), other.clone()]);
|
||||
assert_eq!(
|
||||
twice
|
||||
.iter()
|
||||
.filter(|e| e.title.eq_ignore_ascii_case("anton"))
|
||||
.count(),
|
||||
1
|
||||
);
|
||||
assert!(twice[0].path.ends_with("a.toml"), "{:?}", twice[0].path);
|
||||
// Die mitgelieferten Songs erscheinen in der Auswahl.
|
||||
let repo =
|
||||
list_charts(&[std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("charts")]);
|
||||
|
||||
@ -167,6 +167,9 @@ impl App {
|
||||
let mut config = Config::load();
|
||||
if let Some(p) = &chart_arg {
|
||||
config.session.chart_path = p.clone();
|
||||
} else {
|
||||
config.session.chart_path =
|
||||
crate::config::startup_chart(&config.session.chart_path, &Config::share_dir());
|
||||
}
|
||||
let chart_result = NoteChart::load(Path::new(&config.session.chart_path));
|
||||
let chart_error = chart_result.as_ref().err().map(|e| format!("{e:#}"));
|
||||
|
||||
Reference in New Issue
Block a user