# -*- mode: ruby; coding: utf-8 -*-
# frozen_string_literal: true

# Rakefile for ITK package.

task default: %w[test]

# Testing with Minitest

require 'rake/testtask'
Rake::TestTask.new do |t|
  spec_files = FileList['spec/**/*_spec.rb']
  t.test_files = %w[spec/spec_helper.rb] + spec_files
  t.verbose = true
  t.warning = false
end


# Gem packaging

require 'rubygems/package_task'

load 'itk.gemspec'
Gem::PackageTask.new(ITK_GEM) do |pkg|
  pkg.need_zip = false
  pkg.need_tar = false
end


# Documentation with YARD

require 'yard'
require 'yard/rake/yardoc_task'

YARD::Rake::YardocTask.new(:doc) do |task| # uses .yardopts
  task.stats_options = %w[--list-undoc --compact]
end


# StyleGuide/Ruby checks with Rubocop

begin
  require 'rubocop/rake_task'
  RuboCop::RakeTask.new(:lint) do |task|
    task.patterns =
      ITK_GEM.files - %w[.yardopts .rubocop.yml README.md]
    task.verbose = true
    task.options = %w[--debug]
  end
rescue LoadError
  warn '(no rubocop support)'
end


# This Gem was originally generated by 'mkstuff gem', here's how to re-run it:

desc 'Regenerate the Gem boiler-plate files'
task :mkstuff do
  # rubocop:disable Style/StringLiterals
  system 'mkstuff', "gem", "--author", "Christian Boos", "-m", "ITK", "itk"
  # rubocop:enable Style/StringLiterals
end
