forked from geku/docker-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
33 lines (26 loc) · 726 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
require "bundler/gem_tasks"
require 'rspec/core/rake_task'
require 'docker'
RSpec::Core::RakeTask.new(:spec) do |t|
# Documentation output
# Disable live tests
t.rspec_opts = "-f d -t ~live"
end
# Only run focus examples
RSpec::Core::RakeTask.new(:focus) do |t|
t.rspec_opts = "-f d -t focus"
end
task :default => :spec
namespace :docker do
desc "Stop and delete all Docker containers"
task :cleanup do
container = Docker::API.new(base_url: 'http://10.0.5.5:4243').containers
counter = 0
container.list(all: true).each do |c|
puts "Delete container #{c['Id']}"
container.remove(c['Id'])
counter += 1
end
puts "Total of #{counter} containers deleted"
end
end