Rename to bakare

This commit is contained in:
Cyryl Płotnicki 2018-10-04 15:21:34 +01:00
parent 025a5011c3
commit 8d9f605d67
3 changed files with 19 additions and 19 deletions

20
Cargo.lock generated
View file

@ -1,3 +1,13 @@
[[package]]
name = "bakare"
version = "0.1.0"
dependencies = [
"dir-diff 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
version = "1.0.4"
@ -105,16 +115,6 @@ dependencies = [
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustback"
version = "0.1.0"
dependencies = [
"dir-diff 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-serialize"
version = "0.3.24"

View file

@ -1,5 +1,5 @@
[package]
name = "rustback"
name = "bakare"
version = "0.1.0"
authors = ["Cyryl Płotnicki <cyplo@cyplo.net>"]

View file

@ -27,13 +27,9 @@ impl<'a> BackupEngine<'a> {
fn backup(&self) -> Result<(), io::Error> {
let walker = WalkDir::new(self.source_path);
for maybe_entry in walker {
match maybe_entry {
Ok(entry) => {
if entry.path() != self.source_path {
self.process_entry(&entry)?;
}
}
Err(error) => return Err(error.into()),
let entry = maybe_entry?;
if entry.path() != self.source_path {
self.process_entry(&entry)?;
}
}
Ok(())
@ -44,6 +40,7 @@ impl<'a> BackupEngine<'a> {
}
fn process_entry(&self, entry: &DirEntry) -> Result<(), io::Error> {
if entry.file_type().is_dir() {
fs::create_dir(self.repository_path.join(entry.file_name()))?;
}
@ -108,7 +105,7 @@ impl<'a> RestoreEngine<'a> {
fn main() {}
mod rustback {
mod bakare {
#[cfg(test)]
mod should {
@ -162,6 +159,9 @@ mod rustback {
Ok(())
}
// TODO: restore latest version by default
// TODO: deduplicate data
fn assert_target_file_contents(target: &Path, filename: &str, expected_contents: &str) -> Result<(), Error> {
let restored_path = target.join(filename);
let mut actual_contents = String::new();