From 999cc9d59fcb455ee496485ff7233a38c3821ec3 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 11 Feb 2024 14:13:27 +0100 Subject: [PATCH] feat: with fix Signed-off-by: kjuulh --- crates/cuddle-ci/src/leptos_service.rs | 2 +- crates/cuddle-ci/src/rust_lib.rs | 5 ++--- crates/cuddle-ci/src/rust_service/apt.rs | 6 ++++++ crates/cuddle-ci/src/rust_service/apt_ca_certificates.rs | 6 ++++++ crates/cuddle-ci/src/rust_service/assets.rs | 6 +++--- crates/cuddle-ci/src/rust_service/cargo_clean.rs | 6 ++++++ crates/cuddle-ci/src/rust_service/docker_cli.rs | 2 +- crates/cuddle-ci/src/rust_service/ssh_agent.rs | 6 +++--- crates/dagger-rust/src/htmx.rs | 2 +- crates/dagger-rust/src/leptos.rs | 2 +- crates/dagger-rust/src/source.rs | 6 +++--- crates/dagger-rust/src/test.rs | 2 +- 12 files changed, 34 insertions(+), 17 deletions(-) diff --git a/crates/cuddle-ci/src/leptos_service.rs b/crates/cuddle-ci/src/leptos_service.rs index db94587..7c286fd 100644 --- a/crates/cuddle-ci/src/leptos_service.rs +++ b/crates/cuddle-ci/src/leptos_service.rs @@ -368,7 +368,7 @@ impl MainAction for LeptosService { .container() .from(update_deployments_docker_image); - let dep = if let Some(sock) = std::env::var("SSH_AUTH_SOCK").ok() { + let dep = if let Ok(sock) = std::env::var("SSH_AUTH_SOCK") { dep.with_unix_socket("/tmp/ssh_sock", self.client.host().unix_socket(sock)) .with_env_variable("SSH_AUTH_SOCK", "/tmp/ssh_sock") .with_exec(vec![ diff --git a/crates/cuddle-ci/src/rust_lib.rs b/crates/cuddle-ci/src/rust_lib.rs index 6b87858..9408caf 100644 --- a/crates/cuddle-ci/src/rust_lib.rs +++ b/crates/cuddle-ci/src/rust_lib.rs @@ -1,13 +1,12 @@ -use std::{path::PathBuf, sync::Arc}; +use std::{path::PathBuf}; use async_trait::async_trait; use dagger_rust::source::RustSource; use dagger_sdk::Container; -use futures::{stream, StreamExt}; +use futures::{StreamExt}; use crate::{ cli, - dagger_middleware::{DaggerMiddleware, DynMiddleware}, rust_service::architecture::{Architecture, Os}, MainAction, PullRequestAction, }; diff --git a/crates/cuddle-ci/src/rust_service/apt.rs b/crates/cuddle-ci/src/rust_service/apt.rs index 6f5df9c..7f09a41 100644 --- a/crates/cuddle-ci/src/rust_service/apt.rs +++ b/crates/cuddle-ci/src/rust_service/apt.rs @@ -11,6 +11,12 @@ pub struct Apt { deps: Vec, } +impl Default for Apt { + fn default() -> Self { + Self::new() + } +} + impl Apt { pub fn new() -> Self { Self { deps: Vec::new() } diff --git a/crates/cuddle-ci/src/rust_service/apt_ca_certificates.rs b/crates/cuddle-ci/src/rust_service/apt_ca_certificates.rs index b4cac1f..a26866e 100644 --- a/crates/cuddle-ci/src/rust_service/apt_ca_certificates.rs +++ b/crates/cuddle-ci/src/rust_service/apt_ca_certificates.rs @@ -9,6 +9,12 @@ use super::RustService; pub struct AptCaCertificates {} +impl Default for AptCaCertificates { + fn default() -> Self { + Self::new() + } +} + impl AptCaCertificates { pub fn new() -> Self { Self {} diff --git a/crates/cuddle-ci/src/rust_service/assets.rs b/crates/cuddle-ci/src/rust_service/assets.rs index dd27002..6d3cbce 100644 --- a/crates/cuddle-ci/src/rust_service/assets.rs +++ b/crates/cuddle-ci/src/rust_service/assets.rs @@ -1,7 +1,7 @@ use std::{path::PathBuf, sync::Arc}; use async_trait::async_trait; -use dagger_sdk::{Container, HostDirectoryOpts, HostDirectoryOptsBuilder}; +use dagger_sdk::{Container}; use crate::{dagger_middleware::DaggerMiddleware, leptos_service::LeptosService}; @@ -37,8 +37,8 @@ impl DaggerMiddleware for Assets { .fold(container, |container, (src_asset_path, dest_asset_path)| { let src_path = src_asset_path.display().to_string(); let dest_path = dest_asset_path.display().to_string(); - let path = self.client.host().directory(&src_path); - container.with_directory(&dest_path, path) + let path = self.client.host().directory(src_path); + container.with_directory(dest_path, path) }); Ok(container) diff --git a/crates/cuddle-ci/src/rust_service/cargo_clean.rs b/crates/cuddle-ci/src/rust_service/cargo_clean.rs index 1b9cb68..9a91428 100644 --- a/crates/cuddle-ci/src/rust_service/cargo_clean.rs +++ b/crates/cuddle-ci/src/rust_service/cargo_clean.rs @@ -9,6 +9,12 @@ use super::RustService; pub struct CargoClean; +impl Default for CargoClean { + fn default() -> Self { + Self::new() + } +} + impl CargoClean { pub fn new() -> Self { Self {} diff --git a/crates/cuddle-ci/src/rust_service/docker_cli.rs b/crates/cuddle-ci/src/rust_service/docker_cli.rs index 70dc077..963f92b 100644 --- a/crates/cuddle-ci/src/rust_service/docker_cli.rs +++ b/crates/cuddle-ci/src/rust_service/docker_cli.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use async_trait::async_trait; -use dagger_sdk::{Container, ImageMediaTypes}; +use dagger_sdk::{Container}; use crate::dagger_middleware::DaggerMiddleware; diff --git a/crates/cuddle-ci/src/rust_service/ssh_agent.rs b/crates/cuddle-ci/src/rust_service/ssh_agent.rs index 284403b..000e342 100644 --- a/crates/cuddle-ci/src/rust_service/ssh_agent.rs +++ b/crates/cuddle-ci/src/rust_service/ssh_agent.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use async_trait::async_trait; -use dagger_sdk::{Container, ContainerWithNewFileOptsBuilder, Socket}; +use dagger_sdk::{Container, ContainerWithNewFileOptsBuilder}; use eyre::Context; use crate::{dagger_middleware::DaggerMiddleware, leptos_service::LeptosService}; @@ -30,7 +30,7 @@ impl DaggerMiddleware for SshAgent { let c = container .with_new_file_opts( - format!(".ssh/config"), + ".ssh/config".to_string(), ContainerWithNewFileOptsBuilder::default() .contents( r#" @@ -40,7 +40,7 @@ Host * "#, ) - .permissions(0700 as isize) + .permissions(0700_isize) .build()?, ) .with_unix_socket(&sock_var, socket) diff --git a/crates/dagger-rust/src/htmx.rs b/crates/dagger-rust/src/htmx.rs index 0580b01..d11af97 100644 --- a/crates/dagger-rust/src/htmx.rs +++ b/crates/dagger-rust/src/htmx.rs @@ -219,7 +219,7 @@ impl HtmxBuild { ) .with_directory( "/mnt/app/target/site", - builder_image.directory(format!("/mnt/src/target/site")), + builder_image.directory("/mnt/src/target/site".to_string()), ) .with_file( "/mnt/app/Cargo.toml", diff --git a/crates/dagger-rust/src/leptos.rs b/crates/dagger-rust/src/leptos.rs index 13c9a73..8cdf886 100644 --- a/crates/dagger-rust/src/leptos.rs +++ b/crates/dagger-rust/src/leptos.rs @@ -198,7 +198,7 @@ impl LeptosBuild { ) .with_directory( "/mnt/app/target/site", - builder_image.directory(format!("/mnt/src/target/site")), + builder_image.directory("/mnt/src/target/site".to_string()), ) .with_file( "/mnt/app/Cargo.toml", diff --git a/crates/dagger-rust/src/source.rs b/crates/dagger-rust/src/source.rs index 61937d6..4bca6ad 100644 --- a/crates/dagger-rust/src/source.rs +++ b/crates/dagger-rust/src/source.rs @@ -116,7 +116,7 @@ impl RustSource { .map(|c| format!("**/*{}*", c.replace('-', "_"))) .collect::>(); - let original_crates = crates.clone(); + let mut original_crates = crates.clone(); original_crates.extend(exclude); let exclude = original_crates.iter().map(|c| c.as_str()).collect(); @@ -130,7 +130,7 @@ impl RustSource { }, ); - return Ok(incremental_dir); + Ok(incremental_dir) } pub async fn get_rust_skeleton_files( @@ -191,7 +191,7 @@ impl RustSource { } directory = create_skeleton_files( directory, - rust_crate.strip_prefix(source_path).unwrap_or(&rust_crate), + rust_crate.strip_prefix(source_path).unwrap_or(rust_crate), )?; } diff --git a/crates/dagger-rust/src/test.rs b/crates/dagger-rust/src/test.rs index 3fdbc59..1eb055f 100644 --- a/crates/dagger-rust/src/test.rs +++ b/crates/dagger-rust/src/test.rs @@ -40,7 +40,7 @@ impl RustTest { .with_exec(vec!["apt", "update"]) .with_exec(deps); - let target_cache = self.client.cache_volume(format!("rust_target_test",)); + let target_cache = self.client.cache_volume("rust_target_test".to_string()); let build_options = vec!["cargo", "build", "--workspace"]; let rust_prebuild = rust_build_image