Class: GenomerPluginValidate

Inherits:
Genomer::Plugin
  • Object
show all
Defined in:
lib/genomer-plugin-validate.rb

Defined Under Namespace

Modules: Group, Validator

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.help_messageObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/genomer-plugin-validate.rb', line 20

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

Instance Method Details

#runObject

Raises:

  • (Genomer::Error)


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/genomer-plugin-validate.rb', line 8

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