This repository has been archived by the owner on Nov 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Rakefile
56 lines (49 loc) · 1.32 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
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'HerokuTrueRelic'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
Bundler::GemHelper.install_tasks
desc 'Default: Run all specs.'
task :default => 'all:spec'
namespace :all do
desc "Run specs on all spec apps"
task :spec do
for_each_directory_of('spec/**/Rakefile', "Failed to run specs") do |directory|
system("BUNDLE_GEMFILE='./Gemfile' bundle exec rake spec")
end
end
desc "Bundle all spec apps"
task :bundle do
for_each_directory_of('spec/**/Gemfile', 'Failed to bundle') do |directory|
system("BUNDLE_GEMFILE='./Gemfile' bundle install")
end
end
end
def for_each_directory_of(path, fail_msg, &block)
results = Dir[path].sort.map do |file|
directory = File.dirname(file)
puts '', "\033[44m#{directory}\033[0m", ''
result = nil
Dir.chdir(directory) do
result = block.call(directory)
end
result
end
fail fail_msg unless results.all?
end