feat: with arc
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-11-27 20:11:49 +01:00
parent 999d81bb7a
commit bda242422d
8 changed files with 41 additions and 48 deletions

View File

@@ -1,3 +1,5 @@
use std::sync::Arc;
use async_trait::async_trait;
use dagger_sdk::Container;
@@ -62,15 +64,14 @@ impl CargoBInstall {
#[async_trait]
impl DaggerMiddleware for CargoBInstall {
async fn handle(&self, container: Container) -> eyre::Result<Container> {
let c =
container
.with_exec(vec!["wget", &self.get_download_url()])
.with_exec(vec!["tar", "-xvf", &self.get_archive()])
.with_exec(
"mv cargo-binstall /usr/local/cargo/bin"
.split_whitespace()
.collect(),
);
let c = container
.with_exec(vec!["wget", &self.get_download_url()])
.with_exec(vec!["tar", "-xvf", &self.get_archive()])
.with_exec(
"mv cargo-binstall /usr/local/cargo/bin"
.split_whitespace()
.collect(),
);
let c = self.crates.iter().cloned().fold(c, |acc, item| {
acc.with_exec(vec!["cargo", "binstall", &item, "-y"])
@@ -98,8 +99,8 @@ impl CargoBInstallExt for RustService {
) -> &mut Self {
let crates: Vec<String> = crates.into_iter().map(|s| s.into()).collect();
self.with_stage(super::RustServiceStage::BeforeDeps(
Box::new(CargoBInstall::new(self.get_arch(), self.get_os(), version, crates))
))
self.with_stage(super::RustServiceStage::BeforeDeps(Arc::new(
CargoBInstall::new(self.get_arch(), self.get_os(), version, crates),
)))
}
}