proto_bun/
lib.rs

1mod detect;
2pub mod download;
3mod execute;
4mod install;
5mod platform;
6mod resolve;
7mod shim;
8mod verify;
9
10use once_cell::sync::OnceCell;
11use proto_core::{impl_tool, Describable, Manifest, Proto, ProtoError, Tool};
12use std::{
13    any::Any,
14    path::{Path, PathBuf},
15};
16
17#[derive(Debug)]
18pub struct BunLanguage {
19    pub base_dir: PathBuf,
20    pub bin_path: Option<PathBuf>,
21    pub temp_dir: PathBuf,
22    pub version: Option<String>,
23
24    manifest: OnceCell<Manifest>,
25}
26
27impl BunLanguage {
28    pub fn new<P: AsRef<Proto>>(proto: P) -> Self {
29        let proto = proto.as_ref();
30
31        BunLanguage {
32            base_dir: proto.tools_dir.join("bun"),
33            bin_path: None,
34            manifest: OnceCell::new(),
35            temp_dir: proto.temp_dir.join("bun"),
36            version: None,
37        }
38    }
39}
40
41impl Describable<'_> for BunLanguage {
42    fn get_id(&self) -> &str {
43        "bun"
44    }
45
46    fn get_name(&self) -> String {
47        "Bun".into()
48    }
49}
50
51impl_tool!(BunLanguage);