Sha256: 08ba7df9e83deb567a91bc3d025b5db2fae6221afa712daf5ea7ebf63cd79ed6

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

require 'bundler/gem_tasks'

def mri?
  defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby"
end

def jruby?
  defined?(JRuby)
end

desc "run tests"
task default: [:test]

if mri? || jruby?
  if mri?
    require 'rake/extensiontask'

    Rake::ExtensionTask.new('did_you_mean') do |ext|
      ext.name    = "method_missing"
      ext.lib_dir = "lib/did_you_mean"
    end
  elsif jruby?
    require 'rake/javaextensiontask'

    Rake::JavaExtensionTask.new('did_you_mean') do |ext|
      ext.name    = "receiver_capturer"
      ext.lib_dir = "lib/did_you_mean"
    end
  end

  desc "Run tests"
  task :test do
    Rake::Task['compile'].reenable
    Rake::Task['compile'].invoke

    begin
      $stdout.puts("\033[33m")
      sh "bundle exec ruby test/all_test.rb"
    ensure
      $stdout.puts("\033[0m")
    end

    Rake::Task['clobber'].execute
  end

  namespace :test do
    desc "Run tests without re-compiling extensions"
    task :without_compile do
      $stdout.puts("\033[33m")
      sh "bundle exec ruby test/all_test.rb"
      $stdout.puts("\033[0m")
    end
  end
else # for Rubinius
  desc "Run tests"
  task :test do
    $stdout.puts("\033[33m")
    sh "bundle exec ruby test/all_test.rb"
    $stdout.puts("\033[0m")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
did_you_mean-0.9.8 Rakefile
did_you_mean-0.9.7 Rakefile
did_you_mean-0.9.6-java Rakefile
did_you_mean-0.9.6 Rakefile
did_you_mean-0.9.5 Rakefile
did_you_mean-0.9.4 Rakefile
did_you_mean-0.9.2 Rakefile
did_you_mean-0.9.0 Rakefile