docker-rainbow 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/docker/rainbow.rb +9 -4
- data/lib/docker/rainbow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 746c45c4160ff3dfad98a8a1a8587e4aa5ffa0e6
|
4
|
+
data.tar.gz: 4e82aac522206cf8c791245db17659babeb1837c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5de446b922c8f7590feb487d190c3bfe428b37fa86af79f2a82f02812206c151fa04fd5827b40452ae51b262abaa6bdadc558b7a19fc58c1beb2d4c28b9161af
|
7
|
+
data.tar.gz: b20e1eb174fc45f39ff1bb12f6bd7a22385d6156086a28819c14628f76156a22ab8f3b2d0ccaeff0dae43eda9db8c94afa9ccb3898f4667855fde3a784e1a49a
|
data/lib/docker/rainbow.rb
CHANGED
@@ -26,6 +26,10 @@ module Docker
|
|
26
26
|
# of the world. (That's what `docker logs` is for...)
|
27
27
|
PALETTE = ['blue', 'green', 'orange', 'red', 'yellow', 'violet'].freeze
|
28
28
|
|
29
|
+
# Pattern that matches useless pieces of image names, which we exclude
|
30
|
+
# from the resulting containers' names. _Everything_ is a service...
|
31
|
+
NOISE_WORDS = /[_.-]service$/.freeze
|
32
|
+
|
29
33
|
# Pattern that matches any container name allowed by Docker.
|
30
34
|
VALID_NAME = /^[a-zA-Z0-9][a-zA-Z0-9_.-]+$/.freeze
|
31
35
|
|
@@ -126,7 +130,7 @@ module Docker
|
|
126
130
|
end
|
127
131
|
|
128
132
|
# Strip noise-word suffixes from image name
|
129
|
-
base.sub!(
|
133
|
+
base.sub!(NOISE_WORDS, '')
|
130
134
|
|
131
135
|
base
|
132
136
|
end
|
@@ -151,10 +155,11 @@ module Docker
|
|
151
155
|
output.each { |dead| self.class.shell("docker rm #{dead}") }
|
152
156
|
end
|
153
157
|
|
158
|
+
# @param [Array] containers list of String container names
|
159
|
+
# @return [Array] subset of containers that match a running container's name
|
154
160
|
def find_in_use(containers)
|
155
|
-
|
156
|
-
containers.
|
157
|
-
self.class.shell(words.join(' '))
|
161
|
+
in_use = Set.new(self.class.shell('docker ps --format={{.Names}}'))
|
162
|
+
containers.select { |cn| in_use.include?(cn) }
|
158
163
|
end
|
159
164
|
|
160
165
|
# Workalike for Object#present? but without dragging in activesupport
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker-rainbow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Spataro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|