class MiGA::Cli::Action::TaxSet
def perform
def perform p = cli.load_project if !cli[:taxfile].nil? cli.say 'Reading tax-file and registering taxonomy' tfh = File.open(cli[:taxfile], 'r') header = nil tfh.each_line do |ln| next if ln =~ /^\s*?$/ r = ln.chomp.split(/\t/, -1) dn = r.shift if header.nil? header = r next end d = p.dataset(dn) if d.nil? warn "Impossible to find dataset at line #{$.}: #{dn}. Ignoring..." next end d.metadata[:tax] = Taxonomy.new(r, header) d.save cli.say "o #{d.name} registered" end tfh.close else cli.ensure_par({ dataset: '-D', taxstring: '-s' }, '%<flag>s is mandatory unless -t is provided') cli.say 'Registering taxonomy' d = cli.load_dataset d.metadata[:tax] = Taxonomy.new(cli[:taxstring]) d.save end end