1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
require "bundler/gem_tasks"
# Override release task to skip gem push (handled by GitHub Actions with attestations)
Rake::Task["release"].clear
desc "Build gem and create tag (gem push handled by CI)"
task release: %w[build release:guard_clean release:source_control_push]
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
end
require "standard/rake"
require "rubocop/rake_task"
RuboCop::RakeTask.new
require "yard"
YARD::Rake::YardocTask.new do |task|
task.files = ["lib/**/*.rb", "-", "LICENSE.md"]
task.options = [
"--no-private",
"--protected",
"--output-dir", "doc/yard",
"--markup", "markdown"
]
end
require "yardstick/rake/measurement"
Yardstick::Rake::Measurement.new do |measurement|
measurement.output = "measurement/report.txt"
end
require "yardstick/rake/verify"
Yardstick::Rake::Verify.new do |verify|
verify.threshold = 100
end
# Steep requires native extensions not available on JRuby or Windows
unless RUBY_PLATFORM == "java" || Gem.win_platform?
require "steep/rake_task"
Steep::RakeTask.new
end
desc "Run linters"
task lint: %i[rubocop standard]
# Mutant uses fork() which is not available on Windows or JRuby
desc "Run mutation testing"
task :mutant do
if Gem.win_platform? || RUBY_PLATFORM == "java"
puts "Skipping mutant on Windows/JRuby (fork not supported)"
else
system("bundle", "exec", "mutant", "run") || exit(1)
end
end
default_tasks = %i[test lint verify_measurements mutant]
default_tasks << :steep unless RUBY_PLATFORM == "java" || Gem.win_platform?
task default: default_tasks
|