diff options
-rw-r--r-- | lib/bundler/templates/newgem/Rakefile.tt | 8 | ||||
-rw-r--r-- | spec/bundler/commands/newgem_spec.rb | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/bundler/templates/newgem/Rakefile.tt b/lib/bundler/templates/newgem/Rakefile.tt index b5a5c4e392..77f8a02530 100644 --- a/lib/bundler/templates/newgem/Rakefile.tt +++ b/lib/bundler/templates/newgem/Rakefile.tt @@ -46,7 +46,9 @@ require "rb_sys/extensiontask" task build: :compile -RbSys::ExtensionTask.new(<%= config[:name].inspect %>) do |ext| +GEMSPEC = Gem::Specification.load("<%= config[:underscored_name] %>.gemspec") + +RbSys::ExtensionTask.new(<%= config[:name].inspect %>, GEMSPEC) do |ext| ext.lib_dir = "lib/<%= config[:namespaced_path] %>" end <% else -%> @@ -54,7 +56,9 @@ require "rake/extensiontask" task build: :compile -Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext| +GEMSPEC = Gem::Specification.load("<%= config[:underscored_name] %>.gemspec") + +Rake::ExtensionTask.new("<%= config[:underscored_name] %>", GEMSPEC) do |ext| ext.lib_dir = "lib/<%= config[:namespaced_path] %>" end <% end -%> diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index e06c8c8dd3..b34ffbc35b 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -1427,7 +1427,9 @@ RSpec.describe "bundle gem" do task build: :compile - Rake::ExtensionTask.new("#{gem_name}") do |ext| + GEMSPEC = Gem::Specification.load("#{gem_name}.gemspec") + + Rake::ExtensionTask.new("#{gem_name}", GEMSPEC) do |ext| ext.lib_dir = "lib/#{gem_name}" end @@ -1485,7 +1487,9 @@ RSpec.describe "bundle gem" do task build: :compile - RbSys::ExtensionTask.new("#{gem_name}") do |ext| + GEMSPEC = Gem::Specification.load("#{gem_name}.gemspec") + + RbSys::ExtensionTask.new("#{gem_name}", GEMSPEC) do |ext| ext.lib_dir = "lib/#{gem_name}" end |