-
Notifications
You must be signed in to change notification settings - Fork 14
/
Rakefile
40 lines (32 loc) · 990 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
36
37
38
39
40
require 'ritual'
ruby_engine = (Object.const_defined?(:RUBY_ENGINE) ? RUBY_ENGINE : 'ruby')
if ruby_engine == 'jruby'
extension :type => :jruby, :path => 'ext/jruby', :install_as => "lib/looksee/JRuby"
else
name = ruby_engine == 'ruby' ? 'mri' : ruby_engine
extension :build_as => "ext/#{name}", :install_as => "lib/looksee/#{name}"
end
task :default => [:clobber, :ext] do
sh 'bundle exec rspec -I. spec'
end
task :test_all do
docker_configs.each do |config|
docker_run(config, 'rspec')
end
end
task :console, :config do |task, args|
docker_run(args[:config], nil)
end
task :test, :config do |task, args|
docker_run(args[:config], 'rspec')
end
task :shell, :config do |task, args|
docker_run(args[:config], '/bin/bash')
end
def docker_configs
Dir['Dockerfile.*'].map { |path| path[/(?<=\.).*?\z/] }
end
def docker_run(config, command)
sh "docker build -f Dockerfile.#{config} -t looksee:#{config} ."
sh "docker run -it looksee:#{config} #{command}"
end