diff --git a/src/backend/platform_target.rs b/src/backend/platform_target.rs
index 531e780974..8430f0de9b 100644
--- a/src/backend/platform_target.rs
+++ b/src/backend/platform_target.rs
@@ -31,3 +31,39 @@ impl PlatformTarget {
self.platform.to_key()
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_platform_target_creation() {
+ let platform = Platform::parse("linux-x64").unwrap();
+ let target = PlatformTarget::new(platform.clone());
+
+ assert_eq!(target.platform, platform);
+ assert_eq!(target.os_name(), "linux");
+ assert_eq!(target.arch_name(), "x64");
+ assert_eq!(target.qualifier(), None);
+ assert_eq!(target.to_key(), "linux-x64");
+ }
+
+ #[test]
+ fn test_platform_target_with_qualifier() {
+ let platform = Platform::parse("linux-x64-musl").unwrap();
+ let target = PlatformTarget::new(platform);
+
+ assert_eq!(target.os_name(), "linux");
+ assert_eq!(target.arch_name(), "x64");
+ assert_eq!(target.qualifier(), Some("musl"));
+ assert_eq!(target.to_key(), "linux-x64-musl");
+ }
+
+ #[test]
+ fn test_from_current() {
+ let target = PlatformTarget::from_current();
+ let current_platform = Platform::current();
+
+ assert_eq!(target.platform, current_platform);
+ }
+}
diff --git a/src/plugins/core/bun.rs b/src/plugins/core/bun.rs
index 46af233ed6..e221b498c7 100644
--- a/src/plugins/core/bun.rs
+++ b/src/plugins/core/bun.rs
@@ -15,7 +15,10 @@ use crate::http::HTTP;
use crate::install_context::InstallContext;
use crate::toolset::ToolVersion;
use crate::ui::progress_report::SingleReport;
-use crate::{backend::Backend, config::Config};
+use crate::{
+ backend::{Backend, GitHubReleaseInfo, ReleaseType, platform_target::PlatformTarget},
+ config::Config,
+};
use crate::{file, github, plugins};
#[derive(Debug)]
@@ -116,44 +119,108 @@ impl Backend for BunPlugin {
Ok(tv)
}
-}
-fn os() -> &'static str {
- if cfg!(target_os = "macos") {
- "darwin"
- } else if cfg!(target_os = "linux") {
- "linux"
- } else {
- &OS
+ // ========== Lockfile Metadata Fetching Implementation ==========
+
+ async fn get_github_release_info(
+ &self,
+ tv: &ToolVersion,
+ target: &PlatformTarget,
+ ) -> Result