Sha256: 18b26f6e2c12fbd7978a1a46a0115af21a78006d54a00839f4c8a42de6ffe1a3

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 Bytes

Contents

require "genomer"
require "heredoc_unindent"

class GenomerPluginValidate < Genomer::Plugin
  require 'genomer-plugin-validate/validator'
  require 'genomer-plugin-validate/group'

  def run
    name = arguments.shift
    return self.class.help_message if name.nil?

    group = Group.groups[name]
    raise Genomer::Error, "Unknown validation group '#{name}'" if group.nil?

    group.validators.map{|i| Validator.validators[i]}.map do |v|
      v.new(arguments,flags).run
    end.flatten * "\n"
  end

  def self.help_message
    msg = <<-EOS.unindent
      USAGE: genomer validate <GROUP>
      
      Available validation groups:
    EOS
    msg << Group.groups.map do |(k,v)|
      str =  '  '
      str << k.ljust(15)
      str << v.description
    end * "\n"
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
genomer-plugin-validate-0.0.2 lib/genomer-plugin-validate.rb
genomer-plugin-validate-0.0.1 lib/genomer-plugin-validate.rb