Sha256: 3cbb7132e74017baa71e80bdfb16c52002e00ffdd08700a7130c76d77a36edb6

Contents?: true

Size: 1018 Bytes

Versions: 22

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Commands
    module Validator
      include Mixins::Rule
      include Mixins::Configuration

      def self.included(thor)
        thor.class_eval do
          desc "rule [PATH]", "Validate format of a rule file"
          def rule(path)
            # convert str(YAML) to hash or str(path/YAML file) to hash
            rule = load_rule(path)

            # validate rule schema
            validate_rule rule

            puts "Valid format. The input is parsed as the following:"
            puts rule.to_yaml
          end

          desc "config [PATH]", "Validate format of a config file"
          def config(path)
            # convert str(YAML) to hash or str(path/YAML file) to hash
            config = load_config(path)

            # validate config schema
            validate_config config

            puts "Valid format. The input is parsed as the following:"
            puts config.to_yaml
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
mihari-3.12.0 lib/mihari/commands/validator.rb
mihari-3.11.0 lib/mihari/commands/validator.rb
mihari-3.10.1 lib/mihari/commands/validator.rb
mihari-3.10.0 lib/mihari/commands/validator.rb
mihari-3.9.2 lib/mihari/commands/validator.rb
mihari-3.9.1 lib/mihari/commands/validator.rb
mihari-3.9.0 lib/mihari/commands/validator.rb
mihari-3.8.1 lib/mihari/commands/validator.rb
mihari-3.8.0 lib/mihari/commands/validator.rb
mihari-3.7.2 lib/mihari/commands/validator.rb
mihari-3.7.1 lib/mihari/commands/validator.rb
mihari-3.7.0 lib/mihari/commands/validator.rb
mihari-3.6.1 lib/mihari/commands/validator.rb
mihari-3.6.0 lib/mihari/commands/validator.rb
mihari-3.5.0 lib/mihari/commands/validator.rb
mihari-3.4.1 lib/mihari/commands/validator.rb
mihari-3.4.0 lib/mihari/commands/validator.rb
mihari-3.3.0 lib/mihari/commands/validator.rb
mihari-3.2.0 lib/mihari/commands/validator.rb
mihari-3.1.0 lib/mihari/commands/validator.rb