morpheus-cli 4.2.14 → 4.2.15

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: e12da692ad20d0ab6db265ec26da63bdd71dbe110381586cea320ac83fe09de2
4
- data.tar.gz: deb39862ff91c6da7bdfe4d2a3a616c6daea0a4b1192f514b78d27d5c8eb22dd
3
+ metadata.gz: b6215b2bb521606b6de3580787cca558fa2925f2c037f5c6bfbf2f1d952e0f81
4
+ data.tar.gz: 64f921b6c079eabda7fdad9bf70f55af423c0cc1a42f6f5ccead6442737a684b
5
5
  SHA512:
6
- metadata.gz: ec460c3243e1f19153f3889b1fda253a17ff5ddc81b26e7fd43313250c76b8e4bac0c534174270377ffb4b0e027515722fd7564f5a7a3b06307c2b3559fdcd2f
7
- data.tar.gz: 8e98be2498dd435aab6e4ed09d46e41a380df9a29f0a39a760d4f20a5d965b9254f34eb0fc65d821d8874a8a4eebca04f7aa3af17afb8c5593e73cb79f25a778
6
+ metadata.gz: ba237f9f75cb4f64d04699ae8feaf3840c87b2cb62c1f0ec224a70aece0a23c76105de608f493f019e44f43ebd72590df226cf61654aee6fa34881754695a82b
7
+ data.tar.gz: 92f3c614362d4dfe3385aecdb8f52847a336d47aa41afc3a9ee6909f221a672454bc98a2e3bfdbe94a48208cebbb9f0293abc7bd9d9c177e7f11ec8b0989a9b6
@@ -65,7 +65,8 @@ class Morpheus::Cli::LibraryOptionTypesCommand
65
65
  fieldLabel: option_type['fieldLabel'],
66
66
  fieldName: option_type['fieldName'],
67
67
  default: option_type['defaultValue'],
68
- required: option_type['required'] ? 'yes' : 'no'
68
+ required: option_type['required'] ? 'yes' : 'no',
69
+ export: option_type['exportMeta'] ? 'yes' : 'no'
69
70
  }
70
71
  end
71
72
  print cyan
@@ -76,7 +77,8 @@ class Morpheus::Cli::LibraryOptionTypesCommand
76
77
  {:fieldLabel => {:display_name => "Field Label"} },
77
78
  {:fieldName => {:display_name => "Field Name"} },
78
79
  :default,
79
- :required
80
+ :required,
81
+ :export,
80
82
  ], options)
81
83
  print reset
82
84
  print_results_pagination(json_response)
@@ -139,6 +141,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
139
141
  "Placeholder" => 'placeHolder',
140
142
  "Default Value" => 'defaultValue',
141
143
  "Required" => lambda {|it| format_boolean(it['required']) },
144
+ "Export As Tag" => lambda {|it| it['exportMeta'].nil? ? '' : format_boolean(it['exportMeta']) },
142
145
  }, option_type)
143
146
  print reset,"\n"
144
147
  return 0
@@ -162,18 +165,14 @@ class Morpheus::Cli::LibraryOptionTypesCommand
162
165
  payload = nil
163
166
  if options[:payload]
164
167
  payload = options[:payload]
165
- # support -O OPTION switch on top of --payload
166
- if options[:options]
167
- payload['optionType'] ||= {}
168
- payload['optionType'].deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) })
169
- end
168
+ payload.deep_merge!({'optionType' => parse_passed_options(options)})
170
169
  else
171
- params = Morpheus::Cli::OptionTypes.prompt(new_option_type_option_types, options[:options], @api_client, options[:params])
172
- if params.key?('required')
173
- params['required'] = ['on','true'].include?(params['required'].to_s)
174
- end
175
- option_type_payload = params
176
- payload = {optionType: option_type_payload}
170
+ payload = {}
171
+ payload.deep_merge!({'optionType' => parse_passed_options(options)})
172
+ option_type_payload = Morpheus::Cli::OptionTypes.prompt(new_option_type_option_types, options[:options], @api_client)
173
+ option_type_payload['required'] = ['on','true'].include?(option_type_payload['required'].to_s) if option_type_payload.key?('required')
174
+ option_type_payload['exportMeta'] = ['on','true'].include?(option_type_payload['exportMeta'].to_s) if option_type_payload.key?('exportMeta')
175
+ payload.deep_merge!({'optionType' => option_type_payload})
177
176
  end
178
177
  @option_types_interface.setopts(options)
179
178
  if options[:dry_run]
@@ -207,27 +206,17 @@ class Morpheus::Cli::LibraryOptionTypesCommand
207
206
  begin
208
207
  option_type = find_option_type_by_name_or_id(args[0])
209
208
  exit 1 if option_type.nil?
210
-
211
209
  if options[:payload]
212
210
  payload = options[:payload]
213
- # support -O OPTION switch on top of --payload
214
- if options[:options]
215
- payload['optionType'] ||= {}
216
- payload['optionType'].deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) })
217
- end
211
+ payload.deep_merge!({'optionType' => parse_passed_options(options)})
218
212
  else
219
- #params = options[:options] || {}
220
- params = Morpheus::Cli::OptionTypes.no_prompt(update_option_type_option_types, options[:options], @api_client, options[:params])
221
- if params.empty?
222
- print_red_alert "Specify at least one option to update"
223
- puts optparse
224
- exit 1
225
- end
226
- if params.key?('required')
227
- params['required'] = ['on','true'].include?(params['required'].to_s)
228
- end
229
- option_type_payload = params
230
- payload = {optionType: option_type_payload}
213
+ payload = {}
214
+ payload.deep_merge!({'optionType' => parse_passed_options(options)})
215
+ option_type_payload = Morpheus::Cli::OptionTypes.no_prompt(update_option_type_option_types, options[:options], @api_client)
216
+ option_type_payload['required'] = ['on','true'].include?(option_type_payload['required'].to_s) if option_type_payload.key?('required')
217
+ option_type_payload['exportMeta'] = ['on','true'].include?(option_type_payload['exportMeta'].to_s) if option_type_payload.key?('exportMeta')
218
+ payload.deep_merge!({'optionType' => option_type_payload})
219
+ raise_command_error "Specify at least one option to update.\n#{optparse}" if payload['optionType'].empty?
231
220
  end
232
221
  @option_types_interface.setopts(options)
233
222
  if options[:dry_run]
@@ -302,6 +291,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
302
291
  {'fieldName' => 'placeHolder', 'fieldLabel' => 'Placeholder', 'type' => 'text', 'displayOrder' => 6},
303
292
  {'fieldName' => 'defaultValue', 'fieldLabel' => 'Default Value', 'type' => 'text', 'displayOrder' => 7},
304
293
  {'fieldName' => 'required', 'fieldLabel' => 'Required', 'type' => 'checkbox', 'defaultValue' => 'off', 'displayOrder' => 8},
294
+ {'fieldName' => 'exportMeta', 'fieldLabel' => 'Export As Tag', 'type' => 'checkbox', 'defaultValue' => 'off', 'description' => 'Export as Tag.', 'displayOrder' => 9},
305
295
  ]
306
296
  end
307
297
 
@@ -622,14 +622,28 @@ module Morpheus
622
622
  if source_type == "local"
623
623
  # prompt for content
624
624
  if file_params['content'].nil?
625
- file_params['content'] = multiline_prompt({'fieldContext' => full_field_key, 'fieldName' => 'content', 'type' => 'code-editor', 'fieldLabel' => 'Content', 'required' => true})
625
+ if options[:no_prompt]
626
+ print Term::ANSIColor.red, "\nMissing Required Option\n\n", Term::ANSIColor.reset
627
+ print Term::ANSIColor.red, " * Content [-O #{full_field_key}.content=] - File Content\n", Term::ANSIColor.reset
628
+ print "\n"
629
+ exit 1
630
+ else
631
+ file_params['content'] = multiline_prompt({'fieldContext' => full_field_key, 'fieldName' => 'content', 'type' => 'code-editor', 'fieldLabel' => 'Content', 'required' => true})
632
+ end
626
633
  end
627
634
  elsif source_type == "url"
628
635
  if file_params['url']
629
636
  file_params['contentPath'] = file_params.delete('url')
630
637
  end
631
638
  if file_params['contentPath'].nil?
632
- file_params['contentPath'] = generic_prompt({'fieldContext' => full_field_key, 'fieldName' => 'url', 'fieldLabel' => 'URL', 'type' => 'text', 'required' => true})
639
+ if options[:no_prompt]
640
+ print Term::ANSIColor.red, "\nMissing Required Option\n\n", Term::ANSIColor.reset
641
+ print Term::ANSIColor.red, " * URL [-O #{full_field_key}.url=] - Path of file in the repository\n", Term::ANSIColor.reset
642
+ print "\n"
643
+ exit 1
644
+ else
645
+ file_params['contentPath'] = generic_prompt({'fieldContext' => full_field_key, 'fieldName' => 'url', 'fieldLabel' => 'URL', 'type' => 'text', 'required' => true})
646
+ end
633
647
  end
634
648
  elsif source_type == "repository"
635
649
  if file_params['repository'].nil?
@@ -637,10 +651,21 @@ module Morpheus
637
651
  file_params['repository'] = {'id' => repository_id}
638
652
  end
639
653
  if file_params['contentPath'].nil?
640
- file_params['contentPath'] = generic_prompt({'fieldContext' => full_field_key, 'fieldName' => 'path', 'fieldLabel' => 'File Path', 'type' => 'text', 'required' => true})
654
+ if options[:no_prompt]
655
+ print Term::ANSIColor.red, "\nMissing Required Option\n\n", Term::ANSIColor.reset
656
+ print Term::ANSIColor.red, " * File Path [-O #{full_field_key}.path=] - Path of file in the repository\n", Term::ANSIColor.reset
657
+ print "\n"
658
+ exit 1
659
+ else
660
+ file_params['contentPath'] = generic_prompt({'fieldContext' => full_field_key, 'fieldName' => 'path', 'fieldLabel' => 'File Path', 'type' => 'text', 'required' => true})
661
+ end
641
662
  end
642
- if file_params['contentRef'].nil?
643
- file_params['contentRef'] = generic_prompt({'fieldContext' => full_field_key, 'fieldName' => 'ref', 'fieldLabel' => 'Version Ref', 'type' => 'text'})
663
+ if !file_params.key?('contentRef')
664
+ if options[:no_prompt]
665
+ # pass
666
+ else
667
+ file_params['contentRef'] = generic_prompt({'fieldContext' => full_field_key, 'fieldName' => 'ref', 'fieldLabel' => 'Version Ref', 'type' => 'text'})
668
+ end
644
669
  end
645
670
  end
646
671
  return file_params
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "4.2.14"
4
+ VERSION = "4.2.15"
5
5
  end
6
6
  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: 4.2.14
4
+ version: 4.2.15
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-14 00:00:00.000000000 Z
14
+ date: 2020-05-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler