-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rakefile
61 lines (44 loc) · 1.61 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
namespace :yard do
task :clean do
rm_rf '.yardoc'
end
task :server => :clean do
sh "yard server --reload"
end
end
task :clean => 'yard:clean'
gemset_name = 'zk-server'
%w[1.8.7 1.9.2 jruby 1.9.3].each do |ns_name|
rvm_ruby = (ns_name == 'rbx') ? "rbx-2.0.testing" : ns_name
ruby_with_gemset = "#{rvm_ruby}@#{gemset_name}"
create_gemset_task_name = "mb:#{ns_name}:create_gemset"
bundle_task_name = "mb:#{ns_name}:bundle_install"
rspec_task_name = "mb:#{ns_name}:run_rspec"
phony_gemfile_link_name = "Gemfile.#{ns_name}"
phony_gemfile_lock_name = "#{phony_gemfile_link_name}.lock"
file phony_gemfile_link_name do
# apparently, rake doesn't deal with symlinks intelligently :P
ln_s('Gemfile', phony_gemfile_link_name) unless File.symlink?(phony_gemfile_link_name)
end
task :clean do
rm_rf [phony_gemfile_lock_name, phony_gemfile_lock_name]
end
task create_gemset_task_name do
sh "rvm #{rvm_ruby} do rvm gemset create #{gemset_name}"
end
task bundle_task_name => [phony_gemfile_link_name, create_gemset_task_name] do
sh "rvm #{ruby_with_gemset} do bundle install --gemfile #{phony_gemfile_link_name}"
end
task rspec_task_name => bundle_task_name do
sh "rvm #{ruby_with_gemset} do env JRUBY_OPTS='--1.9' BUNDLE_GEMFILE=#{phony_gemfile_link_name} bundle exec rspec spec --fail-fast"
end
task "mb:#{ns_name}" => rspec_task_name
task "mb:test_all_rubies" => rspec_task_name
end
task 'mb:test_all' do
require 'benchmark'
tm = Benchmark.realtime do
Rake::Task['mb:test_all_rubies'].invoke
end
$stderr.puts "Test run took: #{tm}"
end