marc_alephsequential 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ 000000794 LDR L ^^^^^nam^a22003011^^4500
2
+ 000000794 001 L 000000794
3
+ 000000794 003 L MiU
4
+ 000000794 005 L 19880715000000.0
5
+ 000000794 006 L m^^^^^^^^d^^^^^^^^
6
+ 000000794 007 L cr^bn^---auaua
7
+ 000000794 008 L 880715r19701918enk^^^^^^b^^^|00100^eng^^
8
+ 000000794 010 L $$a78011026
9
+ 000000794 035 L $$a(RLIN)MIUG0067181-B
10
+ 000000794 035 L $$a(CaOTULAS)159818938
11
+ 000000794 035 L $$a(OCoLC)ocm00067181
12
+ 000000794 040 L $$aDLC$$cDLC$$dMiU
13
+ 000000794 0500 L $$aPA47$$b.C45 1970
14
+ 000000794 082 L $$a091
15
+ 000000794 1001 L $$aClark, Albert Curtis,$$d1859-1937.
16
+ 000000794 24514 L $$aThe descent of manuscripts.
17
+ 000000794 260 L $$aOxford,$$bClarendon Press$$c[1969]
18
+ 000000794 300 L $$axiv, 464 p.$$c23 cm.
19
+ 000000794 500 L $$aReprint of the 1918 ed.
20
+ 000000794 504 L $$aIncludes bibliographical references.
21
+ 000000794 538 L $$aMode of access: Internet.
22
+ 000000794 60010 L $$aCicero, Marcus Tullius$$xManus
23
+ cripts.
24
+ 000000794 650 0 L $$aCriticism, Textual
25
+ 000000794 650 0 L $$aTransmission of texts
26
+ 000000794 8520 L $$aMiU$$bHATCH$$cGRAD$$hPA 47 .C592d 1969
27
+ 000000794 970 L $$aBK$$bBook
28
+ 000000794 971 L $$aMiU
29
+ 000000794 972 L $$c20040625
30
+ 000000794 973 L $$aHT$$bavail_ht
31
+ 000000794 973 L $$aAC$$bavail_circ
32
+ 000000794 974 L $$umdp.39015004128438$$ric$$d20120530
33
+ 000000794 998 L $$s9665
@@ -0,0 +1,34 @@
1
+ 000000794 LDR L ^^^^^nam^a22003011^^4500
2
+ 000000794 001 L 000000794
3
+ 000000794 003 L MiU
4
+ 000000794 005 L 19880715000000.0
5
+ 000000794 006 L m^^^^^^^^d^^^^^^^^
6
+ 000000794 007 L cr^bn^---auaua
7
+ 000000794 008 L 880715r19701918enk^^^^^^b^^^|00100^eng^^
8
+ 000000794 010 L $$a78011026
9
+ 000000794 035 L $$a(RLIN)MIUG0067181-B
10
+ 000000794 035 L $$a(CaOTULAS)159818938
11
+ 000000794 035 L $$a(OCoLC)ocm00067181
12
+ 000000794 040 L $$aDLC$$cDLC$$dMiU
13
+ 000000794 0500 L $$aPA47$$b.C45 1970
14
+ 000000794 082 L $$a091
15
+ 000000794 1001 L $$aClark, Albert Curtis,$$d1859-1937.
16
+ 000000794 24514 L The descent of manuscripts.
17
+ 000000794 260 L $$aOxford,$$bClarendon Press$$c[1969]
18
+ 000000794 300 L $$axiv, 464 p.$$c23 cm.
19
+ 000000794 500 L $$aReprint of the 1918 ed.
20
+ 000000794 504 L $$aIncludes bibliographical references.
21
+ 000000794 538 L $$aMode of access: Internet.
22
+ 000000794 60010 L $$aCicero, Marcus Tullius$$xManuscripts.
23
+ 000000794 60000 L $$aPlato.$$tCritias$$xManuscripts.
24
+ 000000794 60000 L $$aDemosthenes$$xManuscripts.
25
+ 000000794 650 0 L $$aCriticism, Textual
26
+ 000000794 650 0 L $$aTransmission of texts
27
+ 000000794 8520 L $$aMiU$$bHATCH$$cGRAD$$hPA 47 .C592d 1969
28
+ 000000794 970 L $$aBK$$bBook
29
+ 000000794 971 L $$aMiU
30
+ 000000794 972 L $$c20040625
31
+ 000000794 973 L $$aHT$$bavail_ht
32
+ 000000794 973 L $$aAC$$bavail_circ
33
+ 000000794 974 L $$umdp.39015004128438$$ric$$d20120530
34
+ 000000794 998 L $$s9665
@@ -0,0 +1,33 @@
1
+ 000000794 001 L 000000794
2
+ 000000794 003 L MiU
3
+ 000000794 005 L 19880715000000.0
4
+ 000000794 006 L m^^^^^^^^d^^^^^^^^
5
+ 000000794 007 L cr^bn^---auaua
6
+ 000000794 008 L 880715r19701918enk^^^^^^b^^^|00100^eng^^
7
+ 000000794 010 L $$a78011026
8
+ 000000794 035 L $$a(RLIN)MIUG0067181-B
9
+ 000000794 035 L $$a(CaOTULAS)159818938
10
+ 000000794 035 L $$a(OCoLC)ocm00067181
11
+ 000000794 040 L $$aDLC$$cDLC$$dMiU
12
+ 000000794 0500 L $$aPA47$$b.C45 1970
13
+ 000000794 082 L $$a091
14
+ 000000794 1001 L $$aClark, Albert Curtis,$$d1859-1937.
15
+ 000000794 24514 L $$aThe descent of manuscripts.
16
+ 000000794 260 L $$aOxford,$$bClarendon Press$$c[1969]
17
+ 000000794 300 L $$axiv, 464 p.$$c23 cm.
18
+ 000000794 500 L $$aReprint of the 1918 ed.
19
+ 000000794 504 L $$aIncludes bibliographical references.
20
+ 000000794 538 L $$aMode of access: Internet.
21
+ 000000794 60010 L $$aCicero, Marcus Tullius$$xManuscripts.
22
+ 000000794 60000 L $$aPlato.$$tCritias$$xManuscripts.
23
+ 000000794 60000 L $$aDemosthenes$$xManuscripts.
24
+ 000000794 650 0 L $$aCriticism, Textual
25
+ 000000794 650 0 L $$aTransmission of texts
26
+ 000000794 8520 L $$aMiU$$bHATCH$$cGRAD$$hPA 47 .C592d 1969
27
+ 000000794 970 L $$aBK$$bBook
28
+ 000000794 971 L $$aMiU
29
+ 000000794 972 L $$c20040625
30
+ 000000794 973 L $$aHT$$bavail_ht
31
+ 000000794 973 L $$aAC$$bavail_circ
32
+ 000000794 974 L $$umdp.39015004128438$$ric$$d20120530
33
+ 000000794 998 L $$s9665
@@ -0,0 +1,34 @@
1
+ 000000794 LDR L ^^^^^nam^a22003011^^4500
2
+ 000000794 001 L 000000794
3
+ 000000794 003 L MiU
4
+ 000000794 005 L 19880715000000.0
5
+ 000000794 006 L m^^^^^^^^d^^^^^^^^
6
+ 000000794 007 L cr^bn^---auaua
7
+ 000000794 008 L 880715r19701918enk^^^^^^b^^^|00100^eng^^
8
+ 000000794 010 L $$a78011026
9
+ 000000794 035 L $$a(RLIN)MIUG0067181-B
10
+ 000000794 035 L $$a(CaOTULAS)159818938
11
+ 000000794 035 L $$a(OCoLC)ocm00067181
12
+ 000000794 040 L $$aDLC$$cDLC$$dMiU
13
+ 000000794 0500 L $$aPA47$$b.C45 1970
14
+ 000000794 082 L $$a091
15
+ 000000794 1001 L $$aClark, Albert Curtis,$$d1859-1937.
16
+ 000000794 24514 L $$aThe descent of manuscripts.
17
+ 000000794 260 L $$aOxford,$$bClarendon Press$$c[1969]
18
+ 000000794 300 L $$axiv, 464 p.$$c23 cm.
19
+ 000000794 500 L $$aReprint of the 1918 ed.
20
+ 000000794 504 L $$aIncludes bibliographical references.
21
+ 000000794 538 L $$aMode of access: Internet.
22
+ 000000794 60010 L $$aCicero, Marcus Tullius$$xManuscripts.
23
+ 000000794 60000 L $$aPlato.$$tCritias$$xManuscripts.
24
+ 000000794 60000 L $$aDemosthenes$$xManuscripts.
25
+ 000000794 650 0 L $$aCriticism, Textual
26
+ 000000794 650 0 L $$aTransmission of texts
27
+ 000000794 8520 L $$aMiU$$bHATCH$$cGRAD$$hPA 47 .C592d 1969
28
+ 000000794 970 L $$aBK$$bBook
29
+ 000000794 971 L $$aMiU
30
+ 000000794 972 L $$c20040625
31
+ 000000794 973 L $$aHT$$bavail_ht
32
+ 000000794 973 L $$aAC$$bavail_circ
33
+ 000000794 974 L $$umdp.39015004128438$$ric$$d20120530
34
+ 000000794 998 L $$s9665
data/spec/helper.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+
3
+ begin
4
+ require 'bundler'
5
+ rescue LoadError => e
6
+ warn e.message
7
+ warn "Run `gem install bundler` to install Bundler."
8
+ exit e.status_code
9
+ end
10
+
11
+ begin
12
+ Bundler.setup(:default, :development, :test)
13
+ rescue Bundler::BundlerError => e
14
+ warn e.message
15
+ warn "Run `bundle install` to install missing gems."
16
+ exit e.status_code
17
+ end
18
+
19
+ require "minitest/autorun"
20
+ # require 'minitest/reporters'
21
+ # MiniTest::Reporters.use!
22
+ require 'minitest/hell' # parallelize testing
@@ -0,0 +1,62 @@
1
+ require 'helper'
2
+ require 'marc_alephsequential'
3
+
4
+ describe 'Reader' do
5
+ before do
6
+ @single = 'spec/data/single.seq'
7
+ @batch = 'spec/data/batch.seq'
8
+ @newline = 'spec/data/newline.seq'
9
+ @noleader = 'spec/data/noleader.seq'
10
+ @nosubfieldindicator = 'spec/data/no_initial_subfield.seq'
11
+
12
+ end
13
+
14
+ describe "empty reader" do
15
+ it "doesn't blow up on an empty file" do
16
+ iter = MARC::AlephSequential::Reader.new('/dev/null').each
17
+ lambda{iter.next}.must_raise StopIteration
18
+ end
19
+ end
20
+
21
+ it "reads a single record from a single-record file" do
22
+ iter = MARC::AlephSequential::Reader.new(@single).each
23
+ r = iter.next
24
+ r['998'].value.must_equal '9665'
25
+ r['100']['a'].must_equal 'Clark, Albert Curtis,'
26
+ end
27
+
28
+ it "reads a batch of records" do
29
+ count = 0
30
+ MARC::AlephSequential::Reader.new(@batch).each_with_index{|r, i| count = i + 1}
31
+ count.must_equal 31
32
+ end
33
+
34
+ it "yells when there's no leader" do
35
+ error = nil
36
+ begin
37
+ r = MARC::AlephSequential::Reader.new(@noleader).first
38
+ rescue MARC::AlephSequential::Error => e
39
+ error = e
40
+ end
41
+ error.wont_be_nil
42
+ error.message.must_match /leader/
43
+ end
44
+
45
+ it "deals ok with embedded newline" do
46
+ r = MARC::AlephSequential::Reader.new(@newline).first
47
+ r['600']['a'].must_equal 'Cicero, Marcus Tullius'
48
+ r['600']['x'].must_equal 'Manuscripts.'
49
+ end
50
+
51
+ it "works with lack of beginning '$$'" do
52
+ r = nil # capture_io creates a lexical closure, so we need to define it out here
53
+ out,err = capture_io do
54
+ r = MARC::AlephSequential::Reader.new(@nosubfieldindicator).first
55
+ end
56
+ err.must_match /Variable field 245 doesn\'t start with \'\$\$/m
57
+ r['245']['a'].must_equal 'The descent of manuscripts.'
58
+ end
59
+
60
+
61
+ end
62
+
@@ -0,0 +1,10 @@
1
+ require 'helper'
2
+ require 'marc_alephsequential'
3
+
4
+
5
+ describe "version" do
6
+ it "must exist" do
7
+ version = MarcAlephsequential.const_get('VERSION')
8
+ version.wont_be_empty
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: marc_alephsequential
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bill Dueber
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A ruby-marc reader for Aleph sequential files, a MARC serialization supported
14
+ by Ex Libris' Aleph
15
+ email: bill@dueber.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - .document
21
+ - .gitignore
22
+ - .travis.yml
23
+ - .yardopts
24
+ - ChangeLog.md
25
+ - Gemfile
26
+ - LICENSE.txt
27
+ - README.md
28
+ - Rakefile
29
+ - lib/marc_alephsequential.rb
30
+ - lib/marc_alephsequential/asline.rb
31
+ - lib/marc_alephsequential/asline_group.rb
32
+ - lib/marc_alephsequential/asline_reader.rb
33
+ - lib/marc_alephsequential/buffered_linereader.rb
34
+ - lib/marc_alephsequential/error.rb
35
+ - lib/marc_alephsequential/log.rb
36
+ - lib/marc_alephsequential/reader.rb
37
+ - lib/marc_alephsequential/version.rb
38
+ - marc_alephsequential.gemspec
39
+ - spec/asline_group_spec.rb
40
+ - spec/asline_spec.rb
41
+ - spec/data/batch.seq
42
+ - spec/data/newline.seq
43
+ - spec/data/no_initial_subfield.seq
44
+ - spec/data/noleader.seq
45
+ - spec/data/single.seq
46
+ - spec/helper.rb
47
+ - spec/reader_spec.rb
48
+ - spec/version_spec.rb
49
+ homepage: https://github.com/billdueber/marc_alephsequential#readme
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.1.5
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: ruby-marc reader for Aleph sequential files
73
+ test_files:
74
+ - spec/asline_group_spec.rb
75
+ - spec/asline_spec.rb
76
+ - spec/data/batch.seq
77
+ - spec/data/newline.seq
78
+ - spec/data/no_initial_subfield.seq
79
+ - spec/data/noleader.seq
80
+ - spec/data/single.seq
81
+ - spec/helper.rb
82
+ - spec/reader_spec.rb
83
+ - spec/version_spec.rb
84
+ has_rdoc: