morpheus-cli 8.0.12 → 8.0.12.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: 30f5740960bec8ff3b96aa8e7da68862d310d4375fc7c48c11fd31841ac5310c
4
- data.tar.gz: ae66b58b6702afeed4e30edc44b019a1e73e2ea11179f0ab6507edf250275977
3
+ metadata.gz: '06781ec23df17a4185834c843d6b756bc28c9ec2239dd0c97647c8d2d67addc5'
4
+ data.tar.gz: c075335c0e1b772e6f8a4bf35fc1186b9cf2abc18ebec73c23b19b0c4283c0c8
5
5
  SHA512:
6
- metadata.gz: 795b92277a1dbc2ad7ec6a933469fcf0ab77f8c7e8d261b5502e218f3a72cfda0856bff14d94b043b4f3371ec2cbd89d8522df6c57b87477d75949e70b975436
7
- data.tar.gz: cfdc201519632bf6f6b51155611b35ffe4c299733bda2c16c19109bae37174112439aa728ecebcff42c1646496060698952af332a444d7a32ab46b5e260789f7
6
+ metadata.gz: f6819ce4ebee4828c06dc23001532103dfbad397dc77de82c1846dbd3078f49e68c3ef84dcea19af82c38abb46b032de20c140babc38f5559457b24a40f7ef85
7
+ data.tar.gz: 8970d7c663daf582e01eacbfd12eb9a965f74f91813bf296fac2f49f6cb069b5c1ab6dd233578127516c5f8a84d56e646e12d6a0f23ea4229fc8aae9a8e58265
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  FROM ruby:2.7.5
2
2
 
3
- RUN gem install morpheus-cli -v 8.0.12
3
+ RUN gem install morpheus-cli -v 8.0.12.2
4
4
 
5
5
  ENTRYPOINT ["morpheus"]
@@ -1,5 +1,4 @@
1
1
  require 'morpheus/cli/cli_command'
2
- require 'money' # ew, let's write our own
3
2
  require 'time'
4
3
 
5
4
  class Morpheus::Cli::BudgetsCommand
@@ -1599,14 +1599,14 @@ EOT
1599
1599
  {'fieldName' => 'affinityType', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => [{'name' => 'Keep Separate', 'value' => 'KEEP_SEPARATE'}, {'name' => 'Keep Together', 'value' => 'KEEP_TOGETHER'}], 'description' => 'Choose affinity type.', 'required' => true, 'defaultValue' => 'KEEP_SEPARATE'},
1600
1600
  {'fieldName' => 'active', 'fieldLabel' => 'Active', 'type' => 'checkbox', 'defaultValue' => true},
1601
1601
  {'fieldName' => 'pool.id', 'fieldLabel' => 'Cluster', 'type' => 'select', 'optionSourceType' => 'vmware', 'optionSource' => 'vmwareZonePoolClusters', 'description' => 'Select cluster for the affinity group.', 'required' => true},
1602
- {'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'description' => 'Select servers to be in the affinity group.'},
1602
+ {'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'searchParameter' => 'phrase', 'description' => 'Select servers to be in the affinity group.'},
1603
1603
  ]
1604
1604
  end
1605
1605
 
1606
1606
  def update_cloud_affinity_group_option_types
1607
1607
  [
1608
1608
  {'fieldName' => 'active', 'fieldLabel' => 'Active', 'type' => 'checkbox'},
1609
- {'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'description' => 'Select servers to be in the affinity group.'},
1609
+ {'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'searchParameter' => 'phrase', 'description' => 'Select servers to be in the affinity group.'},
1610
1610
  ]
1611
1611
  end
1612
1612
 
@@ -5268,14 +5268,14 @@ class Morpheus::Cli::Clusters
5268
5268
  {'fieldName' => 'affinityType', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => [{'name' => 'Keep Separate', 'value' => 'KEEP_SEPARATE'}, {'name' => 'Keep Together', 'value' => 'KEEP_TOGETHER'}], 'description' => 'Choose affinity type.', 'required' => true, 'defaultValue' => 'KEEP_SEPARATE'},
5269
5269
  {'fieldName' => 'active', 'fieldLabel' => 'Active', 'type' => 'checkbox', 'defaultValue' => true},
5270
5270
  # {'fieldName' => 'pool.id', 'fieldLabel' => 'Cluster', 'type' => 'select', 'optionSourceType' => 'vmware', 'optionSource' => 'vmwareZonePoolClusters', 'description' => 'Select cluster for the affinity group.', 'required' => true},
5271
- {'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'description' => 'Select servers to be in the affinity group.'},
5271
+ {'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'searchParameter' => 'phrase', 'description' => 'Select servers to be in the affinity group.'},
5272
5272
  ]
5273
5273
  end
5274
5274
 
5275
5275
  def update_affinity_group_option_types
5276
5276
  [
5277
5277
  {'fieldName' => 'active', 'fieldLabel' => 'Active', 'type' => 'checkbox'},
5278
- {'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'description' => 'Select servers to be in the affinity group.'},
5278
+ {'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'searchParameter' => 'phrase', 'description' => 'Select servers to be in the affinity group.'},
5279
5279
  ]
5280
5280
  end
5281
5281
 
@@ -1,5 +1,4 @@
1
1
  require 'morpheus/cli/cli_command'
2
- require 'money'
3
2
 
4
3
  class Morpheus::Cli::PriceSetsCommand
5
4
  include Morpheus::Cli::CliCommand
@@ -153,7 +152,7 @@ class Morpheus::Cli::PriceSetsCommand
153
152
  {
154
153
  id: it['id'],
155
154
  name: it['name'],
156
- pricing: (it['priceType'] == 'platform' ? '+' : '') + currency_sym(it['currency']) + (it['price'] || 0.0).to_s + (it['additionalPriceUnit'].nil? ? '' : '/' + it['additionalPriceUnit']) + '/' + (it['priceUnit'] || 'month').capitalize
155
+ pricing: (it['priceType'] == 'platform' ? '+' : '') + currency_symbol(it['currency']) + (it['price'] || 0.0).to_s + (it['additionalPriceUnit'].nil? ? '' : '/' + it['additionalPriceUnit']) + '/' + (it['priceUnit'] || 'month').capitalize
157
156
  }
158
157
  end
159
158
  print as_pretty_table(rows, [:id, :name, :pricing], options)
@@ -465,17 +464,13 @@ class Morpheus::Cli::PriceSetsCommand
465
464
 
466
465
  private
467
466
 
468
- def currency_sym(currency)
469
- Money::Currency.new((currency.to_s != '' ? currency : 'usd').to_sym).symbol
470
- end
471
-
472
467
  def price_prefix(price)
473
- (['platform', 'software'].include?(price['priceType']) ? '+' : '') + currency_sym(price['currency'])
468
+ (['platform', 'software'].include?(price['priceType']) ? '+' : '') + currency_symbol(price['currency'])
474
469
  end
475
470
 
476
471
  def price_markup(price)
477
472
  if price['markupType'] == 'fixed'
478
- currency_sym(price['currency']) + format_amount(price['markup'] || 0)
473
+ currency_symbol(price['currency']) + format_amount(price['markup'] || 0)
479
474
  elsif price['markupType'] == 'percent'
480
475
  (price['markupPercent'] || 0).to_s + '%'
481
476
  else
@@ -1,5 +1,4 @@
1
1
  require 'morpheus/cli/cli_command'
2
- require 'money'
3
2
 
4
3
  class Morpheus::Cli::PricesCommand
5
4
  include Morpheus::Cli::CliCommand
@@ -564,22 +563,13 @@ class Morpheus::Cli::PricesCommand
564
563
  (val.to_s =~ /\A\d{1,}\Z/) ? @prices_interface.get_volume_type(val.to_i)['volumeType'] : @prices_interface.list_volume_types({'name' => val})['volumeTypes'].first
565
564
  end
566
565
 
567
- def currency_sym(currency)
568
- begin
569
- Money::Currency.new((currency.to_s.empty? ? 'usd' : currency).to_sym).symbol
570
- rescue
571
- # sometimes '' is getting passed in here, so figure that out...
572
- Money::Currency.new(:usd).symbol
573
- end
574
- end
575
-
576
566
  def price_prefix(price)
577
- (['platform', 'software'].include?(price['priceType']) ? '+' : '') + currency_sym(price['currency'])
567
+ (['platform', 'software'].include?(price['priceType']) ? '+' : '') + currency_symbol(price['currency'])
578
568
  end
579
569
 
580
570
  def price_markup(price)
581
571
  if price['markupType'] == 'fixed'
582
- currency_sym(price['currency']) + format_amount(price['markup'] || 0)
572
+ currency_symbol(price['currency']) + format_amount(price['markup'] || 0)
583
573
  elsif price['markupType'] == 'percent'
584
574
  (price['markupPercent'] || 0).to_s + '%'
585
575
  else
@@ -978,8 +978,8 @@ module Morpheus
978
978
  # query_value = (value || use_value || default_value || '')
979
979
  query_value = (input || '')
980
980
  api_params ||= {}
981
- api_params['query'] = query_value
982
- api_params['phrase'] = query_value
981
+ search_parameter = option_type['searchParameter'] || 'query'
982
+ api_params[search_parameter] = query_value
983
983
  # skip refresh if you just hit enter
984
984
  if !query_value.empty? || (select_options.nil? || select_options.empty?)
985
985
  select_options = load_options(option_type, api_client, api_params, query_value)
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "8.0.12"
4
+ VERSION = "8.0.12.2"
5
5
  end
6
6
  end
@@ -0,0 +1,184 @@
1
+ # Provides currency symbol lookup
2
+ #
3
+ module Morpheus::Currency
4
+ SYMBOLS = {
5
+ "AED" => "د.إ",
6
+ "AFN" => "؋",
7
+ "ALL" => "L",
8
+ "AMD" => "֏",
9
+ "ANG" => "ƒ",
10
+ "AOA" => "Kz",
11
+ "ARS" => "$",
12
+ "AUD" => "$",
13
+ "AWG" => "ƒ",
14
+ "AZN" => "₼",
15
+ "BAM" => "КМ",
16
+ "BBD" => "$",
17
+ "BDT" => "৳",
18
+ "BGN" => "лв.",
19
+ "BHD" => "د.ب",
20
+ "BIF" => "Fr",
21
+ "BMD" => "$",
22
+ "BND" => "$",
23
+ "BOB" => "Bs.",
24
+ "BRL" => "R$",
25
+ "BSD" => "$",
26
+ "BTN" => "Nu.",
27
+ "BWP" => "P",
28
+ "BYN" => "Br",
29
+ "BYR" => "Br",
30
+ "BZD" => "$",
31
+ "CAD" => "$",
32
+ "CDF" => "Fr",
33
+ "CHF" => "CHF",
34
+ "CLF" => "UF",
35
+ "CLP" => "$",
36
+ "CNY" => "¥",
37
+ "COP" => "$",
38
+ "CRC" => "₡",
39
+ "CUC" => "$",
40
+ "CUP" => "$",
41
+ "CVE" => "$",
42
+ "CZK" => "Kč",
43
+ "DJF" => "Fdj",
44
+ "DKK" => "kr.",
45
+ "DOP" => "$",
46
+ "DZD" => "د.ج",
47
+ "EGP" => "ج.م",
48
+ "ERN" => "Nfk",
49
+ "ETB" => "Br",
50
+ "EUR" => "€",
51
+ "FJD" => "$",
52
+ "FKP" => "£",
53
+ "GBP" => "£",
54
+ "GEL" => "₾",
55
+ "GHS" => "₵",
56
+ "GIP" => "£",
57
+ "GMD" => "D",
58
+ "GNF" => "Fr",
59
+ "GTQ" => "Q",
60
+ "GYD" => "$",
61
+ "HKD" => "$",
62
+ "HNL" => "L",
63
+ "HTG" => "G",
64
+ "HUF" => "Ft",
65
+ "IDR" => "Rp",
66
+ "ILS" => "₪",
67
+ "INR" => "₹",
68
+ "IQD" => "ع.د",
69
+ "IRR" => "﷼",
70
+ "ISK" => "kr.",
71
+ "JMD" => "$",
72
+ "JOD" => "د.ا",
73
+ "JPY" => "¥",
74
+ "KES" => "KSh",
75
+ "KGS" => "som",
76
+ "KHR" => "៛",
77
+ "KMF" => "Fr",
78
+ "KPW" => "₩",
79
+ "KRW" => "₩",
80
+ "KWD" => "د.ك",
81
+ "KYD" => "$",
82
+ "KZT" => "₸",
83
+ "LAK" => "₭",
84
+ "LBP" => "ل.ل",
85
+ "LKR" => "₨",
86
+ "LRD" => "$",
87
+ "LSL" => "L",
88
+ "LYD" => "ل.د",
89
+ "MAD" => "د.م.",
90
+ "MDL" => "L",
91
+ "MGA" => "Ar",
92
+ "MKD" => "ден",
93
+ "MMK" => "K",
94
+ "MNT" => "₮",
95
+ "MOP" => "P",
96
+ "MRU" => "UM",
97
+ "MUR" => "₨",
98
+ "MVR" => "MVR",
99
+ "MWK" => "MK",
100
+ "MXN" => "$",
101
+ "MYR" => "RM",
102
+ "MZN" => "MTn",
103
+ "NAD" => "$",
104
+ "NGN" => "₦",
105
+ "NIO" => "C$",
106
+ "NOK" => "kr",
107
+ "NPR" => "Rs.",
108
+ "NZD" => "$",
109
+ "OMR" => "ر.ع.",
110
+ "PAB" => "B/.",
111
+ "PEN" => "S/",
112
+ "PGK" => "K",
113
+ "PHP" => "₱",
114
+ "PKR" => "₨",
115
+ "PLN" => "zł",
116
+ "PYG" => "₲",
117
+ "QAR" => "ر.ق",
118
+ "RON" => "Lei",
119
+ "RSD" => "RSD",
120
+ "RUB" => "₽",
121
+ "RWF" => "FRw",
122
+ "SAR" => "ر.س",
123
+ "SBD" => "$",
124
+ "SCR" => "₨",
125
+ "SDG" => "£",
126
+ "SEK" => "kr",
127
+ "SGD" => "$",
128
+ "SHP" => "£",
129
+ "SKK" => "Sk",
130
+ "SLE" => "Le",
131
+ "SLL" => "Le",
132
+ "SOS" => "Sh",
133
+ "SRD" => "$",
134
+ "SSP" => "£",
135
+ "STD" => "Db",
136
+ "STN" => "Db",
137
+ "SVC" => "₡",
138
+ "SYP" => "£S",
139
+ "SZL" => "E",
140
+ "THB" => "฿",
141
+ "TJS" => "ЅМ",
142
+ "TMT" => "m",
143
+ "TND" => "د.ت",
144
+ "TOP" => "T$",
145
+ "TRY" => "₺",
146
+ "TTD" => "$",
147
+ "TWD" => "$",
148
+ "TZS" => "Sh",
149
+ "UAH" => "₴",
150
+ "UGX" => "USh",
151
+ "USD" => "$",
152
+ "UYU" => "$U",
153
+ "UZS" => "so'm",
154
+ "VES" => "Bs",
155
+ "VND" => "₫",
156
+ "VUV" => "Vt",
157
+ "WST" => "T",
158
+ "XAF" => "CFA",
159
+ "XAG" => "oz t",
160
+ "XAU" => "oz t",
161
+ "XBA" => "",
162
+ "XBB" => "",
163
+ "XBC" => "",
164
+ "XBD" => "",
165
+ "XCD" => "$",
166
+ "XCG" => "Cg",
167
+ "XDR" => "SDR",
168
+ "XOF" => "Fr",
169
+ "XPD" => "oz t",
170
+ "XPF" => "Fr",
171
+ "XPT" => "oz t",
172
+ "XTS" => "",
173
+ "YER" => "﷼",
174
+ "ZAR" => "R",
175
+ "ZMK" => "ZK",
176
+ "ZMW" => "K",
177
+ "ZWG" => "ZiG"
178
+ }
179
+
180
+ def self.get_symbol(code)
181
+ SYMBOLS[code.upcase.to_s]
182
+ end
183
+
184
+ end
@@ -1,7 +1,7 @@
1
1
  require 'time'
2
2
  require 'filesize'
3
- require 'money'
4
3
  require 'cgi'
4
+ require 'morpheus/currency'
5
5
 
6
6
  DEFAULT_DATE_FORMAT = "%x"
7
7
  DEFAULT_TIME_FORMAT = "%x %I:%M %p"
@@ -403,8 +403,8 @@ def format_sig_dig(n, sigdig=3, min_sigdig=nil, pad_zeros=false)
403
403
  v
404
404
  end
405
405
 
406
- def currency_sym(currency)
407
- Money::Currency.new((currency || 'USD').to_sym).symbol
406
+ def currency_symbol(currency)
407
+ Morpheus::Currency.get_symbol(currency) || Morpheus::Currency.get_symbol("USD")
408
408
  end
409
409
 
410
410
  # returns currency amount formatted like "$4,5123.00". 0.00 is formatted as "$0"
@@ -418,16 +418,16 @@ def format_currency(amount, currency='USD', opts={})
418
418
 
419
419
  amount = amount.to_f
420
420
  if amount == 0
421
- return currency_sym(currency).to_s + "0"
421
+ return currency_symbol(currency).to_s + "0"
422
422
  # elsif amount.to_f < 0.01
423
423
  # # return exponent notation like 3.4e-09
424
- # return currency_sym(currency).to_s + "#{amount}"
424
+ # return currency_symbol(currency).to_s + "#{amount}"
425
425
  else
426
426
  sigdig = opts[:sigdig] ? opts[:sigdig].to_i : 2 # max decimal digits
427
427
  min_sigdig = opts[:min_sigdig] ? opts[:min_sigdig].to_i : (sigdig || 2) # min decimal digits
428
428
  display_value = format_sig_dig(amount, sigdig, min_sigdig, opts[:pad_zeros])
429
429
  display_value = format_number(display_value) # commas
430
- rtn = currency_sym(currency).to_s + display_value
430
+ rtn = currency_symbol(currency).to_s + display_value
431
431
  if amount.to_i < 0
432
432
  rtn = "(#{rtn})"
433
433
  if opts[:minus_color]
data/morpheus-cli.gemspec CHANGED
@@ -31,6 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency 'mime-types'
32
32
  spec.add_dependency "http"
33
33
  spec.add_dependency "rubyzip", '~> 2.3.2'
34
- spec.add_dependency "money"
35
34
  spec.add_dependency "test-unit"
36
35
  end
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: 8.0.12
4
+ version: 8.0.12.2
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: 2025-12-25 00:00:00.000000000 Z
14
+ date: 2026-01-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: tins
@@ -181,20 +181,6 @@ dependencies:
181
181
  - - "~>"
182
182
  - !ruby/object:Gem::Version
183
183
  version: 2.3.2
184
- - !ruby/object:Gem::Dependency
185
- name: money
186
- requirement: !ruby/object:Gem::Requirement
187
- requirements:
188
- - - ">="
189
- - !ruby/object:Gem::Version
190
- version: '0'
191
- type: :runtime
192
- prerelease: false
193
- version_requirements: !ruby/object:Gem::Requirement
194
- requirements:
195
- - - ">="
196
- - !ruby/object:Gem::Version
197
- version: '0'
198
184
  - !ruby/object:Gem::Dependency
199
185
  name: test-unit
200
186
  requirement: !ruby/object:Gem::Requirement
@@ -637,6 +623,7 @@ files:
637
623
  - lib/morpheus/cli/option_parser.rb
638
624
  - lib/morpheus/cli/option_types.rb
639
625
  - lib/morpheus/cli/version.rb
626
+ - lib/morpheus/currency.rb
640
627
  - lib/morpheus/ext/hash.rb
641
628
  - lib/morpheus/ext/nil_class.rb
642
629
  - lib/morpheus/ext/rest_client.rb