stead 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/csv2ead +2 -0
- data/lib/stead/ead.rb +20 -0
- data/lib/stead.rb +1 -0
- data/stead.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 612f8e899a5d1487b510b0944743fcd6b04a7f10
|
4
|
+
data.tar.gz: 5e5cad07f6262a3c2c5b4b579cd2ebf78b7ba7c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a53db52e1a837a8d245e91c15e5e9a2cb4c2b3f1fd5f03c6a32f0907989fc6d9bb42a981694543efc5b658d9167013646bb2fb3898f0921d91aa1fd7ddf3cb07
|
7
|
+
data.tar.gz: 8df260dedfa4aac0100d1dfdcd374594b559bbd51a14c431885ae2de482c19403992596456a15671eaa290fd35beb4533d7ec4f00d50529b0c3f229437499c7e
|
data/bin/csv2ead
CHANGED
@@ -25,6 +25,7 @@ EOS
|
|
25
25
|
opt :output, 'Save the file by specifying the filename', :type => String
|
26
26
|
opt :pretty, 'If --output is specified this will pretty indent the container list.'
|
27
27
|
opt :stdout, 'Output full EAD to terminal'
|
28
|
+
opt :idcontainers, 'Add id attributes to containers to show parent child relationships among containers in same component part.'
|
28
29
|
end
|
29
30
|
|
30
31
|
# unless opts[:output] or opts[:stdout]
|
@@ -45,6 +46,7 @@ ead_options = {}
|
|
45
46
|
basename = File.basename(opts[:csv], '.csv')
|
46
47
|
ead_options[:eadid] = basename.sub(/_container_list.*$/, '')
|
47
48
|
ead_options[:base_url] = opts[:baseurl] if opts[:baseurl]
|
49
|
+
ead_options[:idcontainers] = true if opts[:idcontainers]
|
48
50
|
[:template, :url].each do |key|
|
49
51
|
ead_options[key] = opts[key] if opts[key]
|
50
52
|
end
|
data/lib/stead/ead.rb
CHANGED
@@ -10,6 +10,7 @@ module Stead
|
|
10
10
|
@base_url = opts[:base_url] if opts[:base_url]
|
11
11
|
# component_parts are the rows in the csv file
|
12
12
|
@component_parts = csv_to_a
|
13
|
+
@idcontainers = opts[:idcontainers]
|
13
14
|
end
|
14
15
|
|
15
16
|
def pick_template(opts)
|
@@ -218,6 +219,7 @@ module Stead
|
|
218
219
|
end
|
219
220
|
|
220
221
|
def add_containers(cp, did)
|
222
|
+
identifier = nil
|
221
223
|
['1', '2', '3'].each do |container_number|
|
222
224
|
container_type = cp['container ' + container_number + ' type']
|
223
225
|
container_number = cp['container ' + container_number + ' number']
|
@@ -234,6 +236,16 @@ module Stead
|
|
234
236
|
container['type'] = container_type
|
235
237
|
container['label'] = cp['instance type'] if cp['instance type']
|
236
238
|
container.content = container_number
|
239
|
+
|
240
|
+
if @idcontainers
|
241
|
+
# if there is already an identifier then apply it as a parent attribute
|
242
|
+
if identifier
|
243
|
+
container['parent'] = identifier
|
244
|
+
end
|
245
|
+
identifier = stead_uuid
|
246
|
+
container['id'] = identifier
|
247
|
+
end
|
248
|
+
|
237
249
|
did.add_child(container)
|
238
250
|
end
|
239
251
|
end
|
@@ -353,6 +365,14 @@ module Stead
|
|
353
365
|
end
|
354
366
|
end
|
355
367
|
|
368
|
+
private
|
369
|
+
|
370
|
+
def stead_uuid
|
371
|
+
uuid = SecureRandom.uuid
|
372
|
+
cleaned_uuid = uuid.gsub('-', '')
|
373
|
+
"stead_#{cleaned_uuid}"
|
374
|
+
end
|
375
|
+
|
356
376
|
end
|
357
377
|
end
|
358
378
|
|
data/lib/stead.rb
CHANGED
data/stead.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stead
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Ronallo
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.4.3
|
185
185
|
signing_key:
|
186
186
|
specification_version: 3
|
187
187
|
summary: Spreadsheets To Encoded Archival Description
|