mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00

In case of multiple Rake tasks, the default tasks would look something like this: `task default: [:spec, :rubocop]` Instead, they should use %i and look something like this: `task default: %i[spec rubocop]` Signed-off-by: Utkarsh Gupta <utkarsh@debian.org> https://github.com/rubygems/rubygems/commit/487ecd59ce
43 lines
988 B
Text
43 lines
988 B
Text
# frozen_string_literal: true
|
|
|
|
require "bundler/gem_tasks"
|
|
<% default_task_names = [config[:test_task]].compact -%>
|
|
<% case config[:test] -%>
|
|
<% when "minitest", "test-unit" -%>
|
|
require "rake/testtask"
|
|
|
|
Rake::TestTask.new(:test) do |t|
|
|
t.libs << "test"
|
|
t.libs << "lib"
|
|
t.test_files = FileList["test/**/*_test.rb"]
|
|
end
|
|
|
|
<% when "rspec" -%>
|
|
require "rspec/core/rake_task"
|
|
|
|
RSpec::Core::RakeTask.new(:spec)
|
|
|
|
<% end -%>
|
|
<% if config[:rubocop] -%>
|
|
<% default_task_names << :rubocop -%>
|
|
require "rubocop/rake_task"
|
|
|
|
RuboCop::RakeTask.new
|
|
|
|
<% end -%>
|
|
<% if config[:ext] -%>
|
|
<% default_task_names.unshift(:clobber, :compile) -%>
|
|
require "rake/extensiontask"
|
|
|
|
task build: :compile
|
|
|
|
Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
|
|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
|
|
end
|
|
|
|
<% end -%>
|
|
<% if default_task_names.size == 1 -%>
|
|
task default: <%= default_task_names.first.inspect %>
|
|
<% else -%>
|
|
task default: %i[<%= default_task_names.join(" ") %>]
|
|
<% end -%>
|