-
Notifications
You must be signed in to change notification settings - Fork 19
/
Rakefile
35 lines (31 loc) · 878 Bytes
/
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
dockerfiles = Dir.glob(File.join("*", "Dockerfile"))
containers = dockerfiles.map { |f| File.dirname(f) }
namespace :build do |ns|
containers.each { |container|
desc "Build #{container} image"
task container.to_sym do
system "cd #{container} && docker build -t #{container} ." or abort
end
}
desc "Build all containers"
task :all do
ns.tasks.each { |t| t.invoke }
end
end
namespace :spec do |ns|
require 'rspec/core/rake_task'
containers.each { |container|
spec_pattern = File.join(container, "**", "*_spec.rb")
if Dir.glob(spec_pattern).any?
desc "Run all specs for #{container}"
RSpec::Core::RakeTask.new(container) do |t|
t.pattern = spec_pattern
end
end
}
desc "Run all containers spec"
task :all do
ns.tasks.each { |t| t.invoke }
end
end
task :default => [ "build:all", "spec:all" ]