Skip to content

Commit 1ff23bc

Browse files
committed
Fix build, test
1 parent fec2645 commit 1ff23bc

6 files changed

Lines changed: 36 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uzumibi-cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn create_project(
9393
// Collect feature overlay paths to know which files to skip from base
9494
let mut feature_files = collect_feature_overlay_files(template, features);
9595

96-
// When queue feature is active, skip app.rb (consumer.rb replaces it)
96+
// For queue feature, skip app.rb (consumer.rb replaces it)
9797
if features.iter().any(|f| f == "queue") {
9898
feature_files.insert("lib/app.rb".to_string());
9999
}

uzumibi-cli/templates/cloudrun/Cargo.toml_

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ time = { version = "0.3", features = ["formatting", "local-offset", "macros"] }
2424

2525
[build-dependencies]
2626
mruby-compiler2-sys = ">= 0.3.0"
27+
28+
[features]
29+
default = []
30+
enable-external = []
31+
queue = ["enable-external"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use std::path::Path;
2+
3+
extern crate mruby_compiler2_sys;
4+
5+
fn main() {
6+
let out_dir = std::env::var("OUT_DIR").unwrap();
7+
let mrb_path = Path::new(&out_dir).join("consumer.mrb");
8+
let code = include_str!("lib/consumer.rb");
9+
println!("cargo:rerun-if-changed=lib/consumer.rb");
10+
11+
unsafe {
12+
let mut ctx = mruby_compiler2_sys::MRubyCompiler2Context::new();
13+
ctx.compile_to_file(code, &mrb_path)
14+
.expect("failed to compile mruby script");
15+
}
16+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Consumer < Uzumibi::Consumer
2+
# @rbs message: Uzumibi::Message
3+
def on_receive(message)
4+
debug_console("[Consumer] Received message: id=#{message.id}, body=#{message.body}, attempts=#{message.attempts}")
5+
message.ack!
6+
end
7+
end
8+
9+
$CONSUMER = Consumer.new

uzumibi-cli/tests/runn/new_cloudrun.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ runners:
44
vars:
55
binary: ${UZUMIBI_TEST_BINARY:-../target/release/uzumibi}
66
tmpdir: ${UZUMIBI_TEST_TMPDIR:-../tmp}
7-
project_name: test-cloudrun-project
7+
extra_args: ${UZUMIBI_NEW_EXTRA_ARGS:-}
8+
project_name: ${UZUMIBI_PROJECT_NAME:-test-cloudrun-project}
89
template: cloudrun
910
steps:
1011
build:
@@ -28,7 +29,7 @@ steps:
2829
create_project:
2930
desc: Create new cloudrun project
3031
exec:
31-
command: cd {{ vars.tmpdir }} && {{ vars.binary }} new -t {{ vars.template }} {{ vars.project_name }}
32+
command: cd {{ vars.tmpdir }} && {{ vars.binary }} new -t {{ vars.template }} {{ vars.extra_args }} {{ vars.project_name }}
3233
test: |
3334
current.exit_code == 0 &&
3435
current.stdout contains 'Successfully created project'
@@ -39,7 +40,7 @@ steps:
3940
command: cat {{ vars.tmpdir }}/{{ vars.project_name }}/Cargo.toml
4041
test: |
4142
current.exit_code == 0 &&
42-
current.stdout contains 'name = "test-cloudrun-project"'
43+
!(current.stdout contains '$$PROJECT_NAME$$')
4344
4445
check_app_rb:
4546
desc: Check lib/app.rb exists

0 commit comments

Comments
 (0)