ddr-ingesttools 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da2dcac7b528e65bc0bd8018a23b2e2c70ce8e2b
4
- data.tar.gz: e7382f1dc99c8a3a0bff6c727b42873c8b6a9d0c
3
+ metadata.gz: fb22fa65d3323b243dcafc3b999f55d42894b130
4
+ data.tar.gz: f85324eb9f8efd80febb1de7c9d1a5f2f87898aa
5
5
  SHA512:
6
- metadata.gz: 3bad7d1ad9f3c973226d050ca15270cdb8744af773cc73fa197558f6061032f3b1a520631bfcf7d34a1dff9ac1a5a245eaa162c280ea253160860b2cd0f53e5c
7
- data.tar.gz: 79e1e6336eea8d0c0228d0cfc85aabde9e89838f738d0d343da3e2b801dafbd5bca38cf8c05917d7ff57f60730d931765a1979bdf9e00f2f9777fc2fbe66ddf5
6
+ metadata.gz: 88bbc9f8d76a0b11bc0dec289c9bba3fc54efc340b6bfe9a0d7855108b0d040e88c385facda2d5d892a8aad02a18e9f64dc4d243bc547cce4987e7e9dd71df4e
7
+ data.tar.gz: 5e475ae95b4d2ca9c5c8dd4b1d9fa85efc34956f4aac5b9778f62f837b495dd55a5d6d683785526b002a23d131f8caefc6170e46dd485867d5b22e099bbedbae
@@ -35,11 +35,16 @@ parser = OptionParser.new do |opts|
35
35
  options[:collection_title] = v
36
36
  end
37
37
 
38
+ opts.on('--admin_set [ADMIN_SET]', 'Admin set for collection',
39
+ 'required if intending to create a collection-creating Standard Ingest') do |v|
40
+ options[:admin_set] = v
41
+ end
42
+
38
43
  end
39
44
 
40
45
  begin
41
46
  parser.parse!
42
- mandatory = [ :source, :target, :item_id_length]
47
+ mandatory = [ :source, :target, :item_id_length ]
43
48
  missing = mandatory.select{ |param| options[param].nil? }
44
49
  unless missing.empty?
45
50
  raise OptionParser::MissingArgument.new(missing.join(', '))
@@ -15,18 +15,21 @@ module Ddr::IngestTools::DpcFolderConverter
15
15
  Results = Struct.new(:file_map, :errors)
16
16
 
17
17
  attr_reader :source, :target, :data_dir, :item_id_length, :checksums, :copy_files, :collection_title,
18
- :metadata_headers
18
+ :admin_set, :metadata_headers
19
19
  attr_accessor :errors, :file_map, :local_id_metadata, :results
20
20
 
21
- def initialize(source:, target:, item_id_length:, checksums: nil, copy_files: false, collection_title: nil)
21
+ def initialize(source:, target:, item_id_length:, checksums: nil, copy_files: false, collection_title: nil,
22
+ admin_set: nil)
22
23
  @source = source
23
24
  @target = target
24
25
  @item_id_length = item_id_length
25
26
  @checksums = checksums
26
27
  @copy_files = copy_files
27
28
  @collection_title = collection_title
29
+ @admin_set = admin_set
28
30
  @metadata_headers = [ 'path', 'local_id' ]
29
31
  @metadata_headers << 'title' unless collection_title.nil?
32
+ @metadata_headers << 'admin_set' unless admin_set.nil?
30
33
  end
31
34
 
32
35
  def call
@@ -104,12 +107,18 @@ module Ddr::IngestTools::DpcFolderConverter
104
107
 
105
108
  def output_metadata
106
109
  metadata_rows = []
107
- if collection_title
108
- metadata_rows << CSV::Row.new(metadata_headers, [ nil, nil, collection_title ])
110
+ case
111
+ when collection_title && admin_set
112
+ metadata_rows << CSV::Row.new(metadata_headers, [ nil, nil, collection_title, admin_set ])
113
+ when collection_title
114
+ metadata_rows << CSV::Row.new(metadata_headers, [ nil, nil, collection_title ])
115
+ when admin_set
116
+ metadata_rows << CSV::Row.new(metadata_headers, [ nil, nil, admin_set ])
109
117
  end
110
118
  local_id_metadata.each_pair do |k,v|
111
119
  row_elements = [ k, v ]
112
120
  row_elements << nil if collection_title
121
+ row_elements << nil if admin_set
113
122
  metadata_rows << CSV::Row.new(metadata_headers, row_elements)
114
123
  end
115
124
  File.open(File.join(data_dir, SIF_METADATA_FILENAME), 'w') do |file|
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module IngestTools
3
- VERSION = '0.2.1'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -7,4 +7,4 @@ a08c4d5a76d1b8734487be6ffcba66a9baf475c4 data/dpc_targets/T001.tif
7
7
  40f9993d06945544fa57af88f7c3e9102ecc69e3 data/dpc_targets/T002.tif
8
8
  49d77d27bf82ec3dafa1967490594883f5e8b432 data/intermediate_files/abc001001.jpg
9
9
  260b3c2d20a7126de96671d29f73ba09d13b61ba data/intermediate_files/abc002001.jpg
10
- 8a7878863fd183436f50060343d3757747772d9f data/metadata.txt
10
+ 21f041cdd694f7755ed84b8cd2668214a43bad6c data/metadata.txt
@@ -169,29 +169,33 @@ module Ddr::IngestTools::DpcFolderConverter
169
169
  end
170
170
  end
171
171
 
172
- describe 'collection titles' do
172
+ describe 'collection titles and admin sets' do
173
173
  let(:checksum_errors) { [] }
174
- describe 'collection title provided' do
174
+ describe 'collection title and admin set provided' do
175
175
  let(:expected_metadata) { [
176
- "path\tlocal_id\ttitle",
177
- "\t\tTest Collection",
178
- "abc001\tabc001\t",
179
- "abc002\tabc002\t",
180
- "abc003\tabc003\t",
181
- "abc001/abc001001.tif\tabc001001\t",
182
- "abc001/abc001002.tif\tabc001002\t",
183
- "abc002/abc002001.tif\tabc002001\t",
184
- "abc003/abc003001.wav\tabc003001\t",
185
- "abc003/abc003002.wav\tabc003002\t",
186
- "dpc_targets/T001.tif\tT001\t",
187
- "dpc_targets/T002.tif\tT002\t"
176
+ "path\tlocal_id\ttitle\tadmin_set",
177
+ "\t\tTest Collection\tfoo",
178
+ "abc001\tabc001\t\t",
179
+ "abc002\tabc002\t\t",
180
+ "abc003\tabc003\t\t",
181
+ "abc001/abc001001.tif\tabc001001\t\t",
182
+ "abc001/abc001002.tif\tabc001002\t\t",
183
+ "abc002/abc002001.tif\tabc002001\t\t",
184
+ "abc003/abc003001.wav\tabc003001\t\t",
185
+ "abc003/abc003002.wav\tabc003002\t\t",
186
+ "dpc_targets/T001.tif\tT001\t\t",
187
+ "dpc_targets/T002.tif\tT002\t\t"
188
188
  ] }
189
189
  let(:expected_manifest) do
190
- File.readlines(File.join('spec', 'fixtures', 'files', 'manifest-sha1-collection-title.txt')).sort
190
+ File.readlines(File.join('spec', 'fixtures', 'files', 'manifest-sha1-collection-title_admin_set.txt')).sort
191
+ end
192
+ before do
193
+ converter_args[:collection_title] = 'Test Collection'
194
+ converter_args[:admin_set] = 'foo'
191
195
  end
192
- before { converter_args[:collection_title] = 'Test Collection' }
193
196
  it_behaves_like 'a conversion to standard ingest format'
194
197
  end
195
198
  end
199
+
196
200
  end
197
201
  end
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.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Coble
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-23 00:00:00.000000000 Z
11
+ date: 2017-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bagit
@@ -106,7 +106,7 @@ files:
106
106
  - lib/ddr/ingesttools/version.rb
107
107
  - spec/fixtures/files/bad-checksums-sha1.txt
108
108
  - spec/fixtures/files/good-checksums-sha1.txt
109
- - spec/fixtures/files/manifest-sha1-collection-title.txt
109
+ - spec/fixtures/files/manifest-sha1-collection-title_admin_set.txt
110
110
  - spec/fixtures/files/manifest-sha1.txt
111
111
  - spec/integration/dpc_folder_converter_spec.rb
112
112
  - spec/spec_helper.rb
@@ -131,14 +131,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.5.1
134
+ rubygems_version: 2.6.11
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Ruby tools supporting ingest into the Duke Digital Repository.
138
138
  test_files:
139
139
  - spec/fixtures/files/bad-checksums-sha1.txt
140
140
  - spec/fixtures/files/good-checksums-sha1.txt
141
- - spec/fixtures/files/manifest-sha1-collection-title.txt
141
+ - spec/fixtures/files/manifest-sha1-collection-title_admin_set.txt
142
142
  - spec/fixtures/files/manifest-sha1.txt
143
143
  - spec/integration/dpc_folder_converter_spec.rb
144
144
  - spec/spec_helper.rb