summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
blob: f404aa34688c4189ea1e70fa6641505af9a5f7f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
if ENV["RUBYOPT"] || defined? Gem
  ENV.delete "RUBYOPT"

  require "rbconfig"
  cmd = [RbConfig.ruby, "--disable-gems", "build.rb", *ARGV]

  exec(*cmd)
end

require "tmpdir"

lp = File.expand_path("../../../../lib", __dir__)
gem = ["ruby", "-I#{lp}", File.expand_path("../../../../bin/gem", __dir__)]
gemspec = File.expand_path("rust_ruby_example.gemspec", __dir__)

Dir.mktmpdir("rust_ruby_example") do |dir|
  built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
  system(*gem, "build", gemspec, "--output", built_gem)
  system(*gem, "install", "--verbose", "--local", built_gem, *ARGV)
  system %q(ruby -rrust_ruby_example -e "puts 'Result: ' + RustRubyExample.reverse('hello world')")
end