eac 0.0.1
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 +7 -0
- data/.gitignore +22 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +27 -0
- data/LICENSE.txt +21 -0
- data/README.md +19 -0
- data/Rakefile +2 -0
- data/data/99166-w66708pc.xml +116 -0
- data/data/99166-w6bk5j60.xml +66 -0
- data/data/berlin_bach.xml +159 -0
- data/data/rid_331_pid_EACP328.c.xml +168 -0
- data/data/sia_walcott.xml +776 -0
- data/data/yale_cadell.xml +414 -0
- data/eac.gemspec +24 -0
- data/lib/eac.rb +87 -0
- data/lib/eac/version.rb +3 -0
- data/spec/eac_spec.rb +74 -0
- metadata +110 -0
data/lib/eac/version.rb
ADDED
data/spec/eac_spec.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require './eac'
|
2
|
+
|
3
|
+
describe EAC do
|
4
|
+
context "reads file" do
|
5
|
+
it "using EAC shorcut" do
|
6
|
+
File.open("./data/sia_walcott.xml") do |f|
|
7
|
+
eac = EAC(f)
|
8
|
+
eac.should be_a(EAC::Person)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "using EAC::Doc.new" do
|
13
|
+
File.open("./data/sia_walcott.xml") do |f|
|
14
|
+
eac = EAC::Doc.new(f)
|
15
|
+
eac.should be_a(EAC::Doc)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with invalid data" do
|
22
|
+
it "needs entityType" do
|
23
|
+
expect {
|
24
|
+
EAC('<xml><eac-cpf xmlns="urn:isbn:1-931666-33-4"></eac></xml>')
|
25
|
+
}.to raise_error(ArgumentError, "entityType not found")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
context "Person create" do
|
31
|
+
let(:person) do
|
32
|
+
person = nil
|
33
|
+
File.open("./data/sia_walcott.xml") do |f|
|
34
|
+
person = EAC(f)
|
35
|
+
end
|
36
|
+
person
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "with name" do
|
40
|
+
it "finds all names" do
|
41
|
+
person.names.length.should == 5
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "parts" do
|
45
|
+
it "handles a name entry with only one part" do
|
46
|
+
single_part_name = person.names.first
|
47
|
+
parts = single_part_name.parts
|
48
|
+
expect(parts.length).to eq(1)
|
49
|
+
expect(parts[0].local_type).to be_nil
|
50
|
+
expect(parts[0].text).to eq("Walcott, Charles D. (Charles Doolittle), 1850-1927")
|
51
|
+
end
|
52
|
+
|
53
|
+
it "handles a name entry with multiple parts" do
|
54
|
+
multipart_name = person.names[1]
|
55
|
+
expect(multipart_name.parts.length).to eq(3)
|
56
|
+
|
57
|
+
expect(multipart_name.parts[0].local_type).to eq("surname")
|
58
|
+
expect(multipart_name.parts[0].text).to eq("Walcott")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "reports full string" do
|
63
|
+
it "of simple name" do
|
64
|
+
person.names.first.to_s.should == "Walcott, Charles D. (Charles Doolittle), 1850-1927"
|
65
|
+
end
|
66
|
+
|
67
|
+
it "of name with multiple parts" do
|
68
|
+
person.names[1].to_s.should == "Walcott, Charles D., 1850-1927"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eac
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sarah Allen
|
8
|
+
- Sarah Mei
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-08-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.6'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.6'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
description: The initial focus is to read EAC-CPF files that represent an individual
|
57
|
+
person, which will have a <cpfDescription> node. The <cpfDescription> (Corporate
|
58
|
+
body, person or family description) contains information on the name structures,
|
59
|
+
descriptive elements, and relationships.
|
60
|
+
email:
|
61
|
+
- sarah@ultrasaurus.com
|
62
|
+
- sarahmei@gmail.com
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- .gitignore
|
68
|
+
- .rvmrc
|
69
|
+
- Gemfile
|
70
|
+
- Gemfile.lock
|
71
|
+
- LICENSE.txt
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- data/99166-w66708pc.xml
|
75
|
+
- data/99166-w6bk5j60.xml
|
76
|
+
- data/berlin_bach.xml
|
77
|
+
- data/rid_331_pid_EACP328.c.xml
|
78
|
+
- data/sia_walcott.xml
|
79
|
+
- data/yale_cadell.xml
|
80
|
+
- eac.gemspec
|
81
|
+
- lib/eac.rb
|
82
|
+
- lib/eac/version.rb
|
83
|
+
- spec/eac_spec.rb
|
84
|
+
homepage: https://github.com/ultrasaurus/eac
|
85
|
+
licenses:
|
86
|
+
- MIT
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.2.2
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Enables parsing of EAC-CPF (Encoded Archival Context - Corporate Bodies,
|
108
|
+
Persons, and Families) files.
|
109
|
+
test_files:
|
110
|
+
- spec/eac_spec.rb
|