kontena-cli 1.1.2.rc1 → 1.1.2.rc2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d73f838d7604f63336bf79e2ab6c044767e3501
|
4
|
+
data.tar.gz: f92c2116744c5dd0745292865aa95211263a2604
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 936f1d240681d63ffe2ad4e9f10575d4f7d118dfe69e447745c16f04c56a5d2642d88298767067073e1020d370250bffb55f504c6ab54f8a45e649cba9a82546
|
7
|
+
data.tar.gz: 340f1fdb9898f45d5cd813971dadb46611afe46d624db9ad9faf8e779a269e60aeda9ecc8a10489a1de06c6e2b420b77201386b244cee4772f3ba81ddf22fd3f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.2.
|
1
|
+
1.1.2.rc2
|
@@ -32,10 +32,13 @@ module Kontena::Cli::Stacks::YAML::Opto::Resolvers
|
|
32
32
|
# @return [Integer]
|
33
33
|
def default_index(services)
|
34
34
|
index = services.index {|s| service_link(s) == option.default }
|
35
|
-
|
36
|
-
|
35
|
+
|
36
|
+
if index && !option.required?
|
37
|
+
index + 2 # extra offset for the initial <none> option
|
38
|
+
elsif index
|
39
|
+
index + 1 # menu index starts from 1
|
37
40
|
else
|
38
|
-
0
|
41
|
+
0 # XXX: this just explodes?
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
@@ -24,31 +24,54 @@ describe Kontena::Cli::Stacks::YAML::Opto::Resolvers::ServiceLink do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
27
|
+
context "For a required option with a default value" do
|
28
28
|
let(:option) do
|
29
|
-
::Opto::Option.new(default: 'foo/bar')
|
29
|
+
::Opto::Option.new(type: 'string', name: 'link', default: 'foo/bar')
|
30
30
|
end
|
31
31
|
let(:subject) do
|
32
32
|
described_class.new({'prompt' => 'foo'}, option)
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
describe '#default_index' do
|
36
|
+
it 'returns matching index' do
|
37
|
+
services = [
|
38
|
+
{'id' => 'test/foo/foo'},
|
39
|
+
{'id' => 'test/foo/bar'},
|
40
|
+
{'id' => 'test/asd/asd'}
|
41
|
+
]
|
42
|
+
index = subject.default_index(services)
|
43
|
+
expect(index).to eq(2)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns 0 if no matches' do
|
47
|
+
services = [
|
48
|
+
{'id' => 'test/foo/foo'},
|
49
|
+
{'id' => 'test/asd/asd'}
|
50
|
+
]
|
51
|
+
index = subject.default_index(services)
|
52
|
+
expect(index).to eq(0)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "For an optional option with a default value" do
|
58
|
+
let(:option) do
|
59
|
+
::Opto::Option.new(type: 'string', name: 'link', default: 'foo/bar', required: false)
|
60
|
+
end
|
61
|
+
let(:subject) do
|
62
|
+
described_class.new({'prompt' => 'foo'}, option)
|
43
63
|
end
|
44
64
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
65
|
+
describe '#default_index' do
|
66
|
+
it 'returns matching index' do
|
67
|
+
services = [
|
68
|
+
{'id' => 'test/foo/foo'},
|
69
|
+
{'id' => 'test/foo/bar'},
|
70
|
+
{'id' => 'test/asd/asd'}
|
71
|
+
]
|
72
|
+
index = subject.default_index(services)
|
73
|
+
expect(index).to eq(3)
|
74
|
+
end
|
52
75
|
end
|
53
76
|
end
|
54
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kontena-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.2.
|
4
|
+
version: 1.1.2.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kontena, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|