stead 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +7 -9
- data/bin/csv2ead +4 -1
- data/lib/stead/ead.rb +28 -0
- data/lib/stead/templates/ead.xml +4 -1
- data/stead.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62e793e17e1765edb657a261921fe3c19ba690f5
|
4
|
+
data.tar.gz: 2a28c763e0cca00d8040ae432ba48608cb0f3124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22b2463f2b3ab2df482ce668abdd0e28affd82c2bb85173cf5856ac83f3eb7a1bb33eba01c1d96c72d7cc62a3b9dfd0041fec5799d5ee37363a7dc16fe56ccd6
|
7
|
+
data.tar.gz: 64341772b27ff772a55a39acafdec4067af15492c5f19015fc2263f587882f1f8a903faa02713484e45b632230dc73d4363444ceda47ec7a4157f4c9d2bbfcc5
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
coderay (1.0
|
4
|
+
coderay (1.1.0)
|
5
5
|
equivalent-xml (0.1.6)
|
6
6
|
nokogiri
|
7
|
-
method_source (0.8)
|
7
|
+
method_source (0.8.2)
|
8
8
|
mini_portile (0.5.1)
|
9
9
|
nokogiri (1.6.0)
|
10
10
|
mini_portile (~> 0.5.0)
|
11
|
-
pry (0.
|
12
|
-
coderay (~> 1.0
|
13
|
-
method_source (~> 0.8)
|
14
|
-
slop (~> 3.
|
11
|
+
pry (0.10.1)
|
12
|
+
coderay (~> 1.1.0)
|
13
|
+
method_source (~> 0.8.1)
|
14
|
+
slop (~> 3.4)
|
15
15
|
rake (10.0.2)
|
16
|
-
rb-readline (0.4.2)
|
17
16
|
shoulda (2.11.3)
|
18
|
-
slop (3.
|
17
|
+
slop (3.6.0)
|
19
18
|
trollop (1.16.2)
|
20
19
|
|
21
20
|
PLATFORMS
|
@@ -26,6 +25,5 @@ DEPENDENCIES
|
|
26
25
|
nokogiri
|
27
26
|
pry
|
28
27
|
rake
|
29
|
-
rb-readline
|
30
28
|
shoulda
|
31
29
|
trollop
|
data/bin/csv2ead
CHANGED
@@ -26,6 +26,9 @@ EOS
|
|
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
28
|
opt :idcontainers, 'Add id attributes to containers to show parent child relationships among containers in same component part.'
|
29
|
+
opt :unitid, 'Add a unitid to ead/eadheader/archdesc/did/unitid', :type => String
|
30
|
+
opt :extent, 'Add an extent to ead/eadheader/archdesc/did/physdesc/extent', :type => String
|
31
|
+
opt :unitdate, 'Add a unitdate to ead/eadheader/archdesc/did/unitdate', :type => String
|
29
32
|
end
|
30
33
|
|
31
34
|
# unless opts[:output] or opts[:stdout]
|
@@ -47,7 +50,7 @@ basename = File.basename(opts[:csv], '.csv')
|
|
47
50
|
ead_options[:eadid] = basename.sub(/_container_list.*$/, '')
|
48
51
|
ead_options[:base_url] = opts[:baseurl] if opts[:baseurl]
|
49
52
|
ead_options[:idcontainers] = true if opts[:idcontainers]
|
50
|
-
[:template, :url].each do |key|
|
53
|
+
[:template, :url, :unitid, :extent, :unitdate].each do |key|
|
51
54
|
ead_options[key] = opts[key] if opts[key]
|
52
55
|
end
|
53
56
|
|
data/lib/stead/ead.rb
CHANGED
@@ -11,6 +11,9 @@ module Stead
|
|
11
11
|
# component_parts are the rows in the csv file
|
12
12
|
@component_parts = csv_to_a
|
13
13
|
@idcontainers = opts[:idcontainers]
|
14
|
+
@unitid = opts[:unitid]
|
15
|
+
@extent = opts[:extent]
|
16
|
+
@unitdate = opts[:unitdate]
|
14
17
|
end
|
15
18
|
|
16
19
|
def pick_template(opts)
|
@@ -47,10 +50,35 @@ module Stead
|
|
47
50
|
end
|
48
51
|
end
|
49
52
|
|
53
|
+
def add_archdesc_unitid
|
54
|
+
if @unitid
|
55
|
+
# binding.pry
|
56
|
+
unitid_elem = @ead.xpath('//xmlns:archdesc/xmlns:did/xmlns:unitid').first
|
57
|
+
unitid_elem.content = @unitid
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_archdesc_extent
|
62
|
+
if @extent
|
63
|
+
extent_elem = @ead.xpath('//xmlns:archdesc/xmlns:did/xmlns:physdesc/xmlns:extent').first
|
64
|
+
extent_elem.content = @extent
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def add_archdesc_unitdate
|
69
|
+
if @unitdate
|
70
|
+
unitdate_elem = @ead.xpath('//xmlns:archdesc/xmlns:did/xmlns:unitdate').first
|
71
|
+
unitdate_elem.content = @unitdate
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
50
75
|
def to_ead
|
51
76
|
@ead = template.dup
|
52
77
|
add_eadid
|
53
78
|
add_eadid_url
|
79
|
+
add_archdesc_unitid
|
80
|
+
add_archdesc_extent
|
81
|
+
add_archdesc_unitdate
|
54
82
|
@dsc = @ead.xpath('//xmlns:archdesc/xmlns:dsc')[0]
|
55
83
|
if series?
|
56
84
|
add_series
|
data/lib/stead/templates/ead.xml
CHANGED
data/stead.gemspec
CHANGED