docker-rainbow 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/Gemfile +5 -0
- data/README.md +1 -1
- data/docker-rainbow.gemspec +0 -4
- data/lib/docker/rainbow.rb +9 -6
- data/lib/docker/rainbow/version.rb +1 -1
- metadata +3 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53874c182fc3bca7cbbab389e13bdedeeec34401
|
4
|
+
data.tar.gz: bdd5584f3160167bc0904253a74d1782b8d59a73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a270a5b4ba594ebedb000a5299cba763c2314cbf3b8d77e87315fce3409b1afaa37f51177583ceacc8d0d882b5095b5df320e0e0f769fcc1c1106d8dbc1429df
|
7
|
+
data.tar.gz: 3bcef8cd04c69700cedd082007c010f72bc4b6e0ce3d3aee5f94df75e110495aec6eb1d990fbc6d54e0fba0cd15b2e9c48988e98ed6f40b77a6cc1a3d5ea1639
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -143,7 +143,7 @@ to be more opinionated about naming choices.
|
|
143
143
|
# Our full command is relevant to the container's personality; include
|
144
144
|
# every word, not just the first word! Also use periods to separate
|
145
145
|
# command words, not hyphens.
|
146
|
-
|
146
|
+
def cmd_suffix(cmd)
|
147
147
|
cmd.split(/[^A-Za-z0-9]+/).join('.')
|
148
148
|
end
|
149
149
|
end
|
data/docker-rainbow.gemspec
CHANGED
@@ -17,8 +17,4 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.bindir = "exe"
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.10"
|
22
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
-
spec.add_development_dependency "rspec"
|
24
20
|
end
|
data/lib/docker/rainbow.rb
CHANGED
@@ -78,6 +78,7 @@ module Docker
|
|
78
78
|
raise ArgumentError, "count must be > 0" unless count > 0
|
79
79
|
|
80
80
|
prefix = "#{@color}_#{base_name(image)}"
|
81
|
+
prefix = @prefix + prefix if @prefix
|
81
82
|
prefix = "#{prefix}_#{cmd_suffix(cmd)}" if present?(cmd)
|
82
83
|
|
83
84
|
result = []
|
@@ -99,15 +100,17 @@ module Docker
|
|
99
100
|
result
|
100
101
|
end
|
101
102
|
|
103
|
+
private
|
104
|
+
|
102
105
|
# Find a color that is not being used by any running container in our
|
103
106
|
# project. If all colors are in use, return the first color in the palette.
|
104
|
-
|
107
|
+
def choose_color
|
105
108
|
all = self.class.shell("docker ps --format={{.Names}}").compact
|
106
109
|
|
107
110
|
if @project
|
108
|
-
prefix = "#{project}_"
|
109
|
-
all.reject! { |n| !n.start_with?(prefix) }
|
110
|
-
all = all.map { |cn| cn[prefix.length..-1] }
|
111
|
+
@prefix = "#{@project}_"
|
112
|
+
all.reject! { |n| !n.start_with?(@prefix) }
|
113
|
+
all = all.map { |cn| cn[@prefix.length..-1] }
|
111
114
|
end
|
112
115
|
|
113
116
|
# Find colors that are in use
|
@@ -120,7 +123,7 @@ module Docker
|
|
120
123
|
|
121
124
|
# Given an image tag, derive a meaningful but terse "base name" for
|
122
125
|
# containers that will be launched from that image.
|
123
|
-
|
126
|
+
def base_name(image)
|
124
127
|
# Remove registry namespace (anything before the final slash)
|
125
128
|
# as well as tag.
|
126
129
|
if image.include?("/")
|
@@ -137,7 +140,7 @@ module Docker
|
|
137
140
|
|
138
141
|
# Transform a cmd into a valid container name fragment, or use it verbatim
|
139
142
|
# if it is already valid.
|
140
|
-
|
143
|
+
def cmd_suffix(cmd)
|
141
144
|
if cmd =~ VALID_NAME
|
142
145
|
cmd
|
143
146
|
else
|
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker-rainbow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Spataro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.10'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.10'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
55
13
|
description: Generates terse, meaningful, unique names for your Docker containers.
|
56
14
|
email:
|
57
15
|
- tony@rightscale.com
|