bin/convert_dpc_folder.rb in ddr-ingesttools-0.1.0 vs bin/convert_dpc_folder.rb in ddr-ingesttools-0.2.0

- old
+ new

@@ -1,12 +1,13 @@ #!/usr/bin/env ruby require 'ddr/ingesttools' require 'optparse' -# Parse command line arguments options = {} + +# Parse command line arguments parser = OptionParser.new do |opts| opts.banner = 'Usage: convert_dpc_folder.rb [options]' opts.on('-s', '--source SOURCE', 'Path to DPC Folder to be converted') do |v| options[:source] = v @@ -18,10 +19,24 @@ opts.on('-i', '--item_id_length LENGTH', Integer, 'Number of characters to copy from the beginning of each file name', 'to use as the local ID of the item of which that file is a component') do |v| options[:item_id_length] = v end + + opts.on('-c', '--checksums [CHECKSUM_FILE]', 'External checksum file') do |v| + options[:checksums] = v + end + + opts.on('--[no-]copy_files', 'Copy files to target location instead of using a symlink') do |v| + options[:copy_files] = v + end + + opts.on('--collection_title [TITLE]', 'Title for collection', + 'required if intending to create a collection-creating Standard Ingest') do |v| + options[:collection_title] = v + end + end begin parser.parse! mandatory = [ :source, :target, :item_id_length] @@ -33,8 +48,9 @@ puts $!.to_s puts parser exit(false) end -converter_args = [ options[:source], options[:target], options[:item_id_length] ] -converter = Ddr::IngestTools::DpcFolderConverter::Converter.new(*converter_args) -converter.call +converter = Ddr::IngestTools::DpcFolderConverter::Converter.new(options) +results = converter.call +puts I18n.translate('errors.count', { count: results.errors.size }) +results.errors.each { |e| puts e }