morpheus-cli 4.2.11 → 4.2.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -302,15 +302,12 @@ EOT
302
302
  # secure is the default,
303
303
  # try to only store insecure:false in the appliances config
304
304
  if url.to_s =~ /^https\:/ && secure.nil?
305
- if secure != nil
306
- new_appliance_map[:insecure] = !secure
307
- else
308
- #v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'secure', 'fieldLabel' => 'Secure', 'type' => 'checkbox', 'required' => false, 'defaultValue' => true, 'description' => 'Prevent insecure HTTPS communication, respect SSL errors.'}], options[:options])
309
- v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'insecure', 'fieldLabel' => 'Insecure (Ignore SSL Errors)', 'type' => 'checkbox', 'required' => false, 'defaultValue' => false, 'description' => 'Allow insecure HTTPS communication, ignore SSL errors.'}], options[:options])
310
- if v_prompt['insecure'].to_s == 'true' || v_prompt['insecure'].to_s == 'on'
311
- new_appliance_map[:insecure] = true
312
- end
305
+ v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'insecure', 'fieldLabel' => 'Insecure (Ignore SSL Errors)', 'type' => 'checkbox', 'required' => false, 'defaultValue' => false, 'description' => 'Allow insecure HTTPS communication, ignore SSL errors.'}], options[:options])
306
+ if v_prompt['insecure'].to_s == 'true' || v_prompt['insecure'].to_s == 'on'
307
+ new_appliance_map[:insecure] = true
313
308
  end
309
+ elsif secure != nil
310
+ new_appliance_map[:insecure] = !secure
314
311
  end
315
312
 
316
313
  # --use
@@ -698,7 +698,7 @@ EOT
698
698
  {'fieldName' => 'password', 'fieldLabel' => 'Password', 'type' => 'password', 'required' => true, 'displayOrder' => 5},
699
699
  {'fieldName' => 'passwordConfirmation', 'fieldLabel' => 'Confirm Password', 'type' => 'password', 'required' => true, 'displayOrder' => 6},
700
700
  {'fieldName' => 'role', 'fieldLabel' => 'Role', 'type' => 'text', 'description' => "Role names (comma separated)", 'displayOrder' => 7},
701
- {'fieldName' => 'receiveNotifications', 'fieldLabel' => 'receiveNotifications', 'type' => 'checkbox', 'required' => false, 'defaultValue' => true, 'displayOrder' => 58},
701
+ {'fieldName' => 'receiveNotifications', 'fieldLabel' => 'Receive Notifications?', 'type' => 'checkbox', 'required' => false, 'defaultValue' => true, 'displayOrder' => 58},
702
702
  {'fieldName' => 'linuxUsername', 'fieldLabel' => 'Linux Username', 'type' => 'text', 'required' => false, 'displayOrder' => 9},
703
703
  # {'fieldName' => 'linuxPassword', 'fieldLabel' => 'Linux Password', 'type' => 'password', 'required' => false, 'displayOrder' => 10},
704
704
  {'fieldName' => 'windowsUsername', 'fieldLabel' => 'Windows Username', 'type' => 'text', 'required' => false, 'displayOrder' => 11},
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "4.2.11"
4
+ VERSION = "4.2.16"
5
5
  end
6
6
  end
@@ -365,14 +365,8 @@ def format_number(n, opts={})
365
365
  return out
366
366
  end
367
367
 
368
- def format_sig_dig(n, sig_dig=3)
369
- out = ""
370
- parts = n.to_f.round(sig_dig).to_s.split(".")
371
- if parts.size > 1 && sig_dig
372
- parts[1] = parts[1].ljust(sig_dig, "0")
373
- end
374
- out << parts.join(".")
375
- return out
368
+ def format_sig_dig(n, sigdig=3)
369
+ sprintf("%.#{sigdig}f", n)
376
370
  end
377
371
 
378
372
  def currency_sym(currency)
@@ -382,22 +376,16 @@ end
382
376
  # returns currency amount formatted like "$4,5123.00". 0.00 is formatted as "$0"
383
377
  # this is not ideal
384
378
  def format_money(amount, currency='usd', opts={})
385
- if amount.to_f == 0
379
+ amount = amount.to_f
380
+ if amount == 0
386
381
  return currency_sym(currency).to_s + "0"
387
382
  # elsif amount.to_f < 0.01
388
383
  # # return exponent notation like 3.4e-09
389
384
  # return currency_sym(currency).to_s + "#{amount}"
390
385
  else
391
- rtn = amount.to_f.round(2).to_s
392
- if rtn.index('.').nil?
393
- rtn += '.00'
394
- elsif rtn.split('.')[1].length < 2
395
- rtn = rtn + (['0'] * (2 - rtn.split('.')[1].length) * '')
396
- end
397
- dollars,cents = rtn.split(".")
398
- rtn = currency_sym(currency).to_s + format_number(dollars.to_i.abs) + "." + cents
399
-
400
- if dollars.to_i < 0
386
+ sigdig = opts[:sigdig] ? opts[:sigdig].to_i : 2
387
+ rtn = currency_sym(currency).to_s + format_number(sprintf("%.#{sigdig}f", amount))
388
+ if amount.to_i < 0
401
389
  rtn = "(#{rtn})"
402
390
  if opts[:minus_color]
403
391
  rtn = "#{opts[:minus_color]}#{rtn}#{opts[:return_color] || cyan}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morpheus-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.11
4
+ version: 4.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Estes
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-05-08 00:00:00.000000000 Z
14
+ date: 2020-06-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler