| Crates.io | tidepool-version-manager |
| lib.rs | tidepool-version-manager |
| version | 0.1.5 |
| created_at | 2025-06-28 09:49:13.309365+00 |
| updated_at | 2025-07-13 08:51:28.912962+00 |
| description | Version management for Tidepool toolkit |
| homepage | |
| repository | https://github.com/Slothtron/tidepool |
| max_upload_size | |
| id | 1729693 |
| size | 222,176 |
tidepool-version-manager is the core library of the Tidepool project, providing powerful runtime version management capabilities. It supports installation, switching, uninstallation, and management of multiple programming language runtimes. Currently focused on Go version management, it will expand to support Python, Node.js, and more runtimes in the future.
Add the following to your Cargo.toml:
[dependencies]
[dependencies]
tidepool-version-manager = "0.1.5"
## π Quick Start
### Basic Usage
```rust
use tidepool_version_manager::{
go::GoManager,
VersionManager,
InstallRequest,
SwitchRequest
};
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create Go version manager
let go_manager = GoManager::new();
// Install Go 1.21.0
let install_request = InstallRequest {
version: "1.21.0".to_string(),
install_dir: PathBuf::from("/usr/local/go-versions"),
download_dir: PathBuf::from("/tmp/go-downloads"),
force: false,
};
let version_info = go_manager.install(install_request).await?;
println!("β
Installed Go {}", version_info.version);
// Switch to that version
let switch_request = SwitchRequest {
version: "1.21.0".to_string(),
base_dir: PathBuf::from("/usr/local/go-versions"),
global: true,
force: false,
};
go_manager.switch_to(switch_request)?;
println!("π Switched to Go 1.21.0");
Ok(())
}
use tidepool_version_manager::{go::GoManager, VersionManager};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let go_manager = GoManager::new();
// Get available versions list
let available_versions = go_manager.list_available().await?;
println!("π Available Go versions ({} total):", available_versions.total_count);
for version in available_versions.versions.iter().take(10) {
println!(" - {}", version);
}
Ok(())
}
use tidepool_version_manager::{go::GoManager, VersionManager, StatusRequest};
use std::path::PathBuf;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let go_manager = GoManager::new();
let status_request = StatusRequest {
base_dir: Some(PathBuf::from("/usr/local/go-versions")),
};
let status = go_manager.status(status_request)?;
if let Some(version) = status.current_version {
println!("π― Current Go version: {}", version);
if let Some(path) = status.install_path {
println!("π Installation path: {}", path.display());
}
println!("π Environment variables:");
for (key, value) in status.environment_vars {
println!(" {}={}", key, value);
}
} else {
println!("β No installed Go version detected");
}
Ok(())
}
use tidepool_version_manager::downloader::{Downloader, DownloadConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create custom download configuration
let config = DownloadConfig {
concurrent_connections: 8, // Number of concurrent connections
timeout_seconds: 300, // Timeout in seconds
enable_chunked_download: true, // Enable chunked downloads
max_retries: 3, // Maximum retry attempts
min_chunk_size: 10 * 1024 * 1024, // Minimum chunk size (10MB)
..Default::default()
};
let downloader = Downloader::with_config(config);
// Use custom downloader for downloads
let url = "https://go.dev/dl/go1.21.0.linux-amd64.tar.gz";
let output_path = "/tmp/go1.21.0.linux-amd64.tar.gz";
downloader.download(url, output_path, None).await?;
println!("β
Download completed: {}", output_path);
Ok(())
}
use tidepool_version_manager::downloader::{Downloader, ProgressReporter};
struct MyProgressReporter;
impl ProgressReporter for MyProgressReporter {
fn report_progress(&self, downloaded: u64, total: Option<u64>) {
if let Some(total) = total {
let percentage = (downloaded as f64 / total as f64) * 100.0;
println!("π Download progress: {:.1}% ({}/{})", percentage, downloaded, total);
} else {
println!("π Downloaded: {} bytes", downloaded);
}
}
fn report_error(&self, error: &str) {
eprintln!("β Download error: {}", error);
}
fn report_completion(&self) {
println!("β
Download completed!");
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let downloader = Downloader::new();
let progress_reporter = MyProgressReporter;
let url = "https://go.dev/dl/go1.21.0.linux-amd64.tar.gz";
let output_path = "/tmp/go1.21.0.linux-amd64.tar.gz";
downloader.download(url, output_path, Some(&progress_reporter)).await?;
Ok(())
}
tidepool-version-manager/
βββ src/
β βββ lib.rs # Public interfaces and type definitions
β βββ go.rs # Go version management implementation
β βββ downloader.rs # Universal downloader module
βββ examples/ # Usage examples
βββ tests/ # Integration tests
VersionManager Trait - Unified version management interface, extensible for other runtimesGoManager - Concrete implementation for Go language version managementDownloader - High-performance async downloader with resume and progress reportingThe project includes several example programs demonstrating different use cases:
# Downloader functionality demo
cargo run --example downloader_test
# Hash verification demo
cargo run --example hash_verification_demo
# Temporary file handling demo
cargo run --example temp_file_demo
# Uninstall protection demo
cargo run --example uninstall_protection_demo
Run the complete test suite:
# Run all tests
cargo test
# Run specific tests
cargo test go_manager_tests
# Run integration tests
cargo test --test integration_tests
| Version | Rust Version | Features |
|---|---|---|
| 0.1.5 | 1.70+ | Unified symlink implementation, improved cross-platform compatibility |
| 0.1.4 | 1.70+ | Workspace configuration optimization, code refactoring |
| 0.1.3 | 1.70+ | Go version management, high-performance downloader |
| 0.1.2 | 1.70+ | Basic version management functionality |
| 0.1.1 | 1.70+ | Initial release |
Complete API documentation is available at docs.rs.
VersionManager - Version manager traitGoManager - Go version managerDownloader - High-performance downloaderInstallRequest - Installation request structureRuntimeStatus - Runtime status informationWe welcome all forms of contributions! Please see CONTRIBUTING.md for details.
# Clone repository
git clone https://github.com/Slothtron/tidepool.git
cd tidepool/crates/tidepool-version-manager
# Run tests
cargo test
# Check code formatting
cargo fmt --check
# Run Clippy checks
cargo clippy --all-targets --all-features
This project is licensed under the MIT License - see the LICENSE file for details.
Maintained by the Tidepool Project π