Rename to bakare
This commit is contained in:
parent
025a5011c3
commit
8d9f605d67
3 changed files with 19 additions and 19 deletions
20
Cargo.lock
generated
20
Cargo.lock
generated
|
@ -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]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
|
@ -105,16 +115,6 @@ dependencies = [
|
||||||
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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]]
|
[[package]]
|
||||||
name = "rustc-serialize"
|
name = "rustc-serialize"
|
||||||
version = "0.3.24"
|
version = "0.3.24"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustback"
|
name = "bakare"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Cyryl Płotnicki <cyplo@cyplo.net>"]
|
authors = ["Cyryl Płotnicki <cyplo@cyplo.net>"]
|
||||||
|
|
||||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -27,13 +27,9 @@ impl<'a> BackupEngine<'a> {
|
||||||
fn backup(&self) -> Result<(), io::Error> {
|
fn backup(&self) -> Result<(), io::Error> {
|
||||||
let walker = WalkDir::new(self.source_path);
|
let walker = WalkDir::new(self.source_path);
|
||||||
for maybe_entry in walker {
|
for maybe_entry in walker {
|
||||||
match maybe_entry {
|
let entry = maybe_entry?;
|
||||||
Ok(entry) => {
|
if entry.path() != self.source_path {
|
||||||
if entry.path() != self.source_path {
|
self.process_entry(&entry)?;
|
||||||
self.process_entry(&entry)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(error) => return Err(error.into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -44,6 +40,7 @@ impl<'a> BackupEngine<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn process_entry(&self, entry: &DirEntry) -> Result<(), io::Error> {
|
fn process_entry(&self, entry: &DirEntry) -> Result<(), io::Error> {
|
||||||
|
|
||||||
if entry.file_type().is_dir() {
|
if entry.file_type().is_dir() {
|
||||||
fs::create_dir(self.repository_path.join(entry.file_name()))?;
|
fs::create_dir(self.repository_path.join(entry.file_name()))?;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +105,7 @@ impl<'a> RestoreEngine<'a> {
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
||||||
mod rustback {
|
mod bakare {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod should {
|
mod should {
|
||||||
|
@ -162,6 +159,9 @@ mod rustback {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: restore latest version by default
|
||||||
|
// TODO: deduplicate data
|
||||||
|
|
||||||
fn assert_target_file_contents(target: &Path, filename: &str, expected_contents: &str) -> Result<(), Error> {
|
fn assert_target_file_contents(target: &Path, filename: &str, expected_contents: &str) -> Result<(), Error> {
|
||||||
let restored_path = target.join(filename);
|
let restored_path = target.join(filename);
|
||||||
let mut actual_contents = String::new();
|
let mut actual_contents = String::new();
|
||||||
|
|
Loading…
Reference in a new issue