forked from github/hoosegow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
38 lines (31 loc) · 872 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
require_relative 'lib/hoosegow'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
begin
require_relative 'config'
rescue LoadError
CONFIG = {}
end
inmate_dir = File.join(File.dirname(__FILE__), 'spec', 'test_inmate')
CONFIG[:inmate_dir] = inmate_dir
CONFIG[:image_name] = Hoosegow.new(CONFIG).image_name
RSpec::Core::RakeTask.new(:spec)
Rake::Task[:spec].prerequisites << :bootstrap_docker
task :default => :spec
def hoosegow
@hoosgow ||= Hoosegow.new CONFIG
end
desc "Benchmark render_reverse run in docker"
task :benchmark => :bootstrap_docker do
10.times do |i|
sleep 0.5
start = Time.now
hoosegow.render_reverse "foobar"
puts "render_reverse run ##{i} took #{Time.now - start} seconds"
end
hoosegow.cleanup
end
desc "Building docker image."
task :bootstrap_docker do
hoosegow.build_image unless hoosegow.image_exists?
end