Skip to content

Commit

Permalink
add wasmer config, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
iliabylich committed Feb 2, 2024
1 parent 3146041 commit 62e539d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ edition = "2021"
license = "MIT"
name = "lib-ruby-parser-nodes"
repository = "https://github.com/lib-ruby-parser/nodes"
version = "0.55.0"
version = "0.56.0"

[dependencies]
liquid = "= 0.26"
liquid-core = "= 0.26"
serde = {version = "1.0", features = ["derive"]}
serde = { version = "1.0", features = ["derive"] }
32 changes: 12 additions & 20 deletions examples/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,20 @@ fn print_usage_and_exit() -> ! {
std::process::exit(1);
}

fn main() {
let mut args = std::env::args().collect::<Vec<_>>();
fn try_arg(key: &str) -> Option<String> {
let idx = std::env::args().position(|e| e == key)?;
let value = std::env::args().nth(idx + 1)?;
Some(value)
}

let mut get_arg = |key: &str| {
let key_idx = args
.iter()
.enumerate()
.find(|&(_idx, e)| e == key)
.unwrap_or_else(|| {
eprintln!("Unable to get {} CLI argument", key);
print_usage_and_exit()
})
.0;
let _key = args.remove(key_idx);
if key_idx >= args.len() {
eprintln!("No {} CLI option given", key);
print_usage_and_exit();
}
let value = args.remove(key_idx);
value
};
fn get_arg(key: &str) -> String {
try_arg(key).unwrap_or_else(|| {
eprintln!("No {} CLI option given", key);
print_usage_and_exit()
})
}

fn main() {
let template_path = get_arg("--template");
let output_path = get_arg("--write-to");

Expand Down
22 changes: 22 additions & 0 deletions wasmer.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = 'iliabylich/lib-ruby-parser-nodes'
version = '0.55.0'
description = 'Ruby parser nodes data'
license = 'MIT'
readme = 'README.md'
repository = 'https://github.com/lib-ruby-parser/nodes'

# See more keys and definitions at https://docs.wasmer.io/registry/manifest

[[module]]
name = 'lib-ruby-parser-nodes'
source = 'target/wasm32-wasi/release/examples/codegen.wasm'
abi = 'wasi'

[module.interfaces]
wasi = '0.1.0-unstable'

[[command]]
name = 'lib-ruby-parser-nodes'
module = 'lib-ruby-parser-nodes'
runner = 'wasi'

0 comments on commit 62e539d

Please sign in to comment.