forked from makandra/active_type
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
63 lines (52 loc) · 1.22 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
require 'rake'
require 'bundler/gem_tasks'
desc 'Default: Run all specs.'
task :default => 'all:spec'
desc "Run specs and isolated specs"
task :spec do
success = run_specs
fail "Tests failed" unless success
end
namespace :all do
desc "Run specs on all versions"
task :spec do
success = true
for_each_gemfile do
success &= run_specs
end
fail "Tests failed" unless success
end
desc "Bundle all versions"
task :install do
for_each_gemfile do
system('bundle install')
end
end
desc "Update all versions"
task :update do
for_each_gemfile do
system('bundle update')
end
end
end
def for_each_gemfile
version = ENV['VERSION'] || '*'
Dir["gemfiles/Gemfile.#{version}"].sort.each do |gemfile|
next if gemfile =~ /.lock/
puts '', "\033[44m#{gemfile}\033[0m", ''
ENV['BUNDLE_GEMFILE'] = gemfile
yield
end
end
def for_each_isolated_spec
Dir["spec/isolated/**/*_spec.rb"].sort.each do |isolated_spec|
yield(isolated_spec)
end
end
def run_specs
success = system("bundle exec rspec spec --exclude-pattern '**/isolated/**'")
for_each_isolated_spec do |isolated_spec|
success &= system("bundle exec rspec #{isolated_spec}")
end
success
end