Skip to content

Commit 6a9bb38

Browse files
committed
recognize jruby platform via a :platform option
in addition to the :rubyvm option
1 parent 3a02a18 commit 6a9bb38

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/rake_compiler_dock/starter.rb

+1
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def container_registry
178178
end
179179

180180
def container_rubyvm(options={})
181+
return "jruby" if options[:platform] == "jruby"
181182
options.fetch(:rubyvm) { ENV['RCD_RUBYVM'] } || "mri"
182183
end
183184

test/test_starter.rb

+11
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ def test_container_image_name
5959
Starter.container_image_name({:rubyvm => "jruby"}),
6060
)
6161

62+
# jruby platform arg
63+
assert_equal(
64+
"ghcr.io/rake-compiler/rake-compiler-dock-image:#{IMAGE_VERSION}-jruby",
65+
Starter.container_image_name({:platform => "jruby"}),
66+
)
67+
6268
# container registry env var
6369
with_env({"CONTAINER_REGISTRY" => "registry-value"}) do
6470
assert_equal(
@@ -98,11 +104,16 @@ def test_container_rubyvm
98104
with_env({"RCD_RUBYVM" => "env-var-value"}) do
99105
assert_equal("option-value", Starter.container_rubyvm({:rubyvm => "option-value"}))
100106
end
107+
108+
# with jruby platform option
109+
assert_equal("jruby", Starter.container_rubyvm({:platform => "jruby"}))
101110
end
102111

103112
def test_container_jrubyvm?
104113
assert(Starter.container_jrubyvm?({:rubyvm => "jruby"}))
114+
assert(Starter.container_jrubyvm?({:platform => "jruby"}))
105115
refute(Starter.container_jrubyvm?({:rubyvm => "mri"}))
116+
refute(Starter.container_jrubyvm?({:platform => "x86_64-linux"}))
106117
end
107118

108119
def test_platforms

0 commit comments

Comments
 (0)