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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 746c45c4160ff3dfad98a8a1a8587e4aa5ffa0e6
4
- data.tar.gz: 4e82aac522206cf8c791245db17659babeb1837c
3
+ metadata.gz: 53874c182fc3bca7cbbab389e13bdedeeec34401
4
+ data.tar.gz: bdd5584f3160167bc0904253a74d1782b8d59a73
5
5
  SHA512:
6
- metadata.gz: 5de446b922c8f7590feb487d190c3bfe428b37fa86af79f2a82f02812206c151fa04fd5827b40452ae51b262abaa6bdadc558b7a19fc58c1beb2d4c28b9161af
7
- data.tar.gz: b20e1eb174fc45f39ff1bb12f6bd7a22385d6156086a28819c14628f76156a22ab8f3b2d0ccaeff0dae43eda9db8c94afa9ccb3898f4667855fde3a784e1a49a
6
+ metadata.gz: a270a5b4ba594ebedb000a5299cba763c2314cbf3b8d77e87315fce3409b1afaa37f51177583ceacc8d0d882b5095b5df320e0e0f769fcc1c1106d8dbc1429df
7
+ data.tar.gz: 3bcef8cd04c69700cedd082007c010f72bc4b6e0ce3d3aee5f94df75e110495aec6eb1d990fbc6d54e0fba0cd15b2e9c48988e98ed6f40b77a6cc1a3d5ea1639
@@ -1,4 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
4
- before_install: gem install bundler -v 1.10.6
3
+ - 2.0
4
+ - 2.1
5
+ - 2.2
6
+ before_install: gem install bundler -v '~> 1.12'
data/Gemfile CHANGED
@@ -2,3 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in docker-rainbow.gemspec
4
4
  gemspec
5
+
6
+ group :development do
7
+ gem 'rake'
8
+ gem 'rspec'
9
+ end
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
- private def cmd_suffix(cmd)
146
+ def cmd_suffix(cmd)
147
147
  cmd.split(/[^A-Za-z0-9]+/).join('.')
148
148
  end
149
149
  end
@@ -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
@@ -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
- private def choose_color
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
- private def base_name(image)
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
- private def cmd_suffix(cmd)
143
+ def cmd_suffix(cmd)
141
144
  if cmd =~ VALID_NAME
142
145
  cmd
143
146
  else
@@ -1,5 +1,5 @@
1
1
  module Docker
2
2
  class Rainbow
3
- VERSION = "0.1.6"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
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.1.6
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: 2015-12-23 00:00:00.000000000 Z
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