refactor: reorganise flake, tests and repo tasks
This commit is contained in:
1 parent
b93147c7a6
commit
794ca5a086
34 files changed
+670
-220
No files matched your search
@@ -0,0 +1,30 @@
|
||||
use std::{
|
||||
fs::{self, Permissions},
|
||||
os::unix::fs::PermissionsExt,
|
||||
path::Path,
|
||||
};
|
||||
|
||||
use xshell::{Shell, cmd};
|
||||
|
||||
use crate::task_error::TaskError;
|
||||
|
||||
const TAPES: [&str; 2] = ["boot.tape", "shutdown.tape"];
|
||||
|
||||
pub fn record_screencasts(passphrase_png: &Path) -> Result<(), TaskError> {
|
||||
let recordings = Path::new("recordings");
|
||||
if !recordings.is_dir() {
|
||||
return Err(TaskError::NotInRepositoryRoot);
|
||||
}
|
||||
let shell = Shell::new()?;
|
||||
TAPES.iter().try_for_each(|tape| {
|
||||
let tape_path = recordings.join(tape);
|
||||
cmd!(shell, "vhs {tape_path}").run()
|
||||
})?;
|
||||
let copied_png = recordings.join("passphrase.png");
|
||||
fs::copy(passphrase_png, &copied_png)
|
||||
.and_then(|_| fs::set_permissions(&copied_png, Permissions::from_mode(0o644)))
|
||||
.map_err(|source| TaskError::File {
|
||||
path: copied_png,
|
||||
source,
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user