Skip to main content

apply_update

Function apply_update 

Source
pub fn apply_update(target_dir: &Path) -> Result<ApplyResult, ApplyError>
Expand description

Apply rust-bucket to a target directory in update mode (subsequent runs).

This function implements the subsequent-times flow as specified in ARCHITECTURE.md:

  1. Assert Cargo.toml exists (this is a Rust crate)
  2. Assert .git/ exists (git init was done)
  3. Load rust-bucket.toml using Config::load()
  4. Validate config (log/warn if version is different)
  5. Pre-populate choices from config (test_timeout already set)
  6. Prompt for any NEW choices not in config (none in v1, so skip)
  7. Update config’s rust_bucket_version to current version
  8. Write updated rust-bucket.toml using config.save()
  9. Extract templates to temp dir using templates::extract_to_temp()
  10. Render templates to target dir using generator::render() with overwrite=true
  11. Run verification using verify::run_all()
  12. Return result

§Arguments

  • target_dir - The target directory to update rust-bucket files in

§Errors

Returns ApplyError if:

  • The target is not a Rust crate (no Cargo.toml)
  • The target is not a git repository (no .git/)
  • The rust-bucket.toml config file cannot be loaded
  • Any step in the process fails (config save, template extraction, rendering, verification)