Skip to content

Commit

Permalink
Update deps.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Feb 15, 2024
1 parent f35f2ed commit 4bf5b8a
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 201 deletions.
295 changes: 111 additions & 184 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ members = ["crates/*"]

[workspace.dependencies]
extism-pdk = "1.0.1"
moon_common = "0.0.2"
moon_config = "0.0.2"
moon_pdk = "0.0.2"
moon_pdk_test_utils = "0.0.2"
moon_target = "0.0.1"
moon_common = "0.0.3"
moon_config = "0.0.4"
moon_pdk = "0.0.4"
moon_pdk_test_utils = "0.0.4"
moon_target = "0.0.2"
rustc-hash = "1.1.0"
serde = { version = "1.0.196", features = ["derive"] }
serde_json = "1.0.113"
serde_yaml = "0.9.31"
starbase_utils = { version = "0.4.2", default-features = false }
starbase_sandbox = "0.3.0"
starbase_utils = { version = "0.5.0", default-features = false }
starbase_sandbox = "0.4.0"

# moon_common = { path = "../moon/nextgen/common" }
# moon_config = { path = "../moon/nextgen/config" }
Expand Down
3 changes: 2 additions & 1 deletion crates/common/src/download.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::format_virtual_path;
use extism_pdk::debug;
use moon_pdk::{fetch_url_bytes, AnyResult, VirtualPath};
use std::fs;
Expand All @@ -24,7 +25,7 @@ pub fn download_from_url<U: AsRef<str>, P: AsRef<VirtualPath>>(
fs::create_dir_all(dir)?;
fs::write(&file, bytes)?;

debug!("Downloaded to <path>{}</path>", file.real_path().display());
debug!("Downloaded to <path>{}</path>", format_virtual_path(&file));

Ok(file)
}
13 changes: 13 additions & 0 deletions crates/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
pub mod download;
pub mod migrator;
pub mod project_graph;

use moon_pdk::VirtualPath;
use std::borrow::Cow;

pub fn format_virtual_path(path: &VirtualPath) -> Cow<'_, str> {
if let Some(real) = path.real_path() {
Cow::Owned(real.to_string_lossy().into_owned())
} else if let Some(rel) = path.without_prefix() {
rel.to_string_lossy()
} else {
path.virtual_path().to_string_lossy()
}
}
7 changes: 4 additions & 3 deletions crates/download/src/download_ext.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use extism_pdk::*;
use moon_extension_common::download::download_from_url;
use moon_extension_common::format_virtual_path;
use moon_pdk::*;

#[host_fn]
Expand Down Expand Up @@ -41,13 +42,13 @@ pub fn execute_extension(Json(input): Json<ExecuteExtensionInput>) -> FnResult<(
if dest_dir.exists() && dest_dir.is_file() {
return Err(plugin_err!(
"Destination <path>{}</path> must be a directory, found a file.",
dest_dir.real_path().display(),
format_virtual_path(&dest_dir),
));
}

debug!(
"Destination <path>{}</path> will be used",
dest_dir.real_path().display(),
format_virtual_path(&dest_dir),
);

// Attempt to download the file
Expand All @@ -58,7 +59,7 @@ pub fn execute_extension(Json(input): Json<ExecuteExtensionInput>) -> FnResult<(
host_log!(
stdout,
"Downloaded to <path>{}</path>",
dest_file.real_path().display()
format_virtual_path(&dest_file),
);

Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ tasks:
extends: e2e
args:
- --baseUrl
- $workspaceRoot/https://some-internal-url.example.com
- https://some-internal-url.example.com

2 changes: 1 addition & 1 deletion crates/unpack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pre-release-replacements = [
moon_extension_common = { path = "../common" }
extism-pdk = { workspace = true }
moon_pdk = { workspace = true }
starbase_archive = { version = "0.4.0", default-features = false, features = [
starbase_archive = { version = "0.5.0", default-features = false, features = [
"tar-gz",
"zip",
] }
Expand Down
9 changes: 5 additions & 4 deletions crates/unpack/src/unpack_ext.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use extism_pdk::*;
use moon_extension_common::download::download_from_url;
use moon_extension_common::format_virtual_path;
use moon_pdk::*;
use starbase_archive::Archiver;
use std::fs;
Expand Down Expand Up @@ -53,14 +54,14 @@ pub fn execute_extension(Json(input): Json<ExecuteExtensionInput>) -> FnResult<(
if !src_file.exists() || !src_file.is_file() {
return Err(plugin_err!(
"Source <path>{}</path> must be a valid file.",
src_file.real_path().display(),
format_virtual_path(&src_file),
));
}

host_log!(
stdout,
"Opening archive <path>{}</path>",
src_file.real_path().display()
format_virtual_path(&src_file),
);

// Convert the provided output into a virtual file path.
Expand All @@ -74,7 +75,7 @@ pub fn execute_extension(Json(input): Json<ExecuteExtensionInput>) -> FnResult<(
if dest_dir.exists() && dest_dir.is_file() {
return Err(plugin_err!(
"Destination <path>{}</path> must be a directory, found a file.",
dest_dir.real_path().display(),
format_virtual_path(&dest_dir),
));
}

Expand All @@ -83,7 +84,7 @@ pub fn execute_extension(Json(input): Json<ExecuteExtensionInput>) -> FnResult<(
host_log!(
stdout,
"Unpacking archive to <path>{}</path>",
dest_dir.real_path().display()
format_virtual_path(&dest_dir),
);

// Attempt to unpack the archive!
Expand Down

0 comments on commit 4bf5b8a

Please sign in to comment.