Class: NoradCli::UiSeedGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/norad_cli/support/ui_seed_generator.rb

Defined Under Namespace

Classes: InvalidManifestError, ManifestError, ManifestMissingAttributesError, ManifestNotFoundError

Constant Summary collapse

REQUIRED_ATTRIBUTES =
%w[name prog_args test_types].freeze
OPTIONAL_ATTRIBUTES =
%w[category multi_host configurable help_url default_config service].freeze
ALLOWED_ATTRIBUTES =
REQUIRED_ATTRIBUTES | OPTIONAL_ATTRIBUTES

Instance Method Summary collapse

Constructor Details

#initialize(manifest_paths) ⇒ UiSeedGenerator

Returns a new instance of UiSeedGenerator.



11
12
13
14
15
16
17
# File 'lib/norad_cli/support/ui_seed_generator.rb', line 11

def initialize(manifest_paths)
  @manifest_paths = if manifest_paths.empty?
                      Dir.glob('./**/manifest.yml')
                    else
                      manifest_paths
                    end
end

Instance Method Details

#process!Object



19
20
21
22
23
24
25
# File 'lib/norad_cli/support/ui_seed_generator.rb', line 19

def process!
  configurations = []
  @manifest_paths.each { |manifest_path| configurations << configuration_from_manifest(manifest_path) }
  save_seed_file!(configurations)
rescue ManifestError => e
  puts e.message
end