civo_cli 0.3.12 → 0.3.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ce4a126792b8b4ac0aab10f94c62a04c2dbf3a161c41e824f5bed5b8df3ce25
4
- data.tar.gz: 93f53e2c44d58df69aa5b5bf8f660d79cb3c7f0ffb117cbf50c28017cda92662
3
+ metadata.gz: 0abd838b80a7091c2c4303aac03c4ce07899d038f0663e14996112976834fb3b
4
+ data.tar.gz: ad179d84288f5a9848b05abef1fa8be0c57f681eb76128a4353b1dec682f29c8
5
5
  SHA512:
6
- metadata.gz: 869a5732dc585cf5133c571b1966bfc8842435dbd6cb47980413c6787376022604c22e0e107e2d7180850587d87804ccf8793f5059f0251d8ae78f0ca4993cf2
7
- data.tar.gz: '0993d994f2c1d0feb1e956b35fc0eebd001d00bf769ade9dfac886dbfb2fa13ec57734cfd780dc074c6e4bedabb885dcd32d99d677e8b8a04f3dcb8df76ad5e5'
6
+ metadata.gz: 9db96461a2f75ec8116cc3b3914b0278694fd416d997ca79c9ac649c26edb42d7b4436dfaef65b3ba93329cbb908125c02c92bbacd2e22a973d3c23b52e399df
7
+ data.tar.gz: ead03aead4578bc8b118e2d6260ba9f74a79536b8888c383964c9a750634f9799cd4afdee0761257286d7feb9a97c6e5c8cd3d441c02b4e4496329dc14638bc1
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@ All notable changes to the Civo CLI will be documented in this file.
3
3
 
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [0.3.13] - 2019-08-28
7
+ ### Fixed
8
+ - Was missing a file for Kubernetes marketplace applications
9
+
6
10
  ## [0.3.12] - 2019-08-28
7
11
  ### Added
8
12
  - Support for Kubernetes marketplace applications
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- civo_cli (0.3.12)
4
+ civo_cli (0.3.13)
5
5
  bundler (~> 1.17)
6
6
  civo (>= 1.2.8)
7
7
  colorize
@@ -34,7 +34,7 @@ GEM
34
34
  diff-lcs (1.3)
35
35
  faraday (0.15.4)
36
36
  multipart-post (>= 1.2, < 3)
37
- ffi (1.10.0)
37
+ ffi (1.11.1)
38
38
  flexirest (1.7.9)
39
39
  activesupport
40
40
  crack
@@ -55,7 +55,7 @@ GEM
55
55
  guard (~> 2.1)
56
56
  guard-compat (~> 1.1)
57
57
  rspec (>= 2.99.0, < 4.0)
58
- hashdiff (0.3.8)
58
+ hashdiff (1.0.0)
59
59
  highline (2.0.2)
60
60
  i18n (1.6.0)
61
61
  concurrent-ruby (~> 1.0)
@@ -70,14 +70,14 @@ GEM
70
70
  multi_json (1.13.1)
71
71
  multipart-post (2.1.1)
72
72
  nenv (0.3.0)
73
- notiffany (0.1.1)
73
+ notiffany (0.1.3)
74
74
  nenv (~> 0.1)
75
75
  shellany (~> 0.0)
76
76
  parslet (1.8.2)
77
77
  pry (0.12.2)
78
78
  coderay (~> 1.1.0)
79
79
  method_source (~> 0.9.0)
80
- public_suffix (3.0.3)
80
+ public_suffix (3.1.1)
81
81
  rake (10.5.0)
82
82
  rb-fsevent (0.10.3)
83
83
  rb-inotify (0.10.0)
@@ -86,15 +86,15 @@ GEM
86
86
  rspec-core (~> 3.8.0)
87
87
  rspec-expectations (~> 3.8.0)
88
88
  rspec-mocks (~> 3.8.0)
89
- rspec-core (3.8.0)
89
+ rspec-core (3.8.2)
90
90
  rspec-support (~> 3.8.0)
91
- rspec-expectations (3.8.2)
91
+ rspec-expectations (3.8.4)
92
92
  diff-lcs (>= 1.2.0, < 2.0)
93
93
  rspec-support (~> 3.8.0)
94
- rspec-mocks (3.8.0)
94
+ rspec-mocks (3.8.1)
95
95
  diff-lcs (>= 1.2.0, < 2.0)
96
96
  rspec-support (~> 3.8.0)
97
- rspec-support (3.8.0)
97
+ rspec-support (3.8.2)
98
98
  ruby_dep (1.5.0)
99
99
  safe_yaml (1.0.5)
100
100
  shellany (0.0.1)
@@ -108,10 +108,10 @@ GEM
108
108
  tzinfo (1.2.5)
109
109
  thread_safe (~> 0.1)
110
110
  unicode-display_width (1.6.0)
111
- webmock (3.5.1)
111
+ webmock (3.7.0)
112
112
  addressable (>= 2.3.6)
113
113
  crack (>= 0.3.2)
114
- hashdiff
114
+ hashdiff (>= 0.4.0, < 2.0.0)
115
115
  zeitwerk (2.1.9)
116
116
 
117
117
  PLATFORMS
@@ -1,3 +1,3 @@
1
1
  module CivoCLI
2
- VERSION = "0.3.12"
2
+ VERSION = "0.3.13"
3
3
  end
data/lib/finder.rb ADDED
@@ -0,0 +1,36 @@
1
+ class Finder
2
+ def self.detect_cluster(id)
3
+ result = []
4
+ Civo::Kubernetes.all.items.each do |cluster|
5
+ result << cluster
6
+ end
7
+ result.select! { |cluster| cluster.name.include?(id) || cluster.id.include?(id) }
8
+
9
+ if result.count.zero?
10
+ puts "No Kubernetes clusters found for '#{id}'. Please check your query."
11
+ exit 1
12
+ elsif result.count > 1
13
+ puts "Multiple possible Kubernetes clusters found for '#{id}'. Please try with a more specific query."
14
+ exit 1
15
+ else
16
+ result[0]
17
+ end
18
+ end
19
+
20
+ def self.detect_app(name)
21
+ result = []
22
+ Civo::Kubernetes.applications.items.each do |app|
23
+ result << app if app.name.downcase.include?(name)
24
+ end
25
+
26
+ if result.count.zero?
27
+ puts "No Kubernetes marketplace applications found for '#{name}'. Please check your query."
28
+ exit 1
29
+ elsif result.count > 1
30
+ puts "Multiple possible Kubernetes marketplace applications found for '#{name}'. Please try with a more specific query."
31
+ exit 1
32
+ else
33
+ result[0]
34
+ end
35
+ end
36
+ end
data/lib/kubernetes.rb CHANGED
@@ -26,7 +26,6 @@ module CivoCLI
26
26
  CivoCLI::Config.set_api_auth
27
27
  rows = []
28
28
  cluster = Finder.detect_cluster(id)
29
- puts cluster.inspect
30
29
 
31
30
  puts " ID : #{cluster.id}"
32
31
  puts " Name : #{cluster.name}"
@@ -0,0 +1,74 @@
1
+ require 'tempfile'
2
+
3
+ module CivoCLI
4
+ class KubernetesApplications < Thor
5
+ desc "list", "list all available kubernetes applications"
6
+ option :quiet, type: :boolean, aliases: '-q'
7
+ def list
8
+ CivoCLI::Config.set_api_auth
9
+ if options[:quiet]
10
+ Civo::Kubernetes.applications.items.each do |app|
11
+ puts "#{app.name} (#{app.version}, #{app.category})"
12
+ end
13
+ else
14
+ rows = []
15
+ Civo::Kubernetes.applications.items.each do |app|
16
+ rows << [app.name, app.version, app.category]
17
+ end
18
+ puts Terminal::Table.new headings: ['Name', 'Version', 'Category'], rows: rows
19
+ end
20
+ rescue Flexirest::HTTPForbiddenClientException
21
+ reject_user_access
22
+ end
23
+ map "ls" => "list", "all" => "list"
24
+
25
+
26
+ desc "show NAME", "show a Kubernetes application by name"
27
+ def show(name)
28
+ CivoCLI::Config.set_api_auth
29
+ rows = []
30
+ app = Finder.detect_app(name)
31
+
32
+ puts " Name : #{app.name}"
33
+ puts " Version : #{app.version}"
34
+ puts " Category : #{app.category}"
35
+ puts " Maintainer : #{app.maintainer}"
36
+ puts " URL : #{app.url}"
37
+ puts " Description : #{app.description}"
38
+ rescue Flexirest::HTTPException => e
39
+ puts e.result.reason.colorize(:red)
40
+ exit 1
41
+ end
42
+ map "get" => "show", "inspect" => "show"
43
+
44
+
45
+ desc "add NAME --cluster=...", "add the marketplace application to a Kubernetes cluster by ID or name"
46
+ option :cluster
47
+ long_desc <<-LONGDESC
48
+ Use --cluster=name to specify part of the ID or name of the cluster to add the application to
49
+ LONGDESC
50
+ def add(name)
51
+ Civo::Kubernetes.verbose!
52
+ Flexirest::Logger.logfile = STDOUT
53
+
54
+ CivoCLI::Config.set_api_auth
55
+ app = Finder.detect_app(name)
56
+ cluster = Finder.detect_cluster(options[:cluster])
57
+
58
+ Civo::Kubernetes.update(id: cluster.id, applications: app.name)
59
+ puts "Added #{app.name.colorize(:green)} #{app.version} to Kubernetes cluster #{cluster.name.colorize(:green)}"
60
+ rescue Flexirest::HTTPException => e
61
+ puts e.result.reason.colorize(:red)
62
+ exit 1
63
+ end
64
+
65
+ default_task :help
66
+
67
+ private
68
+
69
+ def reject_user_access
70
+ puts "Sorry, this functionality is currently in closed beta and not available to the public yet"
71
+ exit(1)
72
+ end
73
+ end
74
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: civo_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
@@ -211,9 +211,11 @@ files:
211
211
  - lib/config.rb
212
212
  - lib/domain.rb
213
213
  - lib/domain_record.rb
214
+ - lib/finder.rb
214
215
  - lib/firewall.rb
215
216
  - lib/instance.rb
216
217
  - lib/kubernetes.rb
218
+ - lib/kubernetes_applications.rb
217
219
  - lib/loadbalancer.rb
218
220
  - lib/namegenerator.rb
219
221
  - lib/network.rb