morpheus-cli 8.0.12 → 8.0.12.1

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: 6c05f2fa9d8da972dd6bae523d49b6d412fb950904455b3131920ecee8607a5e
4
+ data.tar.gz: 97c511ce59d17d9e3bfa0a5d99b84396470663933bbb1071b28d98532ffa1b81
5
5
  SHA512:
6
- metadata.gz: 795b92277a1dbc2ad7ec6a933469fcf0ab77f8c7e8d261b5502e218f3a72cfda0856bff14d94b043b4f3371ec2cbd89d8522df6c57b87477d75949e70b975436
7
- data.tar.gz: cfdc201519632bf6f6b51155611b35ffe4c299733bda2c16c19109bae37174112439aa728ecebcff42c1646496060698952af332a444d7a32ab46b5e260789f7
6
+ metadata.gz: 97121f62137da57bd2fffeef54c6b5ecfdaaa5da44369a9fa6366e09db33d64f931ed80f999f38d7aa28762eeaa382a17fcf16dc3fa5008bae422d4809787941
7
+ data.tar.gz: 8f55bd7a9e5c45297617284133de343b49795942fd4d091757d56e84bc6ca10b1ff276424b5ce87e4ad8ed4fc2ea43e143a280217e7fc267f2900dffb5266259
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.1
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
@@ -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
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "8.0.12"
4
+ VERSION = "8.0.12.1"
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.1
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: 2025-12-29 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