refactor: Remove branch specification from sal dependency

- Removed the branch specification from the `sal` dependency in
  `doctree/Cargo.toml` and `webbuilder/Cargo.toml`. This simplifies
  the dependency management and relies on the default branch of the
  repository.
- Updated `.gitignore` to ignore `sccache.log` to prevent it from
  being committed to the repository.
- Updated example commands in `example_commands.sh` to use a different
  collection name (`grid1` instead of `grid_documentation`) for testing
  purposes.  This avoids potential conflicts with pre-existing data.
- Improved code structure and organization in `doctree/src/lib.rs`.
This commit is contained in:
Mahmoud Emad 2025-05-14 08:42:53 +03:00
parent d8d6bf1f4a
commit cad8a6d125
5 changed files with 14 additions and 17 deletions

1
.gitignore vendored
View File

@ -62,3 +62,4 @@ docusaurus.config.ts
sidebars.ts sidebars.ts
tsconfig.json tsconfig.json
sccache.log

View File

@ -15,7 +15,7 @@ toml = "0.7.3"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
redis = { version = "0.23.0", features = ["tokio-comp"] } redis = { version = "0.23.0", features = ["tokio-comp"] }
tokio = { version = "1.28.0", features = ["full"] } tokio = { version = "1.28.0", features = ["full"] }
sal = { git = "https://git.ourworld.tf/herocode/sal.git", branch = "main" } sal = { git = "https://git.ourworld.tf/herocode/sal.git" }
chacha20poly1305 = "0.10.1" chacha20poly1305 = "0.10.1"
blake3 = "1.3.1" blake3 = "1.3.1"
csv = "1.1" csv = "1.1"

View File

@ -5,33 +5,29 @@
// Import lazy_static for global state // Import lazy_static for global state
mod error;
mod storage;
mod utils;
mod collection; mod collection;
mod doctree; mod doctree;
mod error;
mod include; mod include;
mod storage;
mod utils;
pub use error::{DocTreeError, Result};
pub use storage::RedisStorage;
pub use collection::{Collection, CollectionBuilder}; pub use collection::{Collection, CollectionBuilder};
pub use doctree::{DocTree, DocTreeBuilder, new, from_directory}; pub use doctree::{DocTree, DocTreeBuilder, from_directory, new};
pub use error::{DocTreeError, Result};
pub use include::process_includes; pub use include::process_includes;
pub use storage::RedisStorage;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
#[test] #[test]
fn test_doctree_builder() { fn test_doctree_builder() {
// Create a storage instance // Create a storage instance
let storage = RedisStorage::new("dummy_url").unwrap(); let storage = RedisStorage::new("redis://localhost:6379").unwrap();
let doctree = DocTree::builder() let doctree = DocTree::builder().with_storage(storage).build().unwrap();
.with_storage(storage)
.build()
.unwrap();
assert_eq!(doctree.collections.len(), 0); assert_eq!(doctree.collections.len(), 0);
assert_eq!(doctree.default_collection, None); assert_eq!(doctree.default_collection, None);

View File

@ -13,13 +13,13 @@ echo -e "\n=== Listing Collections ==="
cargo run -- list cargo run -- list
echo -e "\n=== Getting Document (Markdown) ===" echo -e "\n=== Getting Document (Markdown) ==="
cargo run -- get -c grid_documentation -p introduction.md cargo run -- get -c grid1 -p introduction.md
echo -e "\n=== Getting Document (HTML) ===" echo -e "\n=== Getting Document (HTML) ==="
cargo run -- get -c grid_documentation -p introduction.md -f html cargo run -- get -c grid1 -p introduction.md -f html
echo -e "\n=== Deleting Collection ===" echo -e "\n=== Deleting Collection ==="
cargo run -- delete grid_documentation cargo run -- delete grid1
echo -e "\n=== Listing Remaining Collections ===" echo -e "\n=== Listing Remaining Collections ==="
cargo run -- list cargo run -- list

View File

@ -15,7 +15,7 @@ toml = "0.7.3"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
redis = { version = "0.23.0", features = ["tokio-comp"] } redis = { version = "0.23.0", features = ["tokio-comp"] }
tokio = { version = "1.28.0", features = ["full"] } tokio = { version = "1.28.0", features = ["full"] }
sal = { git = "https://git.ourworld.tf/herocode/sal.git", branch = "main" } sal = { git = "https://git.ourworld.tf/herocode/sal.git" }
chacha20poly1305 = "0.10.1" chacha20poly1305 = "0.10.1"
blake3 = "1.3.1" blake3 = "1.3.1"
csv = "1.1" csv = "1.1"