Sha256: 1fbfc450a2d2114267290e943ab26ddaece0ff2502e98a476467b0ea302a15fa

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

#!/usr/bin/env ruby

require 'i18n'
require 'ddr/ingesttools'
require 'optparse'

options = {}

puts I18n.t('marquee')
puts I18n.t('suite.name', version: Ddr::IngestTools::VERSION)
puts I18n.t('ddr_rdr_migrator.name')
puts I18n.t('marquee')

# Parse command line arguments
parser = OptionParser.new do |opts|
  opts.banner = 'Usage: migrate_ddr_to_rdr.rb [options]'

  opts.on('-c', '--checksum_file CHECKSUM_FILE', 'File (with full path) to which checksum file should be written') do |v|
    options[:checksum_file] = v
  end

  opts.on('-f', '--files FILE_PATH', 'Path to exported files') do |v|
    options[:files] = v
  end

  opts.on('-m', '--metadata_file METADATA_FILE', 'DDR metadata export file (with full path)') do |v|
    options[:metadata_file] = v
  end

  opts.on('-o', '--outfile OUTPUT_FILE', 'File (with full path) to which updated manifest file should be written') do |v|
    options[:outfile] = v
  end

end

begin
  parser.parse!
  mandatory = [ :checksum_file, :files, :metadata_file, :outfile ]
  missing = mandatory.select{ |param| options[param].nil? }
  unless missing.empty?
    raise OptionParser::MissingArgument.new(missing.join(', '))
  end
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
  puts $!.to_s
  puts parser
  exit(false)
end

migrator = Ddr::IngestTools::DdrRdrMigrator::Migrator.new(options)
migrator.call

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ddr-ingesttools-0.6.1 bin/migrate_ddr_to_rdr.rb