Skip to content

Commit 4f8aa3b

Browse files
authored
Merge pull request #9156 from yoshoku/fix_newgem_template
Fix native extension loading in newgem template for RHEL-based systems
2 parents c00ca53 + 68599bd commit 4f8aa3b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require_relative "<%= File.basename(config[:namespaced_path]) %>/version"
44
<%- if config[:ext] -%>
5-
require_relative "<%= File.basename(config[:namespaced_path]) %>/<%= config[:underscored_name] %>"
5+
require "<%= File.basename(config[:namespaced_path]) %>/<%= config[:underscored_name] %>"
66
<%- end -%>
77

88
<%- config[:constant_array].each_with_index do |c, i| -%>

bundler/spec/commands/newgem_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,6 +1681,13 @@ def create_temporary_dir(dir)
16811681
expect(bundled_app("#{gem_name}/ext/#{gem_name}/#{gem_name}.c")).to exist
16821682
end
16831683

1684+
it "generates native extension loading code" do
1685+
expect(bundled_app("#{gem_name}/lib/#{gem_name}.rb").read).to include(<<~RUBY)
1686+
require_relative "test_gem/version"
1687+
require "#{gem_name}/#{gem_name}"
1688+
RUBY
1689+
end
1690+
16841691
it "includes rake-compiler, but no Rust related changes" do
16851692
expect(bundled_app("#{gem_name}/Gemfile").read).to include('gem "rake-compiler"')
16861693

0 commit comments

Comments
 (0)