-
Notifications
You must be signed in to change notification settings - Fork 67
/
Rakefile
78 lines (66 loc) · 1.74 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
require "rdoc/task"
require "bundler/gem_tasks"
spec = Bundler::GemHelper.gemspec
desc "Run test"
task :test do
ruby("test/run.rb")
end
task :default => :test
namespace :warning do
desc "Treat warning as error"
task :error do
def Warning.warn(*message, **)
super
raise "Treat warning as error:\n" + message.join("\n")
end
end
end
RDoc::Task.new do |rdoc|
rdoc.options = spec.rdoc_options
rdoc.rdoc_files.include(*spec.source_paths)
rdoc.rdoc_files.include(*spec.extra_rdoc_files)
end
load "#{__dir__}/tasks/tocs.rake"
benchmark_tasks = []
namespace :benchmark do
Dir.glob("benchmark/*.yaml").sort.each do |yaml|
name = File.basename(yaml, ".*")
env = {
"RUBYLIB" => nil,
"BUNDLER_ORIG_RUBYLIB" => nil,
}
command_line = [
RbConfig.ruby, "-v", "-S", "benchmark-driver", File.expand_path(yaml),
]
desc "Run #{name} benchmark"
task name do
puts("```")
sh(env, *command_line)
puts("```")
end
benchmark_tasks << "benchmark:#{name}"
case name
when /\Aparse/
namespace name do
desc "Run #{name} benchmark: small"
task :small do
puts("```")
sh(env.merge("N_ELEMENTS" => "500", "N_ATTRIBUTES" => "1"),
*command_line)
puts("```")
end
benchmark_tasks << "benchmark:#{name}:small"
end
end
end
end
desc "Run all benchmarks"
task :benchmark => benchmark_tasks
release_task = Rake.application["release"]
release_task.prerequisites.delete("build")
release_task.prerequisites.delete("release:rubygem_push")
release_task_comment = release_task.comment
if release_task_comment
release_task.clear_comments
release_task.comment = release_task_comment.gsub(/ and build.*$/, "")
end