kontena-cli 0.16.0.pre9 → 0.16.0.rc1

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: fa76bec3b6a5ed5df0158f25414e20867de2a4a9
4
- data.tar.gz: 37751c168d7c698026f87cc6399bc8a2d7a81f65
3
+ metadata.gz: 074582c5f337898b55470514cd0241dda4fd7186
4
+ data.tar.gz: f12755e0088565b92c5c0a670926cf5316392a28
5
5
  SHA512:
6
- metadata.gz: e58a8e4e643e9ca4abad3630d3f0bb68d6006504f27338e7cca4374c85dc8227a9c66a2606da26fc04092e5a076812ab02121f209126f4d3af71fe4e3e166dfe
7
- data.tar.gz: 834031757d11996be1724deffdd172fbc1dd2ef431b17792276a66000bdfcc35e434dbfe5002ca40aa66d38b239c03d5fc074b5d448f3df7b5bdee6da92a1cbc
6
+ metadata.gz: 5c53cc63797bea13a5a3b5b500e66b673763ca9af9eb4f78cb348a8a9a8990be9a048494b8aa3ce0384c54ef59f2e50d1fd8a8768b16bca84d11bd6790e8b832
7
+ data.tar.gz: 88e71e8730ec8d03001d3afc8d978cd917e28a5cbc00c782637e70a16fe4a4a275656fa4c50e0b325bcf29776a36d5d215746e12146bb2b0cebe377b622703ac
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.16.0.pre9
1
+ 0.16.0.rc1
data/kontena-cli.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_runtime_dependency "excon", "~> 0.49.0"
26
26
  spec.add_runtime_dependency "tty-prompt", "~> 0.7.1"
27
- spec.add_runtime_dependency "clamp", "~> 1.0.0"
27
+ spec.add_runtime_dependency "clamp", "~> 1.1.0"
28
28
  spec.add_runtime_dependency "ruby_dig", "~> 0.0.2"
29
29
  spec.add_runtime_dependency "launchy", "~> 2.4.3"
30
30
  spec.add_runtime_dependency "hash_validator", "~> 0.7.0"
@@ -50,6 +50,11 @@ module Kontena
50
50
 
51
51
  return nil if role_status.to_i > 0
52
52
 
53
+ spinner "Adding #{cloud_user_data[:email]} to grid 'test'" do |spin|
54
+ grid_add_status = Kontena.run("grid user add --grid test #{cloud_user_data[:email].shellescape}")
55
+ spin.fail if grid_add_status.to_i > 0
56
+ end
57
+
53
58
  new_user_token = nil
54
59
  spinner "Creating an access token for #{cloud_user_data[:email]}" do |spin|
55
60
  new_user_token = Kontena.run("master token create -e 0 -s user --return -u #{cloud_user_data[:email].shellescape}", returning: :result)
@@ -0,0 +1,9 @@
1
+ module Kontena::Cli
2
+ class RegisterCommand < Kontena::Command
3
+ include Kontena::Cli::Common
4
+
5
+ def execute
6
+ exit_with_error "The register command has been removed in this version. Visit https://cloud.kontena.io/sign-up to create a Kontena Cloud account or use: kontena cloud login"
7
+ end
8
+ end
9
+ end
@@ -25,9 +25,11 @@ require_relative 'cli/version_command'
25
25
  require_relative 'cli/stack_command'
26
26
  require_relative 'cli/certificate_command'
27
27
  require_relative 'cli/cloud_command'
28
+ require_relative 'cli/register_command'
28
29
 
29
30
  class Kontena::MainCommand < Kontena::Command
30
31
  include Kontena::Util
32
+ include Kontena::Cli::Common
31
33
 
32
34
  subcommand "cloud", "Kontena Cloud specific commands", Kontena::Cli::CloudCommand
33
35
  subcommand "logout", "Logout from Kontena Masters or Kontena Cloud accounts", Kontena::Cli::LogoutCommand
@@ -47,7 +49,8 @@ class Kontena::MainCommand < Kontena::Command
47
49
  subcommand "whoami", "Shows current logged in user", Kontena::Cli::WhoamiCommand
48
50
  subcommand "plugin", "Plugin related commands", Kontena::Cli::PluginCommand
49
51
  subcommand "version", "Show version", Kontena::Cli::VersionCommand
50
- subcommand "login", "Login to Kontena Master (removed, use kontena master login)", Kontena::Cli::LoginCommand
52
+ subcommand "login", "[DEPRECATED] Login to Kontena Master", Kontena::Cli::LoginCommand
53
+ subcommand "register", "[DEPRECATED] Register a Kontena Cloud account", Kontena::Cli::RegisterCommand
51
54
 
52
55
  def execute
53
56
  end
@@ -58,4 +61,16 @@ class Kontena::MainCommand < Kontena::Command
58
61
  def self.register(command, description, command_class)
59
62
  subcommand(command, description, command_class)
60
63
  end
64
+
65
+ def subcommand_missing(name)
66
+ if known_plugin_subcommand?(name)
67
+ exit_with_error "The '#{name}' plugin has not been installed. Use: kontena plugin install #{name}"
68
+ else
69
+ super(name)
70
+ end
71
+ end
72
+
73
+ def known_plugin_subcommand?(name)
74
+ ['vagrant', 'packet', 'digitalocean', 'azure', 'upcloud', 'aws'].include?(name)
75
+ end
61
76
  end
@@ -26,7 +26,7 @@ module Kontena
26
26
  else
27
27
  plugin_name = spec.name.sub('kontena-plugin-', '')
28
28
  STDERR.puts " [#{Kontena.pastel.red('error')}] Plugin #{Kontena.pastel.cyan(plugin_name)} (#{spec.version}) is not compatible with the current cli version."
29
- STDERR.puts " To update plugin, run 'kontena plugin install #{plugin_name}'"
29
+ STDERR.puts " To update the plugin, run 'kontena plugin install #{plugin_name}'"
30
30
  end
31
31
  rescue LoadError => exc
32
32
  STDERR.puts " [#{Kontena.pastel.red('error')}] Failed to load plugin: #{spec.name}"
@@ -0,0 +1,20 @@
1
+ require_relative "../../spec_helper"
2
+ require "kontena/main_command"
3
+
4
+ describe Kontena::MainCommand do
5
+
6
+ let(:subject) { described_class.new(File.basename($0)) }
7
+ describe '#subcommand_missing' do
8
+ it 'suggests plugin install for known plugin commands' do
9
+ expect(subject).to receive(:known_plugin_subcommand?).with('testplugin').and_return(true)
10
+ expect(subject).to receive(:exit_with_error).with(/plugin has not been installed/).and_raise(StandardError)
11
+ expect{subject.run(['testplugin', 'master', 'create'])}.to raise_error(StandardError)
12
+ end
13
+
14
+ it 'runs normal error handling for unknown sub commands' do
15
+ expect(subject).to receive(:known_plugin_subcommand?).with('testplugin').and_return(false)
16
+ expect{subject.run(['testplugin', 'master', 'create'])}.to raise_error(Clamp::UsageError)
17
+ end
18
+ end
19
+ end
20
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontena-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0.pre9
4
+ version: 0.16.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kontena, Inc
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.0.0
75
+ version: 1.1.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.0
82
+ version: 1.1.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: ruby_dig
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -313,6 +313,7 @@ files:
313
313
  - lib/kontena/cli/plugins/list_command.rb
314
314
  - lib/kontena/cli/plugins/search_command.rb
315
315
  - lib/kontena/cli/plugins/uninstall_command.rb
316
+ - lib/kontena/cli/register_command.rb
316
317
  - lib/kontena/cli/registry/create_command.rb
317
318
  - lib/kontena/cli/registry/delete_command.rb
318
319
  - lib/kontena/cli/registry/remove_command.rb
@@ -424,6 +425,7 @@ files:
424
425
  - spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
425
426
  - spec/kontena/cli/grids/use_command_spec.rb
426
427
  - spec/kontena/cli/helpers/log_helper_spec.rb
428
+ - spec/kontena/cli/main_command_spec.rb
427
429
  - spec/kontena/cli/master/current_command_spec.rb
428
430
  - spec/kontena/cli/master/logout_command_spec.rb
429
431
  - spec/kontena/cli/master/use_command_spec.rb
@@ -516,6 +518,7 @@ test_files:
516
518
  - spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb
517
519
  - spec/kontena/cli/grids/use_command_spec.rb
518
520
  - spec/kontena/cli/helpers/log_helper_spec.rb
521
+ - spec/kontena/cli/main_command_spec.rb
519
522
  - spec/kontena/cli/master/current_command_spec.rb
520
523
  - spec/kontena/cli/master/logout_command_spec.rb
521
524
  - spec/kontena/cli/master/use_command_spec.rb