Skip to content

Commit a26f823

Browse files
sue445matzbot
authored andcommitted
[ruby/rubygems] Add go_gem/rake_task for Go native extention gem skeleton
ruby/rubygems@64f92d2da0
1 parent 9d04fb5 commit a26f823

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/bundler/templates/newgem/Rakefile.tt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ Rake::ExtensionTask.new("<%= config[:underscored_name] %>", GEMSPEC) do |ext|
5959
end
6060
<% end -%>
6161

62+
<% if config[:ext] == "go" -%>
63+
require "go_gem/rake_task"
64+
65+
GoGem::RakeTask.new("<%= config[:underscored_name] %>")
66+
<% end -%>
67+
6268
<% end -%>
6369
<% if default_task_names.size == 1 -%>
6470
task default: <%= default_task_names.first.inspect %>

spec/bundler/commands/newgem_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,6 +1829,14 @@ def create_temporary_dir(dir)
18291829
expect(bundled_app("#{gem_name}/ext/#{gem_name}/go.mod").read).to include("module github.com/bundleuser/#{gem_name}")
18301830
end
18311831

1832+
it "includes go_gem extension in Rakefile" do
1833+
expect(bundled_app("#{gem_name}/Rakefile").read).to include(<<~RUBY)
1834+
require "go_gem/rake_task"
1835+
1836+
GoGem::RakeTask.new("#{gem_name}")
1837+
RUBY
1838+
end
1839+
18321840
context "with --no-ci" do
18331841
let(:flags) { "--ext=go --no-ci" }
18341842

0 commit comments

Comments
 (0)