forked from ruby/did_you_mean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
61 lines (51 loc) · 1.19 KB
/
Rakefile
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'
def mri?
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_receiver"
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