civo_cli 0.4.0 → 0.4.2

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: b2036f8ca9f8bf23a3a130c98784aca3fc974f0798d8550334a87ef51b66a9d5
4
- data.tar.gz: 748c9360b9333a653e987886754cc287bb2ab11664d2d70eaa686966909f87be
3
+ metadata.gz: b5787d9ab0c66dee190959129ab97d5358b5e93c439db620085c81122810abaa
4
+ data.tar.gz: 5c229c96e001eca1027b4ed66de391d50555d2457673a3d019fedf90276fa772
5
5
  SHA512:
6
- metadata.gz: 44339de9ba2c6d0f4f7b604554340efd01adc614c50bf8f5f64e439b1622f78de3b1f37540dc9e0e4694794eb619f2d68208e7670e2e490b3dfb15fb727970fd
7
- data.tar.gz: e5162bb097e7ad7e1ff60da14192d17235d575ff43f15ff148e9f69320bda502cd64a33be518983a3eabbce038c8737b0f3a25b2f47f654dde3f41394ed6462c
6
+ metadata.gz: aa88841fdc522e311818d1e678dc057e2e8ae5931d803628bd700db0be1479528578d375c21b8602a1ad4cad0597a63a096e0a4a85bd489996be3dcc7e133139
7
+ data.tar.gz: 54805d074e258962b9f6b1cc70d3b3c0b744343d5a9ab0ac808f27ac470f954f3dc87d2794b81289b16358ffad47d097575e12b56402f59e81a50179815a9788
data/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@ 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.4.2] - 2019-09-26
7
+ ### Changed
8
+ - Add ability to specify a version when creating a cluster (default to our current version).
9
+
10
+ ## [0.4.1] - 2019-09-21
11
+ ### Changed
12
+ - `civo kubernetes config` will show an error (and exit with a non-zero status) if the config isn't available from the server
13
+
14
+ ### Added
15
+ - Add `civo update` command to automatically update your `civo_cli` Ruby gem to the latest version.
16
+
6
17
  ## [0.4.0] - 2019-09-17
7
18
  ### Changed
8
19
  - Now the capability exists for pre-installed applications in a cluster, ensure they aren't manually installed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- civo_cli (0.4.0)
4
+ civo_cli (0.4.2)
5
5
  bundler (~> 1.17)
6
6
  civo (>= 1.2.8)
7
7
  colorize
@@ -35,10 +35,11 @@ GEM
35
35
  faraday (0.15.4)
36
36
  multipart-post (>= 1.2, < 3)
37
37
  ffi (1.11.1)
38
- flexirest (1.8.0)
38
+ flexirest (1.8.5)
39
39
  activesupport
40
40
  crack
41
41
  faraday
42
+ mime-types
42
43
  multi_json
43
44
  formatador (0.2.5)
44
45
  guard (2.15.0)
@@ -66,7 +67,10 @@ GEM
66
67
  ruby_dep (~> 1.2)
67
68
  lumberjack (1.0.13)
68
69
  method_source (0.9.2)
69
- minitest (5.11.3)
70
+ mime-types (3.3)
71
+ mime-types-data (~> 3.2015)
72
+ mime-types-data (3.2019.0904)
73
+ minitest (5.12.0)
70
74
  multi_json (1.13.1)
71
75
  multipart-post (2.1.1)
72
76
  nenv (0.3.0)
@@ -1,3 +1,3 @@
1
1
  module CivoCLI
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.2"
3
3
  end
data/lib/civo_cli.rb CHANGED
@@ -12,6 +12,8 @@ module CivoCLI
12
12
  class Error < StandardError; end
13
13
 
14
14
  class Main < Thor
15
+ check_unknown_options!
16
+
15
17
  desc "apikey", "manage API keys stored in the client"
16
18
  subcommand "apikey", CivoCLI::APIKey
17
19
  map "apikeys" => "apikey"
@@ -79,6 +81,16 @@ module CivoCLI
79
81
  subcommand "template", CivoCLI::Template
80
82
  map "templates" => "template"
81
83
 
84
+ desc "update", "update to the latest Civo CLI"
85
+ def update
86
+ output = `gem update civo_cli 2>&1`
87
+ if output["You don't have write permissions"]
88
+ puts "Updating Civo CLI with sudo permissions (unable to do it without)"
89
+ `sudo gem update civo_cli 2>&1`
90
+ end
91
+ version
92
+ end
93
+
82
94
  desc "version", "show the version of Civo CLI used"
83
95
  def version
84
96
  gem_details = Civo::Base._request("https://rubygems.org/api/v1/gems/civo_cli.json")
data/lib/finder.rb CHANGED
@@ -5,6 +5,15 @@ class Finder
5
5
  result << cluster
6
6
  end
7
7
 
8
+ if id.blank?
9
+ if result.count == 1
10
+ return result[0]
11
+ elsif result.count > 1
12
+ puts 'Multiple possible Kubernetes clusters found. Please try again and specify the cluster with --cluster=NAME.'
13
+ exit 1
14
+ end
15
+ end
16
+
8
17
  matched = result.detect { |cluster| cluster.name == id || cluster.id == id }
9
18
  return matched if matched
10
19
 
data/lib/kubernetes.rb CHANGED
@@ -83,10 +83,18 @@ module CivoCLI
83
83
  CivoCLI::Config.set_api_auth
84
84
  cluster = Finder.detect_cluster(id)
85
85
 
86
- if options[:save]
87
- save_config(cluster)
86
+ if !cluster.ready
87
+ puts "The cluster isn't ready yet, so the KUBECONFIG isn't available.".colorize(:red)
88
+ exit 1
89
+ elsif cluster.kubeconfig.blank?
90
+ puts "The cluster is being installed, but the KUBECONFIG isn't available yet.".colorize(:red)
91
+ exit 1
88
92
  else
89
- puts cluster.kubeconfig
93
+ if options[:save]
94
+ save_config(cluster)
95
+ else
96
+ puts cluster.kubeconfig
97
+ end
90
98
  end
91
99
  rescue Flexirest::HTTPException => e
92
100
  puts e.result.reason.colorize(:red)
@@ -106,6 +114,7 @@ module CivoCLI
106
114
  \x5\x5Optional parameters are as follows:
107
115
  \x5 --size=<instance_size> - 'g2.medium' if blank. List of sizes and codes to use can be found through `civo sizes`
108
116
  \x5 --nodes=<count> - '3' if blank
117
+ \x5 --version=<version> - our latest k3s version if blank
109
118
  \x5 --applications=name1,name2 - optional, use names shown by running `civo applications`
110
119
  \x5 --wait - wait for build to complete and show status. Off by default.
111
120
  \x5 --save - save resulting configuration to ~/.kube/config (requires kubectl and the --wait option)
@@ -143,7 +152,7 @@ module CivoCLI
143
152
  end
144
153
  end
145
154
 
146
- @cluster = Civo::Kubernetes.create(name: name, target_nodes_size: options[:size], num_target_nodes: options[:nodes], applications: applications.join(","))
155
+ @cluster = Civo::Kubernetes.create(name: name, target_nodes_size: options[:size], num_target_nodes: options[:nodes], applications: applications.join(","), version: options[:version])
147
156
 
148
157
  if options[:wait]
149
158
  timer = CivoCLI::Timer.new
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.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-09-17 00:00:00.000000000 Z
13
+ date: 2019-09-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake