(home: &Path)
| 158 | std::sync::OnceLock::new(); |
| 159 | |
| 160 | fn install_hermes_default(home: &Path) { |
| 161 | let files = HERMES_DEFAULT_INSTALL_TEMPLATE.get_or_init(|| { |
| 162 | let template_home = TempDir::new().unwrap(); |
| 163 | HermesIntegration |
| 164 | .install(&make_install_ctx(template_home.path())) |
| 165 | .unwrap(); |
| 166 | let root = template_home.path().join(".hermes"); |
| 167 | let mut files = Vec::new(); |
| 168 | collect_files_recursive(&root, &root, &mut files); |
| 169 | assert!( |
| 170 | !files.is_empty(), |
| 171 | "hermes install template should contain generated files" |
| 172 | ); |
| 173 | files |
| 174 | }); |
| 175 | for (relative, contents) in files { |
| 176 | let path = home.join(".hermes").join(relative); |
| 177 | std::fs::create_dir_all(path.parent().unwrap()).unwrap(); |
| 178 | std::fs::write(path, contents).unwrap(); |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | fn collect_files_recursive(root: &Path, dir: &Path, out: &mut Vec<(std::path::PathBuf, Vec<u8>)>) { |
| 183 | for entry in std::fs::read_dir(dir).unwrap() { |
no test coverage detected