civo_cli 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +3 -3
- data/README.md +2 -0
- data/civo_cli.gemspec +1 -1
- data/lib/civo_cli/version.rb +1 -1
- data/lib/instance.rb +28 -6
- data/lib/template.rb +19 -4
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a990a4394121647d574094b564c731d6c0b3d0c578449a7b3a3242d09073d11a
|
4
|
+
data.tar.gz: 2e9ab309f83c89f56939ced1394f46f4e412cdc8053526dc6b5084ca57a9328b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02f29d1426fbeee3e56c7ebb536008694a9dd5eaec3af6047283656fa051d093a7d94909d3053ca8530ee0dceb8b3e6745e88f853996cf4a31f2322223c85eab
|
7
|
+
data.tar.gz: f5dae08ebcdf7f1e0e0c0206034cda730339932cc1c2ab22facc6a775c6a15ab96dca5ad58c15cb07d53ca00032341f6ebc6accc999602b1e89cd2d2a3a1fcb3
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@ 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.4] - 2019-07-10
|
7
|
+
### Fixed
|
8
|
+
- Template ID in `instance create` default wasn't working nicely, now defaults to Ubuntu if not provided and no snapshot specified
|
9
|
+
### Added
|
10
|
+
- Verbose mode switch `-v` / `--verbose` to `template list`
|
11
|
+
- `public_ip` method to `instance` to output public IP of the chosen instance
|
12
|
+
|
6
13
|
## [0.3.3] - 2019-07-08
|
7
14
|
### Fixed
|
8
15
|
- Instances list was only showing first twenty servers, now shows all
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
civo_cli (0.3.
|
4
|
+
civo_cli (0.3.4)
|
5
|
+
bundler (~> 1.17)
|
5
6
|
civo (>= 1.2.1)
|
6
7
|
colorize
|
7
8
|
json
|
@@ -18,7 +19,7 @@ GEM
|
|
18
19
|
tzinfo (~> 1.1)
|
19
20
|
addressable (2.6.0)
|
20
21
|
public_suffix (>= 2.0.2, < 4.0)
|
21
|
-
civo (1.2.
|
22
|
+
civo (1.2.1)
|
22
23
|
commander
|
23
24
|
flexirest (>= 1.4.6)
|
24
25
|
toml
|
@@ -115,7 +116,6 @@ PLATFORMS
|
|
115
116
|
ruby
|
116
117
|
|
117
118
|
DEPENDENCIES
|
118
|
-
bundler (~> 1.17)
|
119
119
|
civo_cli!
|
120
120
|
guard
|
121
121
|
guard-rspec
|
data/README.md
CHANGED
@@ -27,6 +27,8 @@ Civo CLI is a tool to manage your [Civo.com](https://www.civo.com) account from
|
|
27
27
|
## Set-up
|
28
28
|
Civo CLI is built with Ruby and distributed as a Gem. If you have Ruby (2.0.0 or later) installed, you can simply run `gem install civo_cli` in your terminal to get the gem and its dependencies.
|
29
29
|
|
30
|
+
You may need to use `sudo` if you get an error about `You don't have write permissions` when installing the gem. The syntax is `sudo gem install civo_cli`.
|
31
|
+
|
30
32
|
If you need to install Ruby, follow the installation instructions appropriate for your operating system, and return to this guide after you have successfully installed the gem.
|
31
33
|
|
32
34
|
- [Microsoft Windows](https://rubyinstaller.org/)
|
data/civo_cli.gemspec
CHANGED
@@ -38,7 +38,6 @@ Gem::Specification.new do |spec|
|
|
38
38
|
|
39
39
|
spec.required_ruby_version = '~> 2.0'
|
40
40
|
|
41
|
-
spec.add_development_dependency "bundler", "~> 1.17"
|
42
41
|
spec.add_development_dependency "rake", "~> 10.0"
|
43
42
|
spec.add_development_dependency "rspec", "~> 3.0"
|
44
43
|
spec.add_development_dependency "guard"
|
@@ -49,6 +48,7 @@ Gem::Specification.new do |spec|
|
|
49
48
|
spec.add_runtime_dependency 'terminal-table'
|
50
49
|
spec.add_runtime_dependency 'thor'
|
51
50
|
spec.add_runtime_dependency 'colorize'
|
51
|
+
spec.add_runtime_dependency "bundler", "~> 1.17"
|
52
52
|
spec.add_runtime_dependency 'civo', ">= 1.2.1"
|
53
53
|
spec.add_runtime_dependency 'json'
|
54
54
|
end
|
data/lib/civo_cli/version.rb
CHANGED
data/lib/instance.rb
CHANGED
@@ -83,9 +83,9 @@ module CivoCLI
|
|
83
83
|
option :region, default: 'lon1', banner: 'civo_region'
|
84
84
|
option :public_ip, default: 'true', banner: 'true | false | from [instance_id]'
|
85
85
|
option :initial_user, default: 'civo', banner: 'username', aliases: '--user'
|
86
|
-
option :template,
|
86
|
+
option :template, banner: 'template_id'
|
87
87
|
option :snapshot, banner: 'snapshot_id'
|
88
|
-
option :ssh_key, banner: 'ssh_key_id'
|
88
|
+
option :ssh_key, banner: 'ssh_key_id', aliases: '--ssh'
|
89
89
|
option :tags, banner: "'tag1 tag2 tag3...'"
|
90
90
|
option :wait, type: :boolean
|
91
91
|
long_desc <<-LONGDESC
|
@@ -97,22 +97,27 @@ module CivoCLI
|
|
97
97
|
\x5 --snapshot=<snapshot_id> - Snapshot ID of a previously-made snapshot. Leave blank if using a template.
|
98
98
|
\x5 --public_ip=<true | false | from=instance_id> - 'true' if blank. 'from' requires an existing instance ID configured with a public IP address to move to this new instance.
|
99
99
|
\x5 --initial_user=<yourusername> - 'civo' if blank
|
100
|
-
\x5 --ssh_key=<ssh_key_id> - for specifying a SSH login key for the default user. Random password assigned if blank, visible by calling `civo instance show hostname`
|
100
|
+
\x5 --ssh_key=<ssh_key_id> - for specifying a SSH login key for the default user from saved SSH keys. Random password assigned if blank, visible by calling `civo instance show hostname`
|
101
101
|
\x5 --region=<regioncode> from available Civo regions. Randomly assigned if blank
|
102
102
|
\x5 --tags=<'tag1 tag2 tag3...'> - space-separated tag(s)
|
103
103
|
\x5 --wait - wait for build to complete and show status. Off by default.
|
104
104
|
LONGDESC
|
105
105
|
def create(hostname = CivoCLI::NameGenerator.create, *args)
|
106
106
|
CivoCLI::Config.set_api_auth
|
107
|
-
if options[:template] && options[:snapshot]
|
107
|
+
if options[:template] && options[:snapshot]
|
108
108
|
puts "Please provide either template OR snapshot ID".colorize(:red)
|
109
109
|
exit 1
|
110
110
|
end
|
111
111
|
|
112
|
+
if !options[:template] && !options[:snapshot]
|
113
|
+
options[:template] = '811a8dfb-8202-49ad-b1ef-1e6320b20497'
|
114
|
+
end
|
115
|
+
|
116
|
+
|
112
117
|
if options[:template]
|
113
|
-
@instance = Civo::Instance.create(hostname: hostname, size: options[:size], template: options[:template], initial_user: options[:initial_user], region: options[:region], ssh_key_id: options[:ssh_key], tags: options[:tags])
|
118
|
+
@instance = Civo::Instance.create(hostname: hostname, size: options[:size], template: options[:template], public_ip: options[:public_ip], initial_user: options[:initial_user], region: options[:region], ssh_key_id: options[:ssh_key], tags: options[:tags])
|
114
119
|
elsif options[:snapshot]
|
115
|
-
@instance = Civo::Instance.create(hostname: hostname, size: options[:size], snapshot_id: options[:snapshot], initial_user: options[:initial_user], region: options[:region], ssh_key_id: options[:ssh_key], tags: options[:tags])
|
120
|
+
@instance = Civo::Instance.create(hostname: hostname, size: options[:size], snapshot_id: options[:snapshot], public_ip: options[:public_ip], initial_user: options[:initial_user], region: options[:region], ssh_key_id: options[:ssh_key], tags: options[:tags])
|
116
121
|
end
|
117
122
|
|
118
123
|
if options[:wait]
|
@@ -281,6 +286,23 @@ module CivoCLI
|
|
281
286
|
exit 1
|
282
287
|
end
|
283
288
|
|
289
|
+
desc "public_ip ID/HOSTNAME", "Show public IP of ID/hostname"
|
290
|
+
def public_ip(id)
|
291
|
+
CivoCLI::Config.set_api_auth
|
292
|
+
|
293
|
+
instance = detect_instance(id)
|
294
|
+
unless instance.public_ip.nil?
|
295
|
+
puts instance.public_ip
|
296
|
+
else
|
297
|
+
puts "Error: Instance has no public IP"
|
298
|
+
exit 2
|
299
|
+
end
|
300
|
+
|
301
|
+
rescue Flexirest::HTTPException => e
|
302
|
+
puts e.result.reason.colorize(:red)
|
303
|
+
exit 1
|
304
|
+
end
|
305
|
+
|
284
306
|
default_task :list
|
285
307
|
|
286
308
|
private
|
data/lib/template.rb
CHANGED
@@ -1,17 +1,32 @@
|
|
1
1
|
module CivoCLI
|
2
2
|
class Template < Thor
|
3
3
|
desc "list", "list all templates"
|
4
|
+
option :verbose, type: :boolean, desc: "Show verbose template detail", aliases: ["-v"]
|
4
5
|
def list
|
5
6
|
CivoCLI::Config.set_api_auth
|
6
7
|
rows = []
|
7
|
-
|
8
|
-
|
8
|
+
|
9
|
+
if options[:verbose]
|
10
|
+
Civo::Template.all.items.each do |template|
|
11
|
+
rows << [template.id, template.name, template.image_id, template.volume_id, template.default_username]
|
12
|
+
end
|
13
|
+
puts Terminal::Table.new headings: ['ID', 'Name', 'Image ID', 'Volume ID', "Default Username"], rows: rows
|
14
|
+
|
15
|
+
else
|
16
|
+
Civo::Template.all.items.each do |template|
|
17
|
+
rows << [template.id, template.name]
|
18
|
+
end
|
19
|
+
puts Terminal::Table.new headings: ['ID', 'Name'], rows: rows
|
20
|
+
|
9
21
|
end
|
10
|
-
|
11
|
-
|
22
|
+
|
23
|
+
|
24
|
+
rescue Flexirest::HTTPException => e
|
12
25
|
puts e.result.reason.colorize(:red)
|
13
26
|
exit 1
|
14
27
|
end
|
28
|
+
map "ls" => "list"
|
29
|
+
|
15
30
|
|
16
31
|
desc "show ID", "show the details for a single template"
|
17
32
|
def show(id)
|
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.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
@@ -10,22 +10,8 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-07-
|
13
|
+
date: 2019-07-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: bundler
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
requirements:
|
19
|
-
- - "~>"
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '1.17'
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
requirements:
|
26
|
-
- - "~>"
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '1.17'
|
29
15
|
- !ruby/object:Gem::Dependency
|
30
16
|
name: rake
|
31
17
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,6 +138,20 @@ dependencies:
|
|
152
138
|
- - ">="
|
153
139
|
- !ruby/object:Gem::Version
|
154
140
|
version: '0'
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: bundler
|
143
|
+
requirement: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - "~>"
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '1.17'
|
148
|
+
type: :runtime
|
149
|
+
prerelease: false
|
150
|
+
version_requirements: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - "~>"
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '1.17'
|
155
155
|
- !ruby/object:Gem::Dependency
|
156
156
|
name: civo
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
- !ruby/object:Gem::Version
|
248
248
|
version: '0'
|
249
249
|
requirements: []
|
250
|
-
rubygems_version: 3.0.
|
250
|
+
rubygems_version: 3.0.3
|
251
251
|
signing_key:
|
252
252
|
specification_version: 4
|
253
253
|
summary: CLI for interacting with Civo.com
|