ddr-ingesttools 0.4.0 → 0.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/migrate_ddr_to_rdr.rb +46 -0
- data/config/locales/en.yml +2 -0
- data/lib/ddr/ingesttools.rb +1 -0
- data/lib/ddr/ingesttools/ddr_rdr_migrator.rb +16 -0
- data/lib/ddr/ingesttools/ddr_rdr_migrator/column_remover.rb +25 -0
- data/lib/ddr/ingesttools/ddr_rdr_migrator/column_renamer.rb +39 -0
- data/lib/ddr/ingesttools/ddr_rdr_migrator/file_path_adder.rb +79 -0
- data/lib/ddr/ingesttools/ddr_rdr_migrator/license_mapper.rb +30 -0
- data/lib/ddr/ingesttools/ddr_rdr_migrator/manifest_parser.rb +21 -0
- data/lib/ddr/ingesttools/ddr_rdr_migrator/metadata_overwriter.rb +54 -0
- data/lib/ddr/ingesttools/ddr_rdr_migrator/migrator.rb +96 -0
- data/lib/ddr/ingesttools/ddr_rdr_migrator/work_nester.rb +48 -0
- data/lib/ddr/ingesttools/version.rb +1 -1
- data/spec/ddr_rdr_migrator/column_remover_spec.rb +34 -0
- data/spec/ddr_rdr_migrator/column_renamer_spec.rb +33 -0
- data/spec/ddr_rdr_migrator/file_path_adder_spec.rb +25 -0
- data/spec/ddr_rdr_migrator/license_mapper_spec.rb +43 -0
- data/spec/ddr_rdr_migrator/metadata_overwriter_spec.rb +47 -0
- data/spec/ddr_rdr_migrator/migrator_spec.rb +25 -0
- data/spec/ddr_rdr_migrator/work_nester_spec.rb +54 -0
- data/spec/fixtures/ddr_rdr_migrator/manifests/sorted_manifest.csv +4 -0
- data/spec/fixtures/ddr_rdr_migrator/manifests/sorted_manifest_with_file_paths.csv +4 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/bag-info.txt +3 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/bagit.txt +2 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/METADATA.csv +4 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/objects/changeme_665/data1.csv +4 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/objects/changeme_665/data3.csv +4 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/objects/changeme_667/data2.csv +4 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/manifest-md5.txt +4 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/manifest-sha1.txt +4 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/tagmanifest-md5.txt +4 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/tagmanifest-sha1.txt +4 -0
- data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664.csv +4 -0
- data/spec/fixtures/ddr_rdr_migrator/target/changeme-664/manifest.csv +4 -0
- metadata +57 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d2ab42a2c3e3ab0d929c0b346b9b0970c0e62f2
|
4
|
+
data.tar.gz: 068d8e7ff7c47ee8667d3a54dd3031ac6227b0e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fd9a3cd3919af65fcb6c38fa5eabc64e1aa104d285dcfa2cf9557f9b9f628553f17b84622d132e2d8038c9eabb4733405038f42d8aef17651c7ef63e629c502
|
7
|
+
data.tar.gz: 7143337a35fb8e29ca458ea6f0c7614dece7c6cf9de8fd160cc58fb5a7f9483f0fc830ca1fd48682799a20ce6c823c505a6accae2f182fb41e6a41e8b812263f
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'i18n'
|
4
|
+
require 'ddr/ingesttools'
|
5
|
+
require 'optparse'
|
6
|
+
|
7
|
+
options = {}
|
8
|
+
|
9
|
+
puts I18n.t('marquee')
|
10
|
+
puts I18n.t('suite.name')
|
11
|
+
puts I18n.t('ddr_rdr_migrator.name')
|
12
|
+
puts I18n.t('marquee')
|
13
|
+
|
14
|
+
# Parse command line arguments
|
15
|
+
parser = OptionParser.new do |opts|
|
16
|
+
opts.banner = 'Usage: migrate_ddr_to_rdr.rb [options]'
|
17
|
+
|
18
|
+
opts.on('-f', '--files FILE_PATH', 'Path to exported files') do |v|
|
19
|
+
options[:files] = v
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.on('-m', '--metadata METADATA_FILE', 'Path to DDR metadata export file') do |v|
|
23
|
+
options[:metadata] = v
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on('-o', '--outfile OUTPUT_FILE', 'Path to which updated manifest file should be written') do |v|
|
27
|
+
options[:outfile] = v
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
begin
|
33
|
+
parser.parse!
|
34
|
+
mandatory = [ :files, :metadata, :outfile ]
|
35
|
+
missing = mandatory.select{ |param| options[param].nil? }
|
36
|
+
unless missing.empty?
|
37
|
+
raise OptionParser::MissingArgument.new(missing.join(', '))
|
38
|
+
end
|
39
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
|
40
|
+
puts $!.to_s
|
41
|
+
puts parser
|
42
|
+
exit(false)
|
43
|
+
end
|
44
|
+
|
45
|
+
migrator = Ddr::IngestTools::DdrRdrMigrator::Migrator.new(options)
|
46
|
+
migrator.call
|
data/config/locales/en.yml
CHANGED
@@ -2,6 +2,8 @@ en:
|
|
2
2
|
marquee: ==================================================
|
3
3
|
suite:
|
4
4
|
name: DDR Ingest Tools
|
5
|
+
ddr_rdr_migrator:
|
6
|
+
name: DDR to RDR Migrator
|
5
7
|
manifest_ark_minter:
|
6
8
|
name: Manifest ARK Minter
|
7
9
|
use_default_config_file: 'Will use default configuration file: %{default_config_file}'
|
data/lib/ddr/ingesttools.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative 'ddr_rdr_migrator/column_remover'
|
2
|
+
require_relative 'ddr_rdr_migrator/column_renamer'
|
3
|
+
require_relative 'ddr_rdr_migrator/file_path_adder'
|
4
|
+
require_relative 'ddr_rdr_migrator/license_mapper'
|
5
|
+
require_relative 'ddr_rdr_migrator/manifest_parser'
|
6
|
+
require_relative 'ddr_rdr_migrator/metadata_overwriter'
|
7
|
+
require_relative 'ddr_rdr_migrator/migrator'
|
8
|
+
require_relative 'ddr_rdr_migrator/work_nester'
|
9
|
+
|
10
|
+
require 'byebug'
|
11
|
+
|
12
|
+
module Ddr::IngestTools
|
13
|
+
module DdrRdrMigrator
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
2
|
+
class ColumnRemover
|
3
|
+
|
4
|
+
attr_reader :logger, :manifest
|
5
|
+
|
6
|
+
UNNEEDED_COLUMNS = [ 'model', 'pid' ].freeze
|
7
|
+
|
8
|
+
def initialize(logger: nil, manifest:)
|
9
|
+
@logger = logger || Logger.new(STDOUT)
|
10
|
+
@manifest = manifest
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
remove
|
15
|
+
manifest
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def remove
|
21
|
+
UNNEEDED_COLUMNS.each { |col| manifest.delete(col) }
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
4
|
+
class ColumnRenamer
|
5
|
+
|
6
|
+
attr_reader :logger
|
7
|
+
attr_accessor :manifest
|
8
|
+
|
9
|
+
HEADER_MAP = { 'permanent_id' => 'ark',
|
10
|
+
'date' => 'available',
|
11
|
+
'spatial' => 'based_near',
|
12
|
+
'type' => 'resource_type',
|
13
|
+
'relation' => 'related_url',
|
14
|
+
'rights' => 'license',
|
15
|
+
'citation' => 'bibliographic_citation'
|
16
|
+
}
|
17
|
+
|
18
|
+
def initialize(logger: nil, manifest:)
|
19
|
+
@logger = logger || Logger.new(STDOUT)
|
20
|
+
@manifest = manifest
|
21
|
+
end
|
22
|
+
|
23
|
+
def call
|
24
|
+
rename
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def rename
|
30
|
+
csv_array = manifest.to_a
|
31
|
+
csv_headers = csv_array[0]
|
32
|
+
new_headers = csv_headers.map { |hdr| HEADER_MAP.fetch(hdr, hdr) }
|
33
|
+
csv_array[0] = new_headers
|
34
|
+
csv_string = CSV.generate { |csv_out| csv_array.each { |array| csv_out << array } }
|
35
|
+
CSV.parse(csv_string, headers: true)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
2
|
+
class FilePathAdder
|
3
|
+
|
4
|
+
attr_reader :files, :logger, :manifest
|
5
|
+
|
6
|
+
def initialize(files:, logger: nil, manifest:)
|
7
|
+
@files = files
|
8
|
+
@logger = logger || Logger.new(STDOUT)
|
9
|
+
@manifest = manifest
|
10
|
+
end
|
11
|
+
|
12
|
+
def call
|
13
|
+
scan_files(files)
|
14
|
+
update_manifest
|
15
|
+
manifest
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def item_files
|
21
|
+
@item_files ||= {}
|
22
|
+
end
|
23
|
+
|
24
|
+
def scan_files(dirpath)
|
25
|
+
Dir.foreach(dirpath).each do |entry|
|
26
|
+
next if [ '.', '..' ].include?(entry)
|
27
|
+
file_loc = File.join(dirpath, entry)
|
28
|
+
if File.directory?(file_loc)
|
29
|
+
scan_files(file_loc)
|
30
|
+
else
|
31
|
+
handle_file(file_loc)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def handle_file(file_loc)
|
37
|
+
partial_path = file_partial_path(file_loc)
|
38
|
+
add_to_item_files(partial_path) if payload_file?(partial_path)
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_to_item_files(partial_path)
|
42
|
+
item_pid = item_pid(partial_path)
|
43
|
+
item_files[item_pid] ||= []
|
44
|
+
item_files[item_pid] << partial_path
|
45
|
+
end
|
46
|
+
|
47
|
+
def file_partial_path(file_loc)
|
48
|
+
file_loc.sub(files, '').sub(/^#{File::SEPARATOR}/, '')
|
49
|
+
end
|
50
|
+
|
51
|
+
def payload_file?(partial_path)
|
52
|
+
partial_path.start_with?(File.join('data', 'objects')) && !File.basename(partial_path).start_with?('.')
|
53
|
+
end
|
54
|
+
|
55
|
+
def item_pid(partial_path)
|
56
|
+
munged_pid = partial_path.split(File::SEPARATOR)[-2]
|
57
|
+
munged_pid.sub('_', ':')
|
58
|
+
end
|
59
|
+
|
60
|
+
def update_manifest
|
61
|
+
add_file_column
|
62
|
+
add_file_column_values
|
63
|
+
end
|
64
|
+
|
65
|
+
def add_file_column
|
66
|
+
manifest.each do |row|
|
67
|
+
row['file'] = nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def add_file_column_values
|
72
|
+
item_files.each do |k,v|
|
73
|
+
row = manifest.find { |row| row['pid'] == k }
|
74
|
+
row['file'] = v.join('|')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
2
|
+
class LicenseMapper
|
3
|
+
|
4
|
+
attr_reader :logger, :manifest
|
5
|
+
|
6
|
+
LICENSE_MAP = { 'https://creativecommons.org/publicdomain/zero/1.0/' =>
|
7
|
+
'http://creativecommons.org/publicdomain/zero/1.0/' }
|
8
|
+
|
9
|
+
def initialize(logger: nil, manifest:)
|
10
|
+
@logger = logger || Logger.new(STDOUT)
|
11
|
+
@manifest = manifest
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
map_licenses
|
16
|
+
manifest
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def map_licenses
|
22
|
+
manifest.each do |row|
|
23
|
+
if LICENSE_MAP.keys.include?(row['license'])
|
24
|
+
row['license'] = LICENSE_MAP[row['license']]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
4
|
+
class ManifestParser
|
5
|
+
|
6
|
+
attr_reader :manifest_file_path
|
7
|
+
|
8
|
+
def initialize(manifest_file_path)
|
9
|
+
@manifest_file_path = manifest_file_path
|
10
|
+
end
|
11
|
+
|
12
|
+
def as_csv_table
|
13
|
+
@csv_table ||= CSV.read(manifest_file_path, headers: true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def headers
|
17
|
+
as_csv_table.headers
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
2
|
+
class MetadataOverwriter
|
3
|
+
|
4
|
+
attr_reader :logger, :manifest
|
5
|
+
|
6
|
+
OVERWRITTEN_FIELDS = %w[ creator publisher available license ].freeze
|
7
|
+
|
8
|
+
def initialize(logger: nil, manifest:)
|
9
|
+
@logger = logger || Logger.new(STDOUT)
|
10
|
+
@manifest = manifest
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
overwrite
|
15
|
+
manifest
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def overwrite
|
21
|
+
populate_overwriting_attributes
|
22
|
+
overwrite_values
|
23
|
+
end
|
24
|
+
|
25
|
+
def collection_row
|
26
|
+
@collection_row = manifest.find { |row| row['model'] == 'Collection' }
|
27
|
+
end
|
28
|
+
|
29
|
+
def item_rows
|
30
|
+
manifest.select { |row| row['model'] == 'Item' }
|
31
|
+
end
|
32
|
+
|
33
|
+
def overwrite_values
|
34
|
+
item_rows.each do |row|
|
35
|
+
collection_overwriting_attributes.each do |field, value|
|
36
|
+
row[field] = value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def collection_overwriting_attributes
|
42
|
+
@overwriting_attributes ||= populate_overwriting_attributes
|
43
|
+
end
|
44
|
+
|
45
|
+
def populate_overwriting_attributes
|
46
|
+
attrs = {}
|
47
|
+
OVERWRITTEN_FIELDS.each do |field|
|
48
|
+
attrs[field] = collection_row[field] if collection_row[field]
|
49
|
+
end
|
50
|
+
attrs
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
2
|
+
class Migrator
|
3
|
+
|
4
|
+
attr_reader :files, :logger, :metadata, :outfile
|
5
|
+
attr_writer :manifest
|
6
|
+
|
7
|
+
def initialize(files:, logger: nil, metadata:, outfile:)
|
8
|
+
@files = files
|
9
|
+
@logger = logger || Logger.new(STDOUT)
|
10
|
+
@metadata = metadata
|
11
|
+
@outfile = outfile
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
sort_manifest
|
16
|
+
rename_columns
|
17
|
+
nest_works
|
18
|
+
map_licenses
|
19
|
+
overwrite_metadata
|
20
|
+
add_file_paths
|
21
|
+
remove_columns
|
22
|
+
write_manifest
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def manifest
|
28
|
+
@manifest ||= as_csv_table(metadata)
|
29
|
+
end
|
30
|
+
|
31
|
+
def sort_manifest
|
32
|
+
sorted = manifest.sort_by { |row| [ row['model'], row['pid'] ] }
|
33
|
+
self.manifest = CSV::Table.new(sorted)
|
34
|
+
end
|
35
|
+
|
36
|
+
def add_file_paths
|
37
|
+
file_path_adder.call
|
38
|
+
end
|
39
|
+
|
40
|
+
def map_licenses
|
41
|
+
license_mapper.call
|
42
|
+
end
|
43
|
+
|
44
|
+
def nest_works
|
45
|
+
work_nester.call
|
46
|
+
end
|
47
|
+
|
48
|
+
def overwrite_metadata
|
49
|
+
metadata_overwriter.call
|
50
|
+
end
|
51
|
+
|
52
|
+
def rename_columns
|
53
|
+
self.manifest = column_renamer.call
|
54
|
+
end
|
55
|
+
|
56
|
+
def column_renamer
|
57
|
+
ColumnRenamer.new(manifest: manifest)
|
58
|
+
end
|
59
|
+
|
60
|
+
def remove_columns
|
61
|
+
self.manifest = column_remover.call
|
62
|
+
end
|
63
|
+
|
64
|
+
def column_remover
|
65
|
+
ColumnRemover.new(logger: logger, manifest: manifest)
|
66
|
+
end
|
67
|
+
|
68
|
+
def file_path_adder
|
69
|
+
FilePathAdder.new(files: files, logger: logger, manifest: manifest)
|
70
|
+
end
|
71
|
+
|
72
|
+
def license_mapper
|
73
|
+
LicenseMapper.new(logger: logger, manifest: manifest)
|
74
|
+
end
|
75
|
+
|
76
|
+
def metadata_overwriter
|
77
|
+
MetadataOverwriter.new(logger: logger, manifest: manifest)
|
78
|
+
end
|
79
|
+
|
80
|
+
def work_nester
|
81
|
+
WorkNester.new(logger: logger, manifest: manifest)
|
82
|
+
end
|
83
|
+
|
84
|
+
def write_manifest
|
85
|
+
File.open(outfile, 'w') do |f|
|
86
|
+
f.write(manifest.to_csv)
|
87
|
+
end
|
88
|
+
logger.info("Updated manifest file is at #{outfile}")
|
89
|
+
end
|
90
|
+
|
91
|
+
def as_csv_table(file)
|
92
|
+
ManifestParser.new(file).as_csv_table
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
2
|
+
class WorkNester
|
3
|
+
|
4
|
+
attr_reader :logger, :manifest
|
5
|
+
|
6
|
+
def initialize(logger: nil, manifest:)
|
7
|
+
@logger = logger || Logger.new(STDOUT)
|
8
|
+
@manifest = manifest
|
9
|
+
end
|
10
|
+
|
11
|
+
def call
|
12
|
+
nest_works
|
13
|
+
manifest
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def nest_works
|
19
|
+
add_parent_ark_column
|
20
|
+
add_parent_ark_values
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_parent_ark_column
|
24
|
+
manifest.each do |row|
|
25
|
+
row['parent_ark'] = nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_parent_ark_values
|
30
|
+
item_rows.each do |row|
|
31
|
+
row['parent_ark'] = collection_ark
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def collection_row
|
36
|
+
manifest.find { |row| row['model'] == 'Collection' }
|
37
|
+
end
|
38
|
+
|
39
|
+
def item_rows
|
40
|
+
manifest.select { |row| row['model'] == 'Item' }
|
41
|
+
end
|
42
|
+
|
43
|
+
def collection_ark
|
44
|
+
@collection_ark ||= collection_row['ark']
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
4
|
+
|
5
|
+
RSpec.describe ColumnRemover do
|
6
|
+
|
7
|
+
subject { described_class.new(manifest: manifest) }
|
8
|
+
|
9
|
+
let(:ddr_headers) do
|
10
|
+
[ 'pid', 'model', 'title', 'alternative', 'creator', 'contributor', 'affiliation', 'publisher', 'date',
|
11
|
+
'temporal', 'description', 'subject', 'spatial', 'language', 'type', 'format', 'relation', 'rights',
|
12
|
+
'provenance', 'citation', 'permanent_id', 'doi' ]
|
13
|
+
end
|
14
|
+
let(:rdr_headers) do
|
15
|
+
[ 'title', 'alternative', 'creator', 'contributor', 'affiliation', 'publisher', 'date', 'temporal',
|
16
|
+
'description', 'subject', 'spatial', 'language', 'type', 'format', 'relation', 'rights', 'provenance',
|
17
|
+
'citation', 'permanent_id', 'doi' ]
|
18
|
+
end
|
19
|
+
let(:ddr_data) do
|
20
|
+
[ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v' ]
|
21
|
+
end
|
22
|
+
let(:rdr_data) do
|
23
|
+
[ 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v' ]
|
24
|
+
end
|
25
|
+
let(:manifest) { CSV::Table.new([ CSV::Row.new(ddr_headers, ddr_data) ]) }
|
26
|
+
let(:expected_manifest) { CSV::Table.new([ CSV::Row.new(rdr_headers, rdr_data) ]) }
|
27
|
+
|
28
|
+
it 'removes the appropriate manifest columns' do
|
29
|
+
expect(subject.call).to eq(expected_manifest)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
4
|
+
|
5
|
+
RSpec.describe ColumnRenamer do
|
6
|
+
|
7
|
+
subject do
|
8
|
+
described_class.new(manifest: manifest)
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:ddr_headers) do
|
12
|
+
[ 'title', 'alternative', 'creator', 'contributor', 'affiliation', 'publisher', 'date', 'temporal',
|
13
|
+
'description', 'subject', 'spatial', 'language', 'type', 'format', 'relation', 'rights',
|
14
|
+
'provenance', 'citation', 'permanent_id', 'doi' ]
|
15
|
+
end
|
16
|
+
let(:rdr_headers) do
|
17
|
+
[ 'title', 'alternative', 'creator', 'contributor', 'affiliation', 'publisher', 'available', 'temporal',
|
18
|
+
'description', 'subject', 'based_near', 'language', 'resource_type', 'format', 'related_url', 'license',
|
19
|
+
'provenance', 'bibliographic_citation', 'ark', 'doi' ]
|
20
|
+
end
|
21
|
+
let(:data) do
|
22
|
+
[ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't' ]
|
23
|
+
end
|
24
|
+
let(:manifest) { CSV::Table.new([ CSV::Row.new(ddr_headers, data) ]) }
|
25
|
+
let(:expected_manifest) { CSV::Table.new([ CSV::Row.new(rdr_headers, data) ]) }
|
26
|
+
|
27
|
+
it 'renames the appropriate manifest columns' do
|
28
|
+
expect(subject.call).to eq(expected_manifest)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
4
|
+
|
5
|
+
RSpec.describe FilePathAdder do
|
6
|
+
|
7
|
+
subject do
|
8
|
+
described_class.new(files: files, manifest: manifest)
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:files) { File.join('spec', 'fixtures', 'ddr_rdr_migrator', 'source', 'changeme-664',
|
12
|
+
'changeme-664-export-file') }
|
13
|
+
let(:manifest_file) { File.join('spec', 'fixtures', 'ddr_rdr_migrator', 'manifests', 'sorted_manifest.csv') }
|
14
|
+
let(:manifest) { CSV.read(manifest_file, headers: true) }
|
15
|
+
let(:expected_manifest_file) { File.join('spec', 'fixtures', 'ddr_rdr_migrator', 'manifests',
|
16
|
+
'sorted_manifest_with_file_paths.csv') }
|
17
|
+
let(:expected_manifest) { CSV.read(expected_manifest_file, headers: true) }
|
18
|
+
|
19
|
+
it 'adds the appropriate file paths to the manifest' do
|
20
|
+
expect(subject.call).to eq(expected_manifest)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
4
|
+
|
5
|
+
RSpec.describe LicenseMapper do
|
6
|
+
|
7
|
+
subject { described_class.new(manifest: manifest) }
|
8
|
+
|
9
|
+
let(:headers) do
|
10
|
+
%w[ pid model title license ]
|
11
|
+
end
|
12
|
+
let(:ddr_data) do
|
13
|
+
[ %w[ test:1 Collection a https://creativecommons.org/licenses/by-nc/4.0/ ],
|
14
|
+
%w[ test:2 Item aa https://creativecommons.org/publicdomain/zero/1.0/ ],
|
15
|
+
%w[ test:3 Item ba https://creativecommons.org/licenses/by/4.0/ ]
|
16
|
+
]
|
17
|
+
end
|
18
|
+
let(:rdr_data) do
|
19
|
+
[ %w[ test:1 Collection a https://creativecommons.org/licenses/by-nc/4.0/ ],
|
20
|
+
%w[ test:2 Item aa http://creativecommons.org/publicdomain/zero/1.0/ ],
|
21
|
+
%w[ test:3 Item ba https://creativecommons.org/licenses/by/4.0/ ]
|
22
|
+
]
|
23
|
+
end
|
24
|
+
let(:manifest) do
|
25
|
+
CSV::Table.new([ CSV::Row.new(headers, ddr_data[0]),
|
26
|
+
CSV::Row.new(headers, ddr_data[1]),
|
27
|
+
CSV::Row.new(headers, ddr_data[2])
|
28
|
+
])
|
29
|
+
end
|
30
|
+
let(:expected_manifest) do
|
31
|
+
CSV::Table.new([ CSV::Row.new(headers, rdr_data[0]),
|
32
|
+
CSV::Row.new(headers, rdr_data[1]),
|
33
|
+
CSV::Row.new(headers, rdr_data[2])
|
34
|
+
])
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'overwrites the appropriate manifest cells' do
|
38
|
+
expect(subject.call).to eq(expected_manifest)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
4
|
+
|
5
|
+
RSpec.describe MetadataOverwriter do
|
6
|
+
|
7
|
+
subject { described_class.new(manifest: manifest) }
|
8
|
+
|
9
|
+
let(:headers) do
|
10
|
+
%w[
|
11
|
+
pid model title alternative creator contributor affiliation publisher available temporal description
|
12
|
+
subject based_near language resource_type format related_url provenance bibliographic_citation
|
13
|
+
ark doi license
|
14
|
+
]
|
15
|
+
end
|
16
|
+
let(:ddr_data) do
|
17
|
+
[ %w[ test:1 Collection a b c d e f g h i j k l m n o p q r s ],
|
18
|
+
%w[ test:2 Item aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at ],
|
19
|
+
%w[ test:3 Item ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs ]
|
20
|
+
]
|
21
|
+
end
|
22
|
+
let(:rdr_data) do
|
23
|
+
[ %w[ test:1 Collection a b c d e f g h i j k l m n o p q r s ],
|
24
|
+
%w[ test:2 Item aa ab c ad ae f g ah ai aj ak al am an ao ap aq ar as at ],
|
25
|
+
%w[ test:3 Item ba bb c bd be f g bh bi bj bk bl bm bn bo bp bq br bs ]
|
26
|
+
]
|
27
|
+
end
|
28
|
+
let(:manifest) do
|
29
|
+
CSV::Table.new([ CSV::Row.new(headers, ddr_data[0]),
|
30
|
+
CSV::Row.new(headers, ddr_data[1]),
|
31
|
+
CSV::Row.new(headers, ddr_data[2])
|
32
|
+
])
|
33
|
+
end
|
34
|
+
let(:expected_manifest) do
|
35
|
+
CSV::Table.new([ CSV::Row.new(headers, rdr_data[0]),
|
36
|
+
CSV::Row.new(headers, rdr_data[1]),
|
37
|
+
CSV::Row.new(headers, rdr_data[2])
|
38
|
+
])
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'overwrites the appropriate manifest cells' do
|
42
|
+
expect(subject.call).to eq(expected_manifest)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
5
|
+
RSpec.describe Migrator do
|
6
|
+
|
7
|
+
subject { described_class.new(files: files, metadata: metadata, outfile: outfile) }
|
8
|
+
|
9
|
+
let(:files) { File.join('spec', 'fixtures', 'ddr_rdr_migrator', 'source', 'changeme-664',
|
10
|
+
'changeme-664-export-file') }
|
11
|
+
let(:metadata) { File.join('spec', 'fixtures', 'ddr_rdr_migrator', 'source', 'changeme-664', 'changeme-664.csv') }
|
12
|
+
let(:outdir) { Dir.mktmpdir }
|
13
|
+
let(:outfile) { File.join(outdir, 'manifest.csv') }
|
14
|
+
let(:expected_outfile) { File.join('spec', 'fixtures', 'ddr_rdr_migrator', 'target', 'changeme-664',
|
15
|
+
'manifest.csv') }
|
16
|
+
|
17
|
+
after { FileUtils.remove_dir outdir }
|
18
|
+
|
19
|
+
it 'produces the expected manifest file' do
|
20
|
+
subject.call
|
21
|
+
expect(CSV.read(outfile, headers: true)).to eq(CSV.read(expected_outfile, headers: true))
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Ddr::IngestTools::DdrRdrMigrator
|
4
|
+
|
5
|
+
RSpec.describe WorkNester do
|
6
|
+
|
7
|
+
subject { described_class.new(manifest: manifest) }
|
8
|
+
|
9
|
+
let(:ddr_headers) do
|
10
|
+
%w[
|
11
|
+
pid model title alternative creator contributor affiliation publisher available temporal description
|
12
|
+
subject based_near language resource_type format related_url provenance bibliographic_citation
|
13
|
+
ark doi license
|
14
|
+
]
|
15
|
+
end
|
16
|
+
let(:rdr_headers) do
|
17
|
+
%w[
|
18
|
+
pid model title alternative creator contributor affiliation publisher available temporal description
|
19
|
+
subject based_near language resource_type format related_url provenance bibliographic_citation
|
20
|
+
ark doi license parent_ark
|
21
|
+
]
|
22
|
+
end
|
23
|
+
let(:ddr_data) do
|
24
|
+
[ %w[ test:1 Collection a b c d e f g h i j k l m n o p q r s t ],
|
25
|
+
%w[ test:2 Item aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at ],
|
26
|
+
%w[ test:3 Item ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt ]
|
27
|
+
]
|
28
|
+
end
|
29
|
+
let(:rdr_data) do
|
30
|
+
[ %w[ test:1 Collection a b c d e f g h i j k l m n o p q r s t ],
|
31
|
+
%w[ test:2 Item aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at r ],
|
32
|
+
%w[ test:3 Item ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt r ]
|
33
|
+
]
|
34
|
+
end
|
35
|
+
let(:manifest) do
|
36
|
+
CSV::Table.new([ CSV::Row.new(ddr_headers, ddr_data[0]),
|
37
|
+
CSV::Row.new(ddr_headers, ddr_data[1]),
|
38
|
+
CSV::Row.new(ddr_headers, ddr_data[2])
|
39
|
+
])
|
40
|
+
end
|
41
|
+
let(:expected_manifest) do
|
42
|
+
CSV::Table.new([ CSV::Row.new(rdr_headers, rdr_data[0]),
|
43
|
+
CSV::Row.new(rdr_headers, rdr_data[1]),
|
44
|
+
CSV::Row.new(rdr_headers, rdr_data[2])
|
45
|
+
])
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'adds and populates the parent ark column' do
|
49
|
+
expect(subject.call).to eq(expected_manifest)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,4 @@
|
|
1
|
+
pid,model,permanent_id,affiliation,creator,date,description,format,publisher,rights,subject,title,type
|
2
|
+
changeme:664,Collection,ark:/99999/fk4320780h,"Test University, Dept of Tests","Grainger, Hermione|Potter, Harry|Weasley, Ron",2018-07-25,"Duis ut consequat ligula. Etiam a accumsan ex. Nulla egestas sem non dui fermentum commodo. Pellentesque tincidunt eros augue, vitae fringilla massa lacinia id. Donec porttitor maximus leo quis laoreet. Cras lacus velit, egestas eget leo quis, iaculis consequat dui. Donec in risus id augue consequat elementum eu id elit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut cursus, sem quis vulputate vulputate, tortor est iaculis purus, non aliquam nisi justo et ex. Aenean vitae justo odio. Proin sodales vulputate cursus. In hac habitasse platea dictumst.",RB,Test Digital Repository,https://creativecommons.org/licenses/by/4.0/,mauris porta felis|nullam convallis|quisque,Suspendisse eget bibendum orci,Dataset
|
3
|
+
changeme:665,Item,ark:/99999/fk4x63sb4r,,"Malfoy, Draco",2018-07-25,"Sed nec auctor nulla, vitae interdum quam. Duis tristique nisi et dictum lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet volutpat leo, ac aliquam felis vulputate quis. Vestibulum malesuada molestie orci, dapibus euismod nulla pellentesque et. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin dictum nunc a quam varius faucibus a eget augue. Mauris vitae eros sed arcu pellentesque commodo. Proin varius est eu libero ornare, a malesuada dolor elementum. Nunc tincidunt tristique lectus, at sagittis dolor luctus vel. Quisque rhoncus rutrum nibh quis egestas. Nunc eget magna ac est placerat vehicula ac vitae velit. Nulla fermentum est nibh, ac commodo justo convallis id. Quisque luctus vitae ipsum ac tempus. Mauris scelerisque dolor a sem laoreet consequat. Vivamus dui erat, pulvinar eu imperdiet eu, malesuada sed justo.",,Test Digital Repository,,,"Duis iaculis tortor quis nunc facilisis, eget pretium ligula dictum",
|
4
|
+
changeme:667,Item,ark:/99999/fk4pr8306q,,,,"Vivamus malesuada convallis sapien, a aliquet tellus tempus bibendum. Nunc accumsan, nibh quis interdum lobortis, odio ipsum pretium augue, eu lacinia justo tellus porttitor dui. Ut elit magna, suscipit in auctor et, vulputate sit amet diam. Pellentesque sed nunc at dui tincidunt blandit ultricies convallis turpis. Nam et faucibus purus, sit amet commodo mauris. Vivamus nisl leo, commodo ut pretium vitae, porta nec lectus. Phasellus ac nibh fringilla tellus laoreet congue et eu tortor. Quisque in pulvinar augue. Maecenas rutrum dolor vitae ornare cursus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.",XY,,,,Ut sed libero et lorem porttitor cursus non ac eros.,
|
@@ -0,0 +1,4 @@
|
|
1
|
+
pid,model,permanent_id,affiliation,creator,date,description,format,publisher,rights,subject,title,type,file
|
2
|
+
changeme:664,Collection,ark:/99999/fk4320780h,"Test University, Dept of Tests","Grainger, Hermione|Potter, Harry|Weasley, Ron",2018-07-25,"Duis ut consequat ligula. Etiam a accumsan ex. Nulla egestas sem non dui fermentum commodo. Pellentesque tincidunt eros augue, vitae fringilla massa lacinia id. Donec porttitor maximus leo quis laoreet. Cras lacus velit, egestas eget leo quis, iaculis consequat dui. Donec in risus id augue consequat elementum eu id elit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut cursus, sem quis vulputate vulputate, tortor est iaculis purus, non aliquam nisi justo et ex. Aenean vitae justo odio. Proin sodales vulputate cursus. In hac habitasse platea dictumst.",RB,Test Digital Repository,https://creativecommons.org/licenses/by/4.0/,mauris porta felis|nullam convallis|quisque,Suspendisse eget bibendum orci,Dataset,
|
3
|
+
changeme:665,Item,ark:/99999/fk4x63sb4r,,"Malfoy, Draco",2018-07-25,"Sed nec auctor nulla, vitae interdum quam. Duis tristique nisi et dictum lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet volutpat leo, ac aliquam felis vulputate quis. Vestibulum malesuada molestie orci, dapibus euismod nulla pellentesque et. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin dictum nunc a quam varius faucibus a eget augue. Mauris vitae eros sed arcu pellentesque commodo. Proin varius est eu libero ornare, a malesuada dolor elementum. Nunc tincidunt tristique lectus, at sagittis dolor luctus vel. Quisque rhoncus rutrum nibh quis egestas. Nunc eget magna ac est placerat vehicula ac vitae velit. Nulla fermentum est nibh, ac commodo justo convallis id. Quisque luctus vitae ipsum ac tempus. Mauris scelerisque dolor a sem laoreet consequat. Vivamus dui erat, pulvinar eu imperdiet eu, malesuada sed justo.",,Test Digital Repository,,,"Duis iaculis tortor quis nunc facilisis, eget pretium ligula dictum",,data/objects/changeme_665/data1.csv|data/objects/changeme_665/data3.csv
|
4
|
+
changeme:667,Item,ark:/99999/fk4pr8306q,,,,"Vivamus malesuada convallis sapien, a aliquet tellus tempus bibendum. Nunc accumsan, nibh quis interdum lobortis, odio ipsum pretium augue, eu lacinia justo tellus porttitor dui. Ut elit magna, suscipit in auctor et, vulputate sit amet diam. Pellentesque sed nunc at dui tincidunt blandit ultricies convallis turpis. Nam et faucibus purus, sit amet commodo mauris. Vivamus nisl leo, commodo ut pretium vitae, porta nec lectus. Phasellus ac nibh fringilla tellus laoreet congue et eu tortor. Quisque in pulvinar augue. Maecenas rutrum dolor vitae ornare cursus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.",XY,,,,Ut sed libero et lorem porttitor cursus non ac eros.,,data/objects/changeme_667/data2.csv
|
data/spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/manifest-sha1.txt
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
9f12fda0b1c817958a9004cf4a0b42dad05220e0 data/METADATA.csv
|
2
|
+
4c4665b408134d8f6995d1640a7f2d4eeee5c010 data/objects/changeme_665/data1.csv
|
3
|
+
37a0502601ed54f31d119d5355ade2c29ea530ea data/objects/changeme_665/data3.csv
|
4
|
+
ab84c8b1187123c4d627bea511714dd723b56dbe data/objects/changeme_667/data2.csv
|
@@ -0,0 +1,4 @@
|
|
1
|
+
pid,model,permanent_id,affiliation,creator,date,description,format,publisher,rights,subject,title,type
|
2
|
+
changeme:665,Item,ark:/99999/fk4x63sb4r,,"Malfoy, Draco",2018-07-25,"Sed nec auctor nulla, vitae interdum quam. Duis tristique nisi et dictum lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet volutpat leo, ac aliquam felis vulputate quis. Vestibulum malesuada molestie orci, dapibus euismod nulla pellentesque et. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin dictum nunc a quam varius faucibus a eget augue. Mauris vitae eros sed arcu pellentesque commodo. Proin varius est eu libero ornare, a malesuada dolor elementum. Nunc tincidunt tristique lectus, at sagittis dolor luctus vel. Quisque rhoncus rutrum nibh quis egestas. Nunc eget magna ac est placerat vehicula ac vitae velit. Nulla fermentum est nibh, ac commodo justo convallis id. Quisque luctus vitae ipsum ac tempus. Mauris scelerisque dolor a sem laoreet consequat. Vivamus dui erat, pulvinar eu imperdiet eu, malesuada sed justo.",,Test Digital Repository,https://creativecommons.org/licenses/by/4.0/,,"Duis iaculis tortor quis nunc facilisis, eget pretium ligula dictum",
|
3
|
+
changeme:667,Item,ark:/99999/fk4pr8306q,,,,"Vivamus malesuada convallis sapien, a aliquet tellus tempus bibendum. Nunc accumsan, nibh quis interdum lobortis, odio ipsum pretium augue, eu lacinia justo tellus porttitor dui. Ut elit magna, suscipit in auctor et, vulputate sit amet diam. Pellentesque sed nunc at dui tincidunt blandit ultricies convallis turpis. Nam et faucibus purus, sit amet commodo mauris. Vivamus nisl leo, commodo ut pretium vitae, porta nec lectus. Phasellus ac nibh fringilla tellus laoreet congue et eu tortor. Quisque in pulvinar augue. Maecenas rutrum dolor vitae ornare cursus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.",XY,,,,Ut sed libero et lorem porttitor cursus non ac eros.,
|
4
|
+
changeme:664,Collection,ark:/99999/fk4320780h,"Test University, Dept of Tests","Grainger, Hermione|Potter, Harry|Weasley, Ron",2018-07-25,"Duis ut consequat ligula. Etiam a accumsan ex. Nulla egestas sem non dui fermentum commodo. Pellentesque tincidunt eros augue, vitae fringilla massa lacinia id. Donec porttitor maximus leo quis laoreet. Cras lacus velit, egestas eget leo quis, iaculis consequat dui. Donec in risus id augue consequat elementum eu id elit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut cursus, sem quis vulputate vulputate, tortor est iaculis purus, non aliquam nisi justo et ex. Aenean vitae justo odio. Proin sodales vulputate cursus. In hac habitasse platea dictumst.",RB,Test Digital Repository,https://creativecommons.org/publicdomain/zero/1.0/,mauris porta felis|nullam convallis|quisque,Suspendisse eget bibendum orci,Dataset
|
@@ -0,0 +1,4 @@
|
|
1
|
+
ark,affiliation,creator,available,description,format,publisher,license,subject,title,resource_type,parent_ark,file
|
2
|
+
ark:/99999/fk4320780h,"Test University, Dept of Tests","Grainger, Hermione|Potter, Harry|Weasley, Ron",2018-07-25,"Duis ut consequat ligula. Etiam a accumsan ex. Nulla egestas sem non dui fermentum commodo. Pellentesque tincidunt eros augue, vitae fringilla massa lacinia id. Donec porttitor maximus leo quis laoreet. Cras lacus velit, egestas eget leo quis, iaculis consequat dui. Donec in risus id augue consequat elementum eu id elit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut cursus, sem quis vulputate vulputate, tortor est iaculis purus, non aliquam nisi justo et ex. Aenean vitae justo odio. Proin sodales vulputate cursus. In hac habitasse platea dictumst.",RB,Test Digital Repository,http://creativecommons.org/publicdomain/zero/1.0/,mauris porta felis|nullam convallis|quisque,Suspendisse eget bibendum orci,Dataset,
|
3
|
+
ark:/99999/fk4x63sb4r,,"Grainger, Hermione|Potter, Harry|Weasley, Ron",2018-07-25,"Sed nec auctor nulla, vitae interdum quam. Duis tristique nisi et dictum lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet volutpat leo, ac aliquam felis vulputate quis. Vestibulum malesuada molestie orci, dapibus euismod nulla pellentesque et. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin dictum nunc a quam varius faucibus a eget augue. Mauris vitae eros sed arcu pellentesque commodo. Proin varius est eu libero ornare, a malesuada dolor elementum. Nunc tincidunt tristique lectus, at sagittis dolor luctus vel. Quisque rhoncus rutrum nibh quis egestas. Nunc eget magna ac est placerat vehicula ac vitae velit. Nulla fermentum est nibh, ac commodo justo convallis id. Quisque luctus vitae ipsum ac tempus. Mauris scelerisque dolor a sem laoreet consequat. Vivamus dui erat, pulvinar eu imperdiet eu, malesuada sed justo.",,Test Digital Repository,http://creativecommons.org/publicdomain/zero/1.0/,,"Duis iaculis tortor quis nunc facilisis, eget pretium ligula dictum",,ark:/99999/fk4320780h,data/objects/changeme_665/data1.csv|data/objects/changeme_665/data3.csv
|
4
|
+
ark:/99999/fk4pr8306q,,"Grainger, Hermione|Potter, Harry|Weasley, Ron",2018-07-25,"Vivamus malesuada convallis sapien, a aliquet tellus tempus bibendum. Nunc accumsan, nibh quis interdum lobortis, odio ipsum pretium augue, eu lacinia justo tellus porttitor dui. Ut elit magna, suscipit in auctor et, vulputate sit amet diam. Pellentesque sed nunc at dui tincidunt blandit ultricies convallis turpis. Nam et faucibus purus, sit amet commodo mauris. Vivamus nisl leo, commodo ut pretium vitae, porta nec lectus. Phasellus ac nibh fringilla tellus laoreet congue et eu tortor. Quisque in pulvinar augue. Maecenas rutrum dolor vitae ornare cursus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.",XY,Test Digital Repository,http://creativecommons.org/publicdomain/zero/1.0/,,Ut sed libero et lorem porttitor cursus non ac eros.,,ark:/99999/fk4320780h,data/objects/changeme_667/data2.csv
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-ingesttools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Coble
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03
|
11
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ezid-client
|
@@ -98,6 +98,7 @@ description: A collection of Ruby tools supporting ingest into the Duke Digital
|
|
98
98
|
email:
|
99
99
|
- jim.coble@duke.edu
|
100
100
|
executables:
|
101
|
+
- migrate_ddr_to_rdr.rb
|
101
102
|
- mint_manifest_arks.rb
|
102
103
|
extensions: []
|
103
104
|
extra_rdoc_files: []
|
@@ -110,16 +111,47 @@ files:
|
|
110
111
|
- LICENSE.txt
|
111
112
|
- README.md
|
112
113
|
- Rakefile
|
114
|
+
- bin/migrate_ddr_to_rdr.rb
|
113
115
|
- bin/mint_manifest_arks.rb
|
114
116
|
- config/locales/en.yml
|
115
117
|
- ddr-ingesttools.gemspec
|
116
118
|
- lib/ddr/ingesttools.rb
|
119
|
+
- lib/ddr/ingesttools/ddr_rdr_migrator.rb
|
120
|
+
- lib/ddr/ingesttools/ddr_rdr_migrator/column_remover.rb
|
121
|
+
- lib/ddr/ingesttools/ddr_rdr_migrator/column_renamer.rb
|
122
|
+
- lib/ddr/ingesttools/ddr_rdr_migrator/file_path_adder.rb
|
123
|
+
- lib/ddr/ingesttools/ddr_rdr_migrator/license_mapper.rb
|
124
|
+
- lib/ddr/ingesttools/ddr_rdr_migrator/manifest_parser.rb
|
125
|
+
- lib/ddr/ingesttools/ddr_rdr_migrator/metadata_overwriter.rb
|
126
|
+
- lib/ddr/ingesttools/ddr_rdr_migrator/migrator.rb
|
127
|
+
- lib/ddr/ingesttools/ddr_rdr_migrator/work_nester.rb
|
117
128
|
- lib/ddr/ingesttools/manifest_ark_minter.rb
|
118
129
|
- lib/ddr/ingesttools/manifest_ark_minter/configuration.rb
|
119
130
|
- lib/ddr/ingesttools/manifest_ark_minter/manifest_parser.rb
|
120
131
|
- lib/ddr/ingesttools/manifest_ark_minter/manifest_updater.rb
|
121
132
|
- lib/ddr/ingesttools/manifest_ark_minter/minter.rb
|
122
133
|
- lib/ddr/ingesttools/version.rb
|
134
|
+
- spec/ddr_rdr_migrator/column_remover_spec.rb
|
135
|
+
- spec/ddr_rdr_migrator/column_renamer_spec.rb
|
136
|
+
- spec/ddr_rdr_migrator/file_path_adder_spec.rb
|
137
|
+
- spec/ddr_rdr_migrator/license_mapper_spec.rb
|
138
|
+
- spec/ddr_rdr_migrator/metadata_overwriter_spec.rb
|
139
|
+
- spec/ddr_rdr_migrator/migrator_spec.rb
|
140
|
+
- spec/ddr_rdr_migrator/work_nester_spec.rb
|
141
|
+
- spec/fixtures/ddr_rdr_migrator/manifests/sorted_manifest.csv
|
142
|
+
- spec/fixtures/ddr_rdr_migrator/manifests/sorted_manifest_with_file_paths.csv
|
143
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/bag-info.txt
|
144
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/bagit.txt
|
145
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/METADATA.csv
|
146
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/objects/changeme_665/data1.csv
|
147
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/objects/changeme_665/data3.csv
|
148
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/objects/changeme_667/data2.csv
|
149
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/manifest-md5.txt
|
150
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/manifest-sha1.txt
|
151
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/tagmanifest-md5.txt
|
152
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/tagmanifest-sha1.txt
|
153
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664.csv
|
154
|
+
- spec/fixtures/ddr_rdr_migrator/target/changeme-664/manifest.csv
|
123
155
|
- spec/fixtures/rdr_importer/configs/default.yml
|
124
156
|
- spec/fixtures/rdr_importer/manifests/manifest_with_all_arks.csv
|
125
157
|
- spec/fixtures/rdr_importer/manifests/manifest_with_no_arks.csv
|
@@ -143,9 +175,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
175
|
version: '0'
|
144
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
177
|
requirements:
|
146
|
-
- - "
|
178
|
+
- - ">"
|
147
179
|
- !ruby/object:Gem::Version
|
148
|
-
version:
|
180
|
+
version: 1.3.1
|
149
181
|
requirements: []
|
150
182
|
rubyforge_project:
|
151
183
|
rubygems_version: 2.6.14
|
@@ -153,6 +185,27 @@ signing_key:
|
|
153
185
|
specification_version: 4
|
154
186
|
summary: Ruby tools supporting ingest into the Duke Digital Repository.
|
155
187
|
test_files:
|
188
|
+
- spec/ddr_rdr_migrator/column_remover_spec.rb
|
189
|
+
- spec/ddr_rdr_migrator/column_renamer_spec.rb
|
190
|
+
- spec/ddr_rdr_migrator/file_path_adder_spec.rb
|
191
|
+
- spec/ddr_rdr_migrator/license_mapper_spec.rb
|
192
|
+
- spec/ddr_rdr_migrator/metadata_overwriter_spec.rb
|
193
|
+
- spec/ddr_rdr_migrator/migrator_spec.rb
|
194
|
+
- spec/ddr_rdr_migrator/work_nester_spec.rb
|
195
|
+
- spec/fixtures/ddr_rdr_migrator/manifests/sorted_manifest.csv
|
196
|
+
- spec/fixtures/ddr_rdr_migrator/manifests/sorted_manifest_with_file_paths.csv
|
197
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/bag-info.txt
|
198
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/bagit.txt
|
199
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/METADATA.csv
|
200
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/objects/changeme_665/data1.csv
|
201
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/objects/changeme_665/data3.csv
|
202
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/data/objects/changeme_667/data2.csv
|
203
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/manifest-md5.txt
|
204
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/manifest-sha1.txt
|
205
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/tagmanifest-md5.txt
|
206
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664-export-file/tagmanifest-sha1.txt
|
207
|
+
- spec/fixtures/ddr_rdr_migrator/source/changeme-664/changeme-664.csv
|
208
|
+
- spec/fixtures/ddr_rdr_migrator/target/changeme-664/manifest.csv
|
156
209
|
- spec/fixtures/rdr_importer/configs/default.yml
|
157
210
|
- spec/fixtures/rdr_importer/manifests/manifest_with_all_arks.csv
|
158
211
|
- spec/fixtures/rdr_importer/manifests/manifest_with_no_arks.csv
|