Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bundler/lib/bundler/templates/newgem/Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ gemspec

gem "rake", "~> 13.0"
<%- if config[:ext] -%>

gem "rake-compiler"
<%- end -%>
<%- if config[:test] -%>

gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
<%- end -%>
<%- if config[:rubocop] -%>

gem "rubocop", "~> 0.80"
<%- end -%>
6 changes: 5 additions & 1 deletion bundler/lib/bundler/templates/newgem/Rakefile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
end

<% end -%>
task default: <%= default_task_names.size == 1 ? default_task_names.first.inspect : default_task_names.inspect %>
<% if default_task_names.size == 1 -%>
task default: <%= default_task_names.first.inspect %>
<% else -%>
task default: %i[<%= default_task_names.join(" ") %>]
<% end -%>
2 changes: 2 additions & 0 deletions bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "mkmf"

create_makefile(<%= config[:makefile_path].inspect %>)
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "test_helper"

class <%= config[:constant_name] %>Test < Minitest::Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "<%= config[:namespaced_path] %>"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "test_helper"

class <%= config[:constant_name] %>Test < Test::Unit::TestCase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "<%= config[:namespaced_path] %>"

Expand Down
2 changes: 1 addition & 1 deletion bundler/spec/commands/newgem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ def create_temporary_dir(dir)
ext.lib_dir = "lib/#{gem_name}"
end

task default: [:clobber, :compile]
task default: %i[clobber compile]
RAKEFILE

expect(bundled_app("#{gem_name}/Rakefile").read).to eq(rakefile)
Expand Down