diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..54dd41d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,171 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [unreleased] + +### Bug Fixes + +- Prevent "invalid directive" warning ([#78](https://github.com/Shadow53/hoard/issues/78)) +- Fix operation version upgrades ([#129](https://github.com/Shadow53/hoard/issues/129)) + +### Dependency Upgrades + +- Update rust crate directories to 3.0.2 ([#81](https://github.com/Shadow53/hoard/issues/81)) +- Update rust crate structopt to 0.3.26 ([#82](https://github.com/Shadow53/hoard/issues/82)) +- Update actions/checkout action to v2 ([#90](https://github.com/Shadow53/hoard/issues/90)) +- Update rust crate thiserror to 1.0.30 ([#84](https://github.com/Shadow53/hoard/issues/84)) +- Update rust crate directories to v4 ([#91](https://github.com/Shadow53/hoard/issues/91)) +- Update rust crate which to 4.2 ([#89](https://github.com/Shadow53/hoard/issues/89)) +- Update rust crate petgraph to 0.6 ([#88](https://github.com/Shadow53/hoard/issues/88)) +- Update rust crate once_cell to 1.9 ([#87](https://github.com/Shadow53/hoard/issues/87)) +- Update rust crate tempfile to 3.3 ([#85](https://github.com/Shadow53/hoard/issues/85)) +- Update rust crate windows to 0.34 ([#108](https://github.com/Shadow53/hoard/issues/108)) +- Update rust crate once_cell to 1.10 ([#105](https://github.com/Shadow53/hoard/issues/105)) +- Update actions/checkout action to v3 ([#104](https://github.com/Shadow53/hoard/issues/104)) +- Update rust crate md-5 to 0.10 ([#86](https://github.com/Shadow53/hoard/issues/86)) +- Update codecov/codecov-action action to v3 ([#118](https://github.com/Shadow53/hoard/issues/118)) +- Update rust crate windows to 0.35 ([#117](https://github.com/Shadow53/hoard/issues/117)) +- Update rust crate toml to 0.5.9 ([#119](https://github.com/Shadow53/hoard/issues/119)) +- Update rust crate uuid to v1 ([#125](https://github.com/Shadow53/hoard/issues/125)) +- Update rust crate nix to 0.24 ([#126](https://github.com/Shadow53/hoard/issues/126)) +- Update rust crate tokio to 1.18 ([#131](https://github.com/Shadow53/hoard/issues/131)) +- Update rust crate windows to 0.36 ([#130](https://github.com/Shadow53/hoard/issues/130)) +- Update rust crate thiserror to 1.0.31 ([#132](https://github.com/Shadow53/hoard/issues/132)) + +### Features + +- Add edit command with tests ([#71](https://github.com/Shadow53/hoard/issues/71)) +- Add status and diff commands ([#76](https://github.com/Shadow53/hoard/issues/76)) +- Allow periods in names ([#115](https://github.com/Shadow53/hoard/issues/115)) +- Handle file permissions based on config ([#122](https://github.com/Shadow53/hoard/issues/122)) + +### Miscellaneous Tasks + +- Update deps +- Expand Makefile.toml +- Bump version to 0.5.0-beta +- Generate changelog with git-cliff + +### Other + +- Add license scan report and status ([#79](https://github.com/Shadow53/hoard/issues/79)) +- Configure Renovate ([#80](https://github.com/Shadow53/hoard/issues/80)) + +### Refactor + +- Make backup/restore use the files iterator ([#94](https://github.com/Shadow53/hoard/issues/94)) +- Refactor! introduce v2 operation logs ([#98](https://github.com/Shadow53/hoard/issues/98)) +- [**breaking**] Port Python tests to Rust ([#106](https://github.com/Shadow53/hoard/issues/106)) +- Introduce strong types enforcing invariants ([#109](https://github.com/Shadow53/hoard/issues/109)) +- Reuse operation logs for backup/restore ([#111](https://github.com/Shadow53/hoard/issues/111)) +- Replace structopt with clap v3 ([#112](https://github.com/Shadow53/hoard/issues/112)) +- Replace hoards_root with config_dir and data_dir ([#113](https://github.com/Shadow53/hoard/issues/113)) +- Clean up file diff iterator logic ([#120](https://github.com/Shadow53/hoard/issues/120)) +- [**breaking**] Optimize operations with multithreaded tokio ([#127](https://github.com/Shadow53/hoard/issues/127)) +- Log errors at creation site ([#133](https://github.com/Shadow53/hoard/issues/133)) + +### Testing + +- Fix running tests locally + +## [0.4.0] - 2021-12-27 + +### Bug Fixes + +- Expand env variables in path_exists for consistency ([#54](https://github.com/Shadow53/hoard/issues/54)) +- Create config dir for uuid if not exists + tests ([#64](https://github.com/Shadow53/hoard/issues/64)) + +### Documentation + +- Add Getting Started section ([#56](https://github.com/Shadow53/hoard/issues/56)) ([#61](https://github.com/Shadow53/hoard/issues/61)) + +### Features + +- Add YAML support ([#66](https://github.com/Shadow53/hoard/issues/66)) +- Impl list command, custom log output ([#68](https://github.com/Shadow53/hoard/issues/68)) + +### Miscellaneous Tasks + +- Update hoard version and deps + +### Other + +- Fix ignore file patterns ([#55](https://github.com/Shadow53/hoard/issues/55)) +- Missing parent error ([#57](https://github.com/Shadow53/hoard/issues/57)) +- Error on invalid "config" item ([#59](https://github.com/Shadow53/hoard/issues/59)) + +### Refactor + +- Parse glob patterns when reading config, not after ([#60](https://github.com/Shadow53/hoard/issues/60)) + +## [0.3.0] - 2021-10-08 + +### Documentation + +- Remove outdated note from README +- Add env var docs and make command for viewing ([#45](https://github.com/Shadow53/hoard/issues/45)) + +### Features + +- Add `game` subcommand +- Enable env vars in pile paths #22 ([#23](https://github.com/Shadow53/hoard/issues/23)) +- Add cleanup command with tests ([#37](https://github.com/Shadow53/hoard/issues/37)) ([#39](https://github.com/Shadow53/hoard/issues/39)) + +### Miscellaneous Tasks + +- Add metadata to Cargo.toml + +### Other + +- First commit +- Rename to save_hoarder +- Add license +- Update Cargo.lock, add license to Cargo.toml +- Add Config Subcommand ([#10](https://github.com/Shadow53/hoard/issues/10)) +- Add Builder type ([#12](https://github.com/Shadow53/hoard/issues/12)) +- Add GitHub Actions +- Flesh out fmt job +- Fix tarpaulin args +- Use grcov instead of tarpaulin +- Use manual grcov because action is old +- Switch to tarpaulin for coverage +- Revert "ci: switch to tarpaulin for coverage" +- Use grcov action w/out source coverage +- Remove unnecessary path-mapping grcov config +- Cache stable and nightly separately +- Merge pull request #7 from Shadow53/4-integration-tests +- Use custom envs, refactor ([#10](https://github.com/Shadow53/hoard/issues/10)) +- Implement Commands, minor fixes ([#11](https://github.com/Shadow53/hoard/issues/11)) +- Implement better logging ([#24](https://github.com/Shadow53/hoard/issues/24)) +- Prevent file footguns ([#29](https://github.com/Shadow53/hoard/issues/29)) +- Ignore paths ([#30](https://github.com/Shadow53/hoard/issues/30)) +- Merge pile config ([#32](https://github.com/Shadow53/hoard/issues/32)) +- Add mdBook Documentation ([#36](https://github.com/Shadow53/hoard/issues/36)) +- Attach release builds to GitHub release ([#38](https://github.com/Shadow53/hoard/issues/38)) +- Get code coverage from python test scripts too ([#41](https://github.com/Shadow53/hoard/issues/41)) +- Implement better test coverage ([#42](https://github.com/Shadow53/hoard/issues/42)) ([#43](https://github.com/Shadow53/hoard/issues/43)) +- Build/release action requires items must be archived + +### Refactor + +- Move subcommands to their own modules +- Use thiserror to impl all Error types +- More intuitively model program structure + +### Styling + +- Run cargo fmt +- Run cargo fmt +- Make clippy happy +- Run cargo fmt + +### Testing + +- Add unit tests where applicable +- Add remaining unit tests +- Add integration tests for config subcmd +- Add integration tests for game subcmd +- Add remaining integration tests + + diff --git a/Cargo.lock b/Cargo.lock index c62bacc..395ab86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -104,16 +104,16 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.1.8" +version = "3.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c" +checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" dependencies = [ "atty", "bitflags", "clap_derive", + "clap_lex", "indexmap", "lazy_static", - "os_str_bytes", "strsim", "termcolor", "terminal_size", @@ -122,9 +122,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.1.7" +version = "3.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1" +checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c" dependencies = [ "heck", "proc-macro-error", @@ -133,6 +133,15 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_lex" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "cpufeatures" version = "0.2.2" @@ -326,7 +335,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hoard" -version = "0.4.0" +version = "0.5.0" dependencies = [ "async-stream", "async-trait", @@ -431,9 +440,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.121" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" [[package]] name = "linked-hash-map" @@ -443,9 +452,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "log" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", ] @@ -488,9 +497,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" @@ -503,25 +512,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" +checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" dependencies = [ "libc", "log", - "miow", - "ntapi", "wasi 0.11.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", + "windows-sys", ] [[package]] @@ -549,15 +547,6 @@ dependencies = [ "memoffset", ] -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi", -] - [[package]] name = "num_cpus" version = "1.13.1" @@ -570,9 +559,9 @@ dependencies = [ [[package]] name = "num_threads" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aba1801fb138d8e85e11d0fc70baf4fe1cdfffda7c6cd34a854905df588e5ed0" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" dependencies = [ "libc", ] @@ -601,9 +590,6 @@ name = "os_str_bytes" version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] [[package]] name = "path-clean" @@ -629,9 +615,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -671,9 +657,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa" dependencies = [ "unicode-xid", ] @@ -690,9 +676,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] @@ -792,18 +778,18 @@ checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "serde" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ "proc-macro2", "quote", @@ -812,9 +798,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" dependencies = [ "itoa", "ryu", @@ -823,18 +809,18 @@ dependencies = [ [[package]] name = "serde_test" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21675ba6f9d97711cc00eee79d8dd7d0a31e571c350fb4d8a7c78f70c0e7b0e9" +checksum = "fe196827aea34242c314d2f0dd49ed00a129225e80dda71b0dbf65d54d25628d" dependencies = [ "serde", ] [[package]] name = "serde_yaml" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0" +checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc" dependencies = [ "indexmap", "ryu", @@ -897,9 +883,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.90" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f" +checksum = "04066589568b72ec65f42d65a1a52436e954b168773148893c020269563decf2" dependencies = [ "proc-macro2", "quote", @@ -1004,9 +990,9 @@ checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" [[package]] name = "tinyvec" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -1019,9 +1005,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.18.0" +version = "1.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f48b6d60512a392e34dbf7fd456249fd2de3c83669ab642e021903f4015185b" +checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395" dependencies = [ "bytes", "libc", @@ -1068,9 +1054,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.32" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" +checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" dependencies = [ "cfg-if", "pin-project-lite", @@ -1080,9 +1066,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" +checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" dependencies = [ "proc-macro2", "quote", @@ -1091,9 +1077,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90442985ee2f57c9e1b548ee72ae842f4a9a20e3f417cc38dbc5dc684d9bb4ee" +checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" dependencies = [ "lazy_static", "valuable", @@ -1101,9 +1087,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9df98b037d039d03400d9dd06b0f8ce05486b5f25e9a2d7d36196e142ebbc52" +checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596" dependencies = [ "ansi_term", "lazy_static", @@ -1124,9 +1110,9 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-normalization" @@ -1139,9 +1125,9 @@ dependencies = [ [[package]] name = "unicode-xid" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "url" @@ -1239,9 +1225,22 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.36.0" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e53b97a83176b369b0eb2fd8158d4ae215357d02df9d40c1e1bf1879c5482c80" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-sys" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36e5436ab30c3d1422272fc6f7b5e7d46e93c94bfca83be808404df9ea5bea76" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ "windows_aarch64_msvc", "windows_i686_gnu", @@ -1252,33 +1251,33 @@ dependencies = [ [[package]] name = "windows_aarch64_msvc" -version = "0.36.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bee8cd327bbef19bf86d30bd66379f57905166d3103b0e2eff4a491b85e421d" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_i686_gnu" -version = "0.36.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b759cc6e3d97970c98cffe461739e89ab6d424ba5e2e7d3b9b05a2d56116057" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_msvc" -version = "0.36.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a0cee91bff283876711f91e7db0aa234438bc663a9d8304596df00b0a6fd6ef" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_x86_64_gnu" -version = "0.36.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e8c6f778aa4383b033ff785191aea0f1ebeceedc160c2c92f944ef7e191476" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_msvc" -version = "0.36.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd6a8b0b1ea4331e4db47192729fce42ac8a110fd22bb3abac555d8d7700f29" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "yaml-rust" diff --git a/Cargo.toml b/Cargo.toml index d60ed3f..6009a6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hoard" -version = "0.4.0" +version = "0.5.0" authors = ["Michael Bryant "] edition = "2021" license = "BSD-3-Clause" diff --git a/Makefile.toml b/Makefile.toml index cb88e22..e5a0500 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -82,3 +82,18 @@ [tasks.book] command = "mdbook" args = ["serve", "./book"] + +[tasks.outdated] + command = "cargo" + args = ["outdated"] + +[tasks.deadlinks] + command = "cargo" + args = ["deadlinks"] + +[tasks.check-all] + dependencies = ["clippy", "check-format", "docs", "test-nextest", "deadlinks"] + +[tasks.changelog] + command = "git-cliff" + args = ["-o", "CHANGELOG.md"] diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 0000000..f04728c --- /dev/null +++ b/cliff.toml @@ -0,0 +1,67 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ +# Changelog\n +All notable changes to this project will be documented in this file.\n +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | upper_first }} + {% for commit in commits %} + - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | split(pat="\n") | first | upper_first }}\ + {% endfor %} +{% endfor %}\n +""" +# remove the leading and trailing whitespace from the template +trim = true +# changelog footer +footer = """ + +""" + +[git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = false +# regex for preprocessing the commit messages +commit_preprocessors = [ + { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/Shadow53/hoard/issues/${2}))"}, +] +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^feat", group = "Features"}, + { message = "^fix\\(deps\\)", group = "Dependency Upgrades" }, + { message = "^fix", group = "Bug Fixes"}, + { message = "^doc", group = "Documentation"}, + { message = "^perf", group = "Performance"}, + { message = "^refactor", group = "Refactor"}, + { message = "^style", group = "Styling"}, + { message = "^test", group = "Testing"}, + { message = "^chore\\(deps\\)", group = "Dependency Upgrades" }, + { message = "^chore\\(release\\): prepare for", skip = true}, + { message = "^chore", group = "Miscellaneous Tasks"}, + { body = ".*security", group = "Security"}, + { message = ".*", group = "Other", default_scope = "other" }, +] +# filter out the commits that are not matched by commit parsers +filter_commits = true +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" +# regex for skipping tags +skip_tags = "v0.1.0-beta.1" +# regex for ignoring tags +ignore_tags = "" +# sort the tags chronologically +date_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest" diff --git a/src/checkers/history/operation/mod.rs b/src/checkers/history/operation/mod.rs index d970b37..5cecfa2 100644 --- a/src/checkers/history/operation/mod.rs +++ b/src/checkers/history/operation/mod.rs @@ -1,4 +1,11 @@ -//! Types for recording metadata about a single backup or restore [`Operation`]. +//! Keeping track of all operations. +//! +//! The types in this module are used for logging all operations to disk. This information can be +//! used for debugging purposes, but is more directly used as a [`Checker`] +//! to help prevent synchronized changes from being overwritten. +//! +//! It does this by parsing synchronized logs from this and other systems to determine which system +//! was the last one to touch a file. use std::collections::{HashMap, HashSet}; use std::path::{Path, PathBuf}; diff --git a/src/checkers/history/operation/v1.rs b/src/checkers/history/operation/v1.rs index 33188d8..13573d9 100644 --- a/src/checkers/history/operation/v1.rs +++ b/src/checkers/history/operation/v1.rs @@ -1,11 +1,4 @@ -//! Keeping track of all operations. -//! -//! The types in this module are used for logging all operations to disk. This information can be -//! used for debugging purposes, but is more directly used as a [`Checker`] to help prevent -//! synchronized changes from being overwritten. -//! -//! It does this by parsing synchronized logs from this and other systems to determine which system -//! was the last one to touch a file. +//! The first operation log format, retained for backwards compatibility. use crate::checkers::history::operation::OperationFileInfo; use crate::checksum::{Checksum, MD5}; @@ -19,7 +12,7 @@ use time::OffsetDateTime; /// A single operation log. /// /// This keeps track of the timestamp of the operation (which may include multiple hoards), -/// all hoards involved in the operation (and the related [`HoardOperation`]), and a record +/// all hoards involved in the operation (and the related [`Hoard` operation](Hoard)), and a record /// of the latest operation log for each external system at the time of invocation. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[allow(clippy::module_name_repetitions)] diff --git a/src/checkers/history/operation/v2.rs b/src/checkers/history/operation/v2.rs index dcecf62..5fdfae2 100644 --- a/src/checkers/history/operation/v2.rs +++ b/src/checkers/history/operation/v2.rs @@ -1,11 +1,7 @@ -//! Keeping track of all operations. +//! The current version of the operation log format. //! -//! The types in this module are used for logging all operations to disk. This information can be -//! used for debugging purposes, but is more directly used as a [`Checker`] to help prevent -//! synchronized changes from being overwritten. -//! -//! It does this by parsing synchronized logs from this and other systems to determine which system -//! was the last one to touch a file. +//! This type should be interacted with using the top-level [`Operation`](super::Operation) +//! instead of being used directly. use std::collections::{HashMap, HashSet}; @@ -29,7 +25,7 @@ use super::{Error, ItemOperation}; /// A single operation log. /// /// This keeps track of the timestamp of the operation (which may include multiple hoards), -/// all hoards involved in the operation (and the related [`HoardOperation`]), and a record +/// all hoards involved in the operation (and the related hoard operation), and a record /// of the latest operation log for each external system at the time of invocation. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[allow(clippy::module_name_repetitions)] diff --git a/src/checkers/mod.rs b/src/checkers/mod.rs index d8c02e3..34bbba4 100644 --- a/src/checkers/mod.rs +++ b/src/checkers/mod.rs @@ -61,8 +61,9 @@ pub enum Error { Operation(#[from] OperationError), } +/// A wrapper type for running all implemented [`Checker`] types at once. #[derive(Debug, Clone, PartialEq)] -pub(crate) struct Checkers { +pub struct Checkers { last_paths: HashMap, operations: HashMap, } diff --git a/src/checksum/mod.rs b/src/checksum/mod.rs index b04adcf..8c870b3 100644 --- a/src/checksum/mod.rs +++ b/src/checksum/mod.rs @@ -25,7 +25,8 @@ impl Default for ChecksumType { /// A file's checksum as a human-readable string. /// /// If you have a choice of which variant to construct, -/// prefer using [`HoardItem::system_checksum`] or [`HoardItem::hoard_checksum`] with the +/// prefer using [`HoardItem::system_checksum`](crate::hoard_item::HoardItem::system_checksum) +/// or [`HoardItem::hoard_checksum`](crate::hoard_item::HoardItem::system_checksum) with the /// return value of [`ChecksumType::default()`] /// /// # TODO diff --git a/src/config/builder/hoard.rs b/src/config/builder/hoard.rs index e24260f..11bc25d 100644 --- a/src/config/builder/hoard.rs +++ b/src/config/builder/hoard.rs @@ -22,8 +22,8 @@ type ConfigMultiple = crate::config::hoard::MultipleEntries; type ConfigSingle = crate::config::hoard::Pile; type ConfigHoard = crate::config::hoard::Hoard; -/// Errors that may occur while processing a [`Builder`](super::Builder) [`Hoard`] into a [`Config`] -/// [`Hoard`](crate::config::hoard::Hoard). +/// Errors that may occur while processing a [`Builder`](super::Builder) [`Hoard`] into and +/// [`Config`](crate::config::Config) [`Hoard`](crate::hoard::Hoard). #[derive(Debug, Error)] pub enum Error { /// Error while evaluating a [`Pile`]'s [`EnvTrie`]. @@ -44,7 +44,7 @@ pub struct Pile { pub config: Option, /// Mapping of environment strings to a string path that may contain environment variables. /// - /// See [`expand_env_in_path`] for more on path format. + /// See [`PathWithEnv`] for more on path format. #[serde(flatten)] pub items: BTreeMap, } diff --git a/src/env_vars.rs b/src/env_vars.rs index a488473..93cd2f6 100644 --- a/src/env_vars.rs +++ b/src/env_vars.rs @@ -1,6 +1,4 @@ //! Expand environment variables inside of a path. -//! -//! The only function exported from this module is [`expand_env_in_path`]. use crate::paths::{Error as PathError, SystemPath}; use once_cell::sync::Lazy; @@ -31,7 +29,7 @@ pub enum Error { /// The variable that caused the error. var: String, }, - /// The error returned while creating a [`SystemPath`] using [`expand_env_in_path`]. + /// The error returned while creating a [`SystemPath`] using [`PathWithEnv`]. Path(PathError), } diff --git a/src/hoard/iter/all_files.rs b/src/hoard/iter/all_files.rs index 9376fb4..034c409 100644 --- a/src/hoard/iter/all_files.rs +++ b/src/hoard/iter/all_files.rs @@ -402,11 +402,11 @@ impl AllFilesIter { } } -/// A [`Stream`] of all managed files under the given [`Hoard`]. +/// A [`TryStream`] of all managed files under the given [`Hoard`]. /// /// # Errors /// -/// Any errors that may occur while building the stream. See [`Error`](super::Error) for more. +/// Any errors that may occur while building the stream. See [`Error`](enum@super::Error) for more. #[allow(clippy::module_name_repetitions)] #[tracing::instrument] pub async fn all_files_stream( diff --git a/src/hoard/mod.rs b/src/hoard/mod.rs index 8c07e84..a1ce85c 100644 --- a/src/hoard/mod.rs +++ b/src/hoard/mod.rs @@ -16,7 +16,7 @@ use crate::newtypes::{NonEmptyPileName, PileName}; use crate::paths::{HoardPath, RelativePath, SystemPath}; pub mod iter; -pub(crate) mod pile_config; +pub mod pile_config; /// Errors that can happen while backing up or restoring a hoard. #[derive(Debug, Error)] diff --git a/src/hoard/pile_config.rs b/src/hoard/pile_config.rs index 2f414c3..2186d49 100644 --- a/src/hoard/pile_config.rs +++ b/src/hoard/pile_config.rs @@ -1,3 +1,5 @@ +//! Helper types representing a pile's configuration. + use std::fs::Permissions as StdPermissions; #[cfg(unix)] use std::os::unix::fs::PermissionsExt; @@ -10,7 +12,7 @@ use tokio::{fs, io}; use crate::checksum::ChecksumType; -/// Configuration for symmetric (password) encryption. +/// Configuration for symmetric (password) encryption. (Not yet implemented) #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum SymmetricEncryption { /// Raw password. @@ -21,14 +23,15 @@ pub enum SymmetricEncryption { PasswordCmd(Vec), } -/// Configuration for asymmetric (public key) encryption. +/// Configuration for asymmetric (public key) encryption. (Not yet implemented) #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AsymmetricEncryption { + /// The public key to encrypt with. #[serde(rename = "public_key")] - pub(crate) public_key: String, + pub public_key: String, } -/// Configuration for hoard/pile encryption. +/// Configuration for hoard/pile encryption. (Not yet implemented) #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] pub enum Encryption { @@ -41,17 +44,29 @@ pub enum Encryption { /// Configurable permissions for files and folders. /// /// Can be declared as a unix `chmod(1)` style mode or as a set of boolean flags. +/// +/// Note that, on Windows, only setting whether the owner can write to the file/folder is supported. #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged, rename_all = "snake_case")] pub enum Permissions { + /// A unix-style mode, e.g. `0o777` means "accessible to all". Mode(u32), + /// Explicit permissions as boolean flags. #[serde(rename = "permissions")] Manual { + /// If the file/folder can be executed by the owner. + /// + /// On non-Windows systems, a folder must be "executable" in order to list its contents. is_executable: bool, + /// If the file/folder can be read by the owner. is_readable: bool, + /// If the file/folder can be modified/deleted by the owner. is_writable: bool, + /// If other users can read the file/folder. others_can_read: bool, + /// If other users can write/delete the file/folder. others_can_write: bool, + /// If other users can "execute" the file/folder. #[serde(alias = "others_can_list")] others_can_execute: bool, }, @@ -69,6 +84,7 @@ impl Permissions { /// The default permissions for files. /// /// Currently, this is owner-only read/write permissions. + #[must_use] pub fn file_default() -> Self { Self::Mode(Self::OWNER_READ | Self::OWNER_WRITE) } @@ -77,10 +93,13 @@ impl Permissions { /// /// Currently, this is owner-only read/write/execute permissions /// (execute is necessary on unix-y systems to list the contents). + #[must_use] pub fn folder_default() -> Self { Self::Mode(Self::OWNER_READ | Self::OWNER_WRITE | Self::OWNER_EXE) } + /// Returns the [`Permissions`] as a unix-style mode number. + #[must_use] pub fn as_mode(self) -> u32 { match self { Self::Mode(mode) => mode, @@ -129,6 +148,8 @@ impl Permissions { } } + /// Returns whether the [`Permissions`] indicate that the target is read-only. + #[must_use] pub fn is_readonly(self) -> bool { match self { Self::Mode(mode) => (mode & Self::OWNER_WRITE) == 0, @@ -136,6 +157,8 @@ impl Permissions { } } + /// Modifies the provided permissions to set them equal to this [`Permissions`]. + #[must_use] pub fn set_permissions(self, mut perms: StdPermissions) -> StdPermissions { #[cfg(unix)] perms.set_mode(self.as_mode()); @@ -144,6 +167,12 @@ impl Permissions { perms } + /// Set this [`Permissions`] on whatever is at the given path. + /// + /// # Errors + /// + /// Any I/O errors that might occur while reading metadata and/or setting permissions, + /// including any "not found" errors. pub async fn set_on_path(self, path: &Path) -> io::Result<()> { let perms = fs::metadata(path) .await diff --git a/src/hoard_item/cached.rs b/src/hoard_item/cached.rs index 2d1b0cd..ce8e9a1 100644 --- a/src/hoard_item/cached.rs +++ b/src/hoard_item/cached.rs @@ -266,7 +266,7 @@ impl CachedHoardItem { /// error cases for [`std::fs::read`], including if `hoard_path` is a directory. /// /// If always calling this function with a constant or programmer-determined value, - /// consider using [`hoard_md5`] or [`hoard_sha256`] instead. + /// consider using [`CachedHoardItem::hoard_md5`] or [`CachedHoardItem::hoard_sha256`] instead. #[must_use] pub fn hoard_checksum(&self, typ: ChecksumType) -> Option { match typ { @@ -309,7 +309,7 @@ impl CachedHoardItem { /// error cases for [`std::fs::read`], including if `system_path` is a directory. /// /// If always calling this function with a constant or programmer-determined value, - /// consider using [`system_md5`] or [`system_sha256`] instead. + /// consider using [`CachedHoardItem::system_md5`] or [`CachedHoardItem::system_sha256`] instead. #[must_use] pub fn system_checksum(&self, typ: ChecksumType) -> Option { match typ { diff --git a/src/hoard_item/hoard_item.rs b/src/hoard_item/hoard_item.rs index d9b085b..921764c 100644 --- a/src/hoard_item/hoard_item.rs +++ b/src/hoard_item/hoard_item.rs @@ -174,7 +174,7 @@ impl HoardItem { /// error cases for [`std::fs::read`], including if `hoard_path` is a directory. /// /// If always calling this function with a constant or programmer-determined value, - /// consider using [`hoard_md5`] or [`hoard_sha256`] instead. + /// consider using [`HoardItem::hoard_md5`] or [`HoardItem::hoard_sha256`] instead. #[tracing::instrument(name = "hoard_item_hoard_checksum")] pub async fn hoard_checksum(&self, typ: ChecksumType) -> io::Result> { match typ { @@ -217,7 +217,7 @@ impl HoardItem { /// error cases for [`std::fs::read`], including if `system_path` is a directory. /// /// If always calling this function with a constant or programmer-determined value, - /// consider using [`system_md5`] or [`system_sha256`] instead. + /// consider using [`HoardItem::system_md5`] or [`HoardItem::system_sha256`] instead. #[tracing::instrument(name = "hoard_item_system_checksum")] pub async fn system_checksum(&self, typ: ChecksumType) -> io::Result> { match typ { diff --git a/src/newtypes/environment_name.rs b/src/newtypes/environment_name.rs index a8fb1d4..4434681 100644 --- a/src/newtypes/environment_name.rs +++ b/src/newtypes/environment_name.rs @@ -6,7 +6,7 @@ use super::{validate_name, Error}; /// Newtype wrapper for `String` representing an [environment](https://hoard.rs/config/envs.html). /// -/// See the [module documentation](self) for what makes an acceptable name. +/// See the [module documentation](super) for what makes an acceptable name. #[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize)] #[repr(transparent)] #[serde(transparent)] diff --git a/src/newtypes/hoard_name.rs b/src/newtypes/hoard_name.rs index 7237cb6..72222e6 100644 --- a/src/newtypes/hoard_name.rs +++ b/src/newtypes/hoard_name.rs @@ -6,7 +6,7 @@ use super::{validate_name, Error}; /// Newtype wrapper for `String` representing a hoard name. /// -/// See the [module documentation](self) for what makes an acceptable name. +/// See the [module documentation](super) for what makes an acceptable name. #[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize)] #[repr(transparent)] #[serde(transparent)] diff --git a/src/newtypes/non_empty_pile_name.rs b/src/newtypes/non_empty_pile_name.rs index cd56556..8cfb431 100644 --- a/src/newtypes/non_empty_pile_name.rs +++ b/src/newtypes/non_empty_pile_name.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use super::{validate_name, Error}; -/// Like [`PileName`], but not allowed to be empty ("anonymous") +/// Like [`PileName`](super::PileName), but not allowed to be empty ("anonymous") #[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] #[repr(transparent)] #[serde(try_from = "String")] diff --git a/src/newtypes/pile_name.rs b/src/newtypes/pile_name.rs index c3f20a1..4a408a8 100644 --- a/src/newtypes/pile_name.rs +++ b/src/newtypes/pile_name.rs @@ -10,7 +10,7 @@ use super::{Error, NonEmptyPileName}; /// - `None` indicates an anonymous (unnamed) pile. /// - `Some(name)` indicates a named pile with name `name`. /// -/// See the [module documentation](self) for what makes an acceptable name. +/// See the [module documentation](super) for what makes an acceptable name. #[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize)] #[repr(transparent)] #[serde(transparent)] diff --git a/src/paths.rs b/src/paths.rs index aeb3971..8bbfe35 100644 --- a/src/paths.rs +++ b/src/paths.rs @@ -86,7 +86,7 @@ fn is_valid_absolute(path: &Path) -> bool { pub enum Error { /// The path provided to [`HoardPath::try_from()`] was invalid. /// - /// The path is invalid if it is not the hoards root (see [`hoard_dir`]) or a child of it. + /// The path is invalid if it is not the hoards root (see [`hoards_dir`]) or a child of it. #[error("invalid HoardPath: {0:?}")] InvalidHoardPath(PathBuf), /// The path provided to [`SystemPath::try_from()`] was invalid.