Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ remote-proto = { version = "0.0.1", path = "crates/remote-proto" }
remote-client = { version = "0.0.1", path = "crates/remote-client" }
sandbox2 = { version = "0.0.1", path = "crates/sandbox2" }

stdlib = { version = "0.0.11", path = "crates/stdlib" }
stdlib = { version = "0.0.12", path = "crates/stdlib" }
18 changes: 17 additions & 1 deletion crates/decode/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ mod tests {
#[test]
fn attr_wrong_schema_nickel_err() {
let res = Loader::new(
"let {Attrs, ..} = import \"minimal.ncl\" in {env_state_wiring = \"a\"} | Attrs",
"let {Attrs, ..} = import \"minimal.ncl\" in {binary_from = \"blueberry://example.com/bersh.exe\"} | Attrs",
None,
&LoadOptions::for_test(),
)
Expand All @@ -263,4 +263,20 @@ mod tests {
assert!(res.is_err());
assert!(matches!(res, Err(Error::Nickel(_))));
}

#[test]
fn attr_binary_from_ok() {
let res = Loader::new(
"let {Attrs, ..} = import \"minimal.ncl\" in {binary_from = \"https://example.com/bersh.exe\"} | Attrs",
None,
&LoadOptions::for_test(),
)
.unwrap_or_else(|e| {
e.report_to_stderr();
panic!("load failed");
})
.finish();

assert!(res.is_ok());
}
}
2 changes: 1 addition & 1 deletion crates/stdlib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stdlib"
version = "0.0.11"
version = "0.0.12"
rust-version = "1.87"
license = "MIT OR Apache-2.0"
edition.workspace = true
Expand Down
13 changes: 13 additions & 0 deletions crates/stdlib/minimal-ncl/attr_classes.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ in
desc = "When set, the source backing this package is not publically available.",
validate = Bool,
},
binary_from = {
name = "binary from",
desc = "Indicates binaries in the package were fetched from the given URL instead of built from source.",
validate = std.contract.custom (fun _label value =>
if std.typeof value != 'String then
'Error { message = "URLs must be a string" }
else if std.string.is_match m%%"^(?:https?|ftp|git)://[A-Za-z0-9.-]+(?::[0-9]+)?(?:/[^\s]*)?$"%% value then
'Ok value
else
'Error { message = "expected URL string" }
),
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

description = {
name = "description",
desc = "A short description of the function of the software.",
Expand Down