kontena-cli 0.8.0 → 0.8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/kontena/cli/register_command.rb +4 -2
- data/spec/kontena/cli/register_command_spec.rb +15 -15
- 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: 1bfab587091d57799af6a71901b2e06c2fdccfe2
|
4
|
+
data.tar.gz: a10b356b3daa4b7f0850754e5b89739daaf4dfba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12161c21f23669c889f91437c0b4979fb801f78ed015b8aa2b46b38d41b01782cfd7b0f4cd4548c1ecff0eb0e520dbe4230fe5269da1a5dc207ab2777674a299
|
7
|
+
data.tar.gz: bbe4051f32249124285e39426fc50075acc123865ad4e886ab875f65cbf2aad4cb27524f23c9d2b50791f323486d42cdcae07cd16d702f3c782caf841159ba29
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.0
|
1
|
+
0.8.0.1
|
@@ -4,13 +4,15 @@ class Kontena::Cli::RegisterCommand < Clamp::Command
|
|
4
4
|
option "--auth-provider-url", "AUTH_PROVIDER_URL", "Auth provider URL"
|
5
5
|
|
6
6
|
def execute
|
7
|
+
require 'highline/import'
|
8
|
+
|
7
9
|
auth_api_url = auth_provider_url || 'https://auth.kontena.io'
|
8
10
|
if !auth_api_url.start_with?('http://') && !auth_api_url.start_with?('https://')
|
9
11
|
auth_api_url = "https://#{auth_api_url}"
|
10
12
|
end
|
11
13
|
email = ask("Email: ")
|
12
|
-
password =
|
13
|
-
password2 =
|
14
|
+
password = ask("Password: ") { |q| q.echo = "*" }
|
15
|
+
password2 = ask("Password again: ") { |q| q.echo = "*" }
|
14
16
|
if password != password2
|
15
17
|
abort("Passwords don't match".colorize(:red))
|
16
18
|
end
|
@@ -11,44 +11,44 @@ describe Kontena::Cli::RegisterCommand do
|
|
11
11
|
let(:subject) { described_class.new(File.basename($0)) }
|
12
12
|
|
13
13
|
it 'asks password twice' do
|
14
|
-
allow(subject).to receive(:ask).
|
15
|
-
expect(subject).to receive(:
|
16
|
-
expect(subject).to receive(:
|
14
|
+
allow(subject).to receive(:ask).with('Email: ').once.and_return('john.doe@acme.io')
|
15
|
+
expect(subject).to receive(:ask).with('Password: ').once.and_return('secret')
|
16
|
+
expect(subject).to receive(:ask).with('Password again: ').once.and_return('secret')
|
17
17
|
allow(Kontena::Client).to receive(:new).and_return(auth_client)
|
18
18
|
allow(auth_client).to receive(:post)
|
19
19
|
subject.run([])
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'validates given passwords' do
|
23
|
-
allow(subject).to receive(:ask).
|
24
|
-
expect(subject).to receive(:
|
25
|
-
expect(subject).to receive(:
|
23
|
+
allow(subject).to receive(:ask).with('Email: ').once.and_return('john.doe@acme.io')
|
24
|
+
expect(subject).to receive(:ask).with('Password: ').once.and_return('secret')
|
25
|
+
expect(subject).to receive(:ask).with('Password again: ').once.and_return('secret2')
|
26
26
|
expect{subject.run([])}.to raise_error(SystemExit)
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'uses https://auth.kontena.io as default auth provider' do
|
30
30
|
allow(subject).to receive(:ask).and_return('john.doe@acme.io')
|
31
|
-
allow(subject).to receive(:ask).
|
32
|
-
expect(subject).to receive(:
|
33
|
-
expect(subject).to receive(:
|
31
|
+
allow(subject).to receive(:ask).with('Email: ').once.and_return('john.doe@acme.io')
|
32
|
+
expect(subject).to receive(:ask).with('Password: ').once.and_return('secret')
|
33
|
+
expect(subject).to receive(:ask).with('Password again: ').once.and_return('secret')
|
34
34
|
expect(Kontena::Client).to receive(:new).with('https://auth.kontena.io').and_return(auth_client)
|
35
35
|
allow(auth_client).to receive(:post)
|
36
36
|
subject.run([])
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'uses given auth provider' do
|
40
|
-
allow(subject).to receive(:ask).and_return('john.doe@acme.io')
|
41
|
-
expect(subject).to receive(:
|
42
|
-
expect(subject).to receive(:
|
40
|
+
allow(subject).to receive(:ask).with('Email: ').once.and_return('john.doe@acme.io')
|
41
|
+
expect(subject).to receive(:ask).with('Password: ').once.and_return('secret')
|
42
|
+
expect(subject).to receive(:ask).with('Password again: ').once.and_return('secret')
|
43
43
|
expect(Kontena::Client).to receive(:new).with('http://custom.auth-provider.io').and_return(auth_client)
|
44
44
|
allow(auth_client).to receive(:post)
|
45
45
|
subject.run(['--auth-provider-url', 'http://custom.auth-provider.io'])
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'sends register request to auth provider' do
|
49
|
-
allow(subject).to receive(:ask).and_return('john.doe@acme.io')
|
50
|
-
expect(subject).to receive(:
|
51
|
-
expect(subject).to receive(:
|
49
|
+
allow(subject).to receive(:ask).with('Email: ').once.and_return('john.doe@acme.io')
|
50
|
+
expect(subject).to receive(:ask).with('Password: ').once.and_return('secret')
|
51
|
+
expect(subject).to receive(:ask).with('Password again: ').once.and_return('secret')
|
52
52
|
allow(Kontena::Client).to receive(:new).with('https://auth.kontena.io').and_return(auth_client)
|
53
53
|
expect(auth_client).to receive(:post).with('users', {email: 'john.doe@acme.io', password: 'secret'})
|
54
54
|
subject.run([])
|
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: 0.8.0
|
4
|
+
version: 0.8.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kontena, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|