Release Dependency Manager
A Rust library for fetching and downloading release binaries from multiple Git repositories (GitHub and Gitee) with semantic version matching.
Features
- Multi-platform support: Fetch releases from both GitHub and Gitee
- Semantic versioning: Use semver requirements to match compatible versions
- Concurrent fetching: Parallel requests to multiple repositories for faster results
- Flexible configuration: Customizable timeout, download directory, and repository priorities
- Automatic binary download: Downloads matching binary assets automatically
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start
use ;
use Duration;
Configuration
The Config struct accepts the following parameters:
package: The name of the package/binary to search forversion: A semver requirement string (e.g., "^1.0.0", ">=0.2.0", "1.2.3")repo: An array of repository URLs in order of prioritydownload_dir: Optional download directory (defaults to system temp directory)timeout: Optional timeout duration (defaults to no timeout)
Supported Repository Providers
GitHub
- URL format:
https://github.com/owner/repo - API: Uses GitHub REST API v3
- Rate limits: Subject to GitHub API rate limits
Gitee
- URL format:
https://gitee.com/owner/repo - API: Uses Gitee REST API v5
- Rate limits: Subject to Gitee API rate limits
Version Matching
The library supports full semver requirements:
- Exact version:
"1.0.0" - Caret requirements:
"^1.0.0"(compatible with 1.x.x) - Tilde requirements:
"~1.0.0"(compatible with 1.0.x) - Range requirements:
">=1.0.0, <2.0.0" - Wildcard:
"*"(any version)
Examples
Single Repository
use ;
let config = Config ;
let release = get_release?;
Multiple Repositories with Timeout
use ;
use Duration;
let config = Config ;
let release = get_release?;
How It Works
- Parse Configuration: Validates the semver requirement and repository URLs
- Concurrent Requests: Sends parallel requests to all specified repositories
- Version Matching: Checks each release against the semver requirement
- Binary Search: Looks for assets containing the package name
- Download: Downloads the first matching binary found
- Return Results: Returns the
ReleaseDepwith download information
Return Type
The get_release function returns a ReleaseDep struct:
Error Handling
The library returns detailed error messages for common scenarios:
- Invalid semver requirements
- Unsupported repository providers
- Network connection issues
- No matching releases found
- Download failures
- Timeout exceeded
Requirements
- Rust 1.70 or later
- Internet connection for API access
- Write permissions for download directory
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Changelog
0.1.0
- Initial release
- Support for GitHub and Gitee repositories
- Semantic version matching
- Concurrent repository fetching
- Automatic binary download