civo_cli 0.5.3 → 0.5.4

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
  SHA256:
3
- metadata.gz: dcf79296d9423f63f2c20427cfa0463f79f1d217e6cbc9ee85008790e670c6da
4
- data.tar.gz: 6b0a853cb65b6be32f0e4e855cedc81168d8bc407cbfaadb2aad2ac374e1b594
3
+ metadata.gz: 602df710da16648d80d127bd5ab538b5b78c89070cd54d2da03352cad2ee13b6
4
+ data.tar.gz: 1bfa51fa4868325882f1fbb24176d8428ccabf785698a0e4849c38e4f4c1f141
5
5
  SHA512:
6
- metadata.gz: d39ad0c61f725e01a267357ffa55d6cfba2fcd3a374d83d7e6d4432d1ce306066ca897e75366c1212ccffc3c896f82aee58fd24b58ba2120c67530f8085a6e98
7
- data.tar.gz: e159923f394e4988b35611a748b5385b8288be0d36f6008db2c57039863a0843e8ea8b89340516e78b79f10c4d4a4e699d0b12d0cb485ca1432aace2d365dc9d
6
+ metadata.gz: f829f85d97d769a91f4641bfde0c2ca865d809b15bb224341ef9d2c460db6d8f80bf0cfdc4cff3bbf0bccf76308bb005e6973717ae449c9484f54572603f1bcf
7
+ data.tar.gz: cb3cb6488d894be1c9a56489c617d55eb3fc20e2fb61f57b2cb51159b0d83b3f278673280da99703a59c1faffb3a3a6b2f9ce97acb337f0e51d1aa693f104583
@@ -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`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- civo_cli (0.5.3)
4
+ civo_cli (0.5.4)
5
5
  bundler (>= 1.17)
6
6
  civo (>= 1.2.9)
7
7
  colorize
@@ -1,3 +1,3 @@
1
1
  module CivoCLI
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -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
- 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")}"
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
@@ -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
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.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries