civo_cli 0.5.3 → 0.5.4
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/civo_cli/version.rb +1 -1
- data/lib/instance.rb +8 -3
- data/lib/spinner.rb +6 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 602df710da16648d80d127bd5ab538b5b78c89070cd54d2da03352cad2ee13b6
|
4
|
+
data.tar.gz: 1bfa51fa4868325882f1fbb24176d8428ccabf785698a0e4849c38e4f4c1f141
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f829f85d97d769a91f4641bfde0c2ca865d809b15bb224341ef9d2c460db6d8f80bf0cfdc4cff3bbf0bccf76308bb005e6973717ae449c9484f54572603f1bcf
|
7
|
+
data.tar.gz: cb3cb6488d894be1c9a56489c617d55eb3fc20e2fb61f57b2cb51159b0d83b3f278673280da99703a59c1faffb3a3a6b2f9ce97acb337f0e51d1aa693f104583
|
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.5.4] - 2019-11-01
|
7
|
+
### Added
|
8
|
+
- New `--quiet`/`-q` flag for instance creation to not display the spinner and be so verbose during instance creation
|
9
|
+
|
6
10
|
## [0.5.3] - 2019-11-01
|
7
11
|
### Added
|
8
12
|
- New feature, you can now specify a script to be run from the cloud-init process (it's saved on the instance as `/usr/local/bin/civo-user-init-script` with root ownership and only root permissions). `civo instance create --script=~/code/myscript.sh`
|
data/Gemfile.lock
CHANGED
data/lib/civo_cli/version.rb
CHANGED
data/lib/instance.rb
CHANGED
@@ -109,6 +109,7 @@ module CivoCLI
|
|
109
109
|
option :snapshot, banner: 'snapshot_id'
|
110
110
|
option :ssh_key, banner: 'ssh_key_id', aliases: '--ssh'
|
111
111
|
option :tags, banner: "'tag1 tag2 tag3...'"
|
112
|
+
option :quiet, type: :boolean, aliases: '-q'
|
112
113
|
option :script, type: :string, desc: "The filename of a file to be used as an initialization script", aliases: ["-s"], banner: "SCRIPT"
|
113
114
|
option :wait, type: :boolean
|
114
115
|
long_desc <<-LONGDESC
|
@@ -159,10 +160,10 @@ module CivoCLI
|
|
159
160
|
end
|
160
161
|
|
161
162
|
if options[:wait]
|
162
|
-
print "Building new instance #{hostname}: "
|
163
|
+
print "Building new instance #{hostname}: " unless options[:quiet]
|
163
164
|
timer = CivoCLI::Timer.new
|
164
165
|
timer.start_timer
|
165
|
-
spinner = CivoCLI::Spinner.spin(instance: @instance) do |s|
|
166
|
+
spinner = CivoCLI::Spinner.spin(instance: @instance, quiet: options[:quiet]) do |s|
|
166
167
|
Civo::Instance.all.items.each do |instance|
|
167
168
|
if instance.id == @instance.id && instance.status == 'ACTIVE'
|
168
169
|
s[:final_instance] = instance
|
@@ -171,7 +172,11 @@ module CivoCLI
|
|
171
172
|
s[:final_instance]
|
172
173
|
end
|
173
174
|
timer.end_timer
|
174
|
-
|
175
|
+
if options[:quiet]
|
176
|
+
puts spinner[:final_instance].id
|
177
|
+
else
|
178
|
+
puts "\b Done\nCreated instance #{spinner[:final_instance].hostname.colorize(:green)} - #{spinner[:final_instance].initial_user}@#{spinner[:final_instance].public_ip} in #{Time.at(timer.time_elapsed).utc.strftime("%M min %S sec")}"
|
179
|
+
end
|
175
180
|
else
|
176
181
|
puts "Created instance #{hostname.colorize(:green)}"
|
177
182
|
end
|
data/lib/spinner.rb
CHANGED
@@ -10,6 +10,7 @@ module CivoCLI
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def initialize(data = {}, &block)
|
13
|
+
@quiet = data.delete(:quiet) || false
|
13
14
|
@data = data
|
14
15
|
@spinner_frame = 0
|
15
16
|
@counter = 20
|
@@ -31,10 +32,10 @@ module CivoCLI
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def spin
|
34
|
-
print "\033[?25l"
|
35
|
+
print "\033[?25l" unless @quiet
|
35
36
|
while(@total > 0) do
|
36
37
|
sleep(DELAY)
|
37
|
-
print SPINNER_SHAPES[@spinner_frame] + "\b"
|
38
|
+
print SPINNER_SHAPES[@spinner_frame] + "\b" unless @quiet
|
38
39
|
@spinner_frame += 1
|
39
40
|
@spinner_frame = 0 if @spinner_frame == SPINNER_SHAPES.length
|
40
41
|
@counter -= 1
|
@@ -44,17 +45,17 @@ module CivoCLI
|
|
44
45
|
@counter = 20
|
45
46
|
if result = @block.call(self)
|
46
47
|
self.data[:result] = result
|
47
|
-
print "\033[?25h"
|
48
|
+
print "\033[?25h" unless @quiet
|
48
49
|
return self
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
52
|
-
print "\033[?25h"
|
53
|
+
print "\033[?25h" unless @quiet
|
53
54
|
rescue Interrupt
|
54
55
|
print "\b\b" + "Exiting.\n"
|
55
56
|
exit 1
|
56
57
|
ensure
|
57
|
-
print "\033[?25h"
|
58
|
+
print "\033[?25h" unless @quiet
|
58
59
|
end
|
59
60
|
end
|
60
61
|
end
|