Sha256: b3a751248fd76a67d40ea9973b4f13a41d1f4bbd7714b9d0b38a73331e403353

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

require 'bundler/gem_tasks'
require 'rake/testtask'

Rake::TestTask.new do |task|
  task.libs << "test"

  task.test_files = Dir['test/**/*_test.rb'].reject do |path|
    /(verbose_formatter|experimental)/ =~ path
  end

  task.verbose = true
  task.warning = true
end

Rake::TestTask.new("test:verbose_formatter") do |task|
  task.libs << "test"
  task.pattern = 'test/verbose_formatter_test.rb'
  task.verbose = true
  task.warning = true
  task.ruby_opts << "-rdid_you_mean/verbose_formatter"
end

Rake::TestTask.new("test:experimental") do |task|
  task.libs << "test"
  task.pattern = 'test/experimental/**/*_test.rb'
  task.verbose = true
  task.warning = true
  task.ruby_opts << "-rdid_you_mean/experimental"
end

if RUBY_ENGINE != 'jruby'
  task default: %i(test test:verbose_formatter test:experimental)
else
  task default: %i(test test:verbose_formatter)
end


namespace :test do
  namespace :accuracy do
    desc "Download Wiktionary's Simple English data and save it as a dictionary"
    task :prepare do
      sh 'ruby evaluation/dictionary_generator.rb'
    end
  end

  desc "Calculate accuracy of the gems' spell checker"
  task :accuracy do
    if !File.exist?("evaluation/dictionary.yml")
      puts 'Generating dictionary for evaluation:'
      Rake::Task["test:accuracy:prepare"].execute
      puts "\n"
    end

    sh 'bundle exec ruby evaluation/calculator.rb'
  end
end

namespace :benchmark do
  desc "Measure memory usage by the did_you_mean gem"
  task :memory do
    sh 'bundle exec ruby benchmark/memory_usage.rb'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
did_you_mean-1.0.4 Rakefile
did_you_mean-1.0.3 Rakefile
did_you_mean-1.0.2 Rakefile