Class: Suma::Cli::GenerateSchemas
- Inherits:
-
Thor
- Object
- Thor
- Suma::Cli::GenerateSchemas
- Defined in:
- lib/suma/cli/generate_schemas.rb
Overview
GenerateSchemas command to generate Schemas YAML by Metanorma YAML
Constant Summary collapse
- YAML_FILE_EXTENSIONS =
[".yaml", ".yml"].freeze
Instance Method Summary collapse
-
#generate_schemas(metanorma_manifest_file, schema_manifest_file) ⇒ Object
rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity.
Instance Method Details
#generate_schemas(metanorma_manifest_file, schema_manifest_file) ⇒ Object
rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/suma/cli/generate_schemas.rb', line 19 def generate_schemas(, schema_manifest_file) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity = File.() unless File.exist?() raise Errno::ENOENT, "Specified file `#{metanorma_manifest_file}` " \ "not found." end unless File.file?() raise ArgumentError, "Specified path `#{metanorma_manifest_file}` " \ "is not a file." end [, schema_manifest_file].each do |file| if !YAML_FILE_EXTENSIONS.include?(File.extname(file)) raise ArgumentError, "Specified file `#{file}` is not a YAML file." end end run( , schema_manifest_file, exclude_paths: [:exclude_paths] ) end |