stead 0.0.15 → 0.0.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 612f8e899a5d1487b510b0944743fcd6b04a7f10
4
- data.tar.gz: 5e5cad07f6262a3c2c5b4b579cd2ebf78b7ba7c9
3
+ metadata.gz: 62e793e17e1765edb657a261921fe3c19ba690f5
4
+ data.tar.gz: 2a28c763e0cca00d8040ae432ba48608cb0f3124
5
5
  SHA512:
6
- metadata.gz: a53db52e1a837a8d245e91c15e5e9a2cb4c2b3f1fd5f03c6a32f0907989fc6d9bb42a981694543efc5b658d9167013646bb2fb3898f0921d91aa1fd7ddf3cb07
7
- data.tar.gz: 8df260dedfa4aac0100d1dfdcd374594b559bbd51a14c431885ae2de482c19403992596456a15671eaa290fd35beb4533d7ec4f00d50529b0c3f229437499c7e
6
+ metadata.gz: 22b2463f2b3ab2df482ce668abdd0e28affd82c2bb85173cf5856ac83f3eb7a1bb33eba01c1d96c72d7cc62a3b9dfd0041fec5799d5ee37363a7dc16fe56ccd6
7
+ data.tar.gz: 64341772b27ff772a55a39acafdec4067af15492c5f19015fc2263f587882f1f8a903faa02713484e45b632230dc73d4363444ceda47ec7a4157f4c9d2bbfcc5
data/Gemfile CHANGED
@@ -17,5 +17,4 @@ end
17
17
  group :development, :test do
18
18
  gem 'pry'
19
19
  gem 'equivalent-xml'
20
- gem 'rb-readline'
21
20
  end
data/Gemfile.lock CHANGED
@@ -1,21 +1,20 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- coderay (1.0.8)
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.9.10)
12
- coderay (~> 1.0.5)
13
- method_source (~> 0.8)
14
- slop (~> 3.3.1)
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.3.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
@@ -28,7 +28,10 @@
28
28
  <langmaterial>
29
29
  <language langcode="eng"/>
30
30
  </langmaterial>
31
-
31
+ <physdesc>
32
+ <extent></extent>
33
+ </physdesc>
34
+ <unitdate></unitdate>
32
35
  </did>
33
36
  <accessrestrict >
34
37
  <head>Access to Collection</head>
data/stead.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "stead"
8
- s.version = "0.0.15"
8
+ s.version = "0.0.16"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jason Ronallo"]
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.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Ronallo