-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
Rakefile
112 lines (98 loc) · 2.56 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
require 'bundler/gem_tasks'
#
# Prepend DevKit into compilation phase
#
if Gem.win_platform?
desc 'Activates DevKit'
task :devkit do
begin
require 'devkit'
rescue LoadError
abort 'Failed to load DevKit required for compilation'
end
end
task compile: :devkit
end
require 'rake/testtask'
if /java/ === RUBY_PLATFORM
# require 'rake/javaextensiontask'
# Rake::JavaExtensionTask.new(:hamlit) do |ext|
# ext.ext_dir = 'ext/java'
# ext.lib_dir = 'lib/hamlit'
# end
task :compile do
# dummy for now
end
else
require 'rake/extensiontask'
Rake::ExtensionTask.new(:hamlit) do |ext|
ext.lib_dir = 'lib/hamlit'
end
end
Dir['benchmark/*.rake'].each { |b| import(b) }
namespace :haml do
Rake::TestTask.new do |t|
t.libs << 'lib' << 'test'
files = Dir['test/haml/*_test.rb']
files << 'test/haml/haml-spec/*_test.rb'
t.ruby_opts = %w[-rtest_helper]
t.test_files = files
t.verbose = true
end
end
namespace :hamlit do
Rake::TestTask.new do |t|
t.libs << 'lib' << 'test'
t.ruby_opts = %w[-rtest_helper]
t.test_files = Dir['test/hamlit/**/*_test.rb']
t.verbose = true
end
end
namespace :test do
Rake::TestTask.new(:all) do |t|
t.libs << 'lib' << 'test'
files = Dir['test/hamlit/**/*_test.rb']
files += Dir['test/haml/*_test.rb']
files << 'test/haml/haml-spec/*_test.rb'
t.ruby_opts = %w[-rtest_helper]
t.test_files = files
t.verbose = true
end
Rake::TestTask.new(:spec) do |t|
t.libs << 'lib' << 'test'
t.ruby_opts = %w[-rtest_helper]
t.test_files = %w[test/haml/haml-spec/ugly_test.rb test/haml/haml-spec/pretty_test.rb]
t.verbose = true
end
Rake::TestTask.new(:engine) do |t|
t.libs << 'lib' << 'test'
t.ruby_opts = %w[-rtest_helper]
t.test_files = %w[test/haml/engine_test.rb]
t.verbose = true
end
Rake::TestTask.new(:filters) do |t|
t.libs << 'lib' << 'test'
t.ruby_opts = %w[-rtest_helper]
t.test_files = %w[test/haml/filters_test.rb]
t.verbose = true
end
Rake::TestTask.new(:helper) do |t|
t.libs << 'lib' << 'test'
t.ruby_opts = %w[-rtest_helper]
t.test_files = %w[test/haml/helper_test.rb]
t.verbose = true
end
Rake::TestTask.new(:template) do |t|
t.libs << 'lib' << 'test'
t.ruby_opts = %w[-rtest_helper]
t.test_files = %w[test/haml/template_test.rb]
t.verbose = true
end
end
desc 'bench task for CI'
task bench: :compile do
cmd = %w[bundle exec ruby benchmark/run-benchmarks.rb]
exit system(*cmd)
end
task default: %w[compile hamlit:test]
task test: %w[compile test:all]