marc4j4r 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,127 +1,105 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marc4j4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
5
- prerelease:
4
+ version: 1.4.2
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - BillDueber
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-10 00:00:00.000000000 Z
12
+ date: 2012-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: jlogger
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
15
+ version_requirements: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.0.4
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
20
  none: false
21
+ prerelease: false
22
+ type: :runtime
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - ! '>='
28
26
  - !ruby/object:Gem::Version
29
27
  version: 0.0.4
30
- - !ruby/object:Gem::Dependency
31
- name: bacon
32
- requirement: !ruby/object:Gem::Requirement
33
28
  none: false
29
+ name: jlogger
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
34
32
  requirements:
35
33
  - - ! '>='
36
34
  - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
35
+ version: !binary |-
36
+ MA==
41
37
  none: false
38
+ prerelease: false
39
+ type: :development
40
+ requirement: !ruby/object:Gem::Requirement
42
41
  requirements:
43
42
  - - ! '>='
44
43
  - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: yard
48
- requirement: !ruby/object:Gem::Requirement
44
+ version: !binary |-
45
+ MA==
49
46
  none: false
47
+ name: bacon
48
+ - !ruby/object:Gem::Dependency
49
+ version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
53
+ version: !binary |-
54
+ MA==
57
55
  none: false
56
+ prerelease: false
57
+ type: :development
58
+ requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
60
  - - ! '>='
60
61
  - !ruby/object:Gem::Version
61
- version: '0'
62
- description: Syntactic sugar and some extra methods to deal with MARC data using the
63
- java .jar marc4j
62
+ version: !binary |-
63
+ MA==
64
+ none: false
65
+ name: yard
66
+ description: Syntactic sugar and some extra methods to deal with MARC data using the java .jar marc4j
64
67
  email: bill@dueber.com
65
68
  executables: []
66
69
  extensions: []
67
70
  extra_rdoc_files:
68
- - README.rdoc
69
- files:
70
- - CHANGES
71
71
  - LICENSE
72
72
  - README.rdoc
73
- - Rakefile
74
- - VERSION
75
- - benchj.rb
73
+ files:
76
74
  - jars/jackson-all-1.6.0.jar
77
75
  - jars/javamarc.jar
78
76
  - jars/marc4j-extra-readers-writers.jar
79
- - lib/marc4j4r.rb
80
- - lib/marc4j4r/controlfield.rb
81
- - lib/marc4j4r/datafield.rb
82
- - lib/marc4j4r/reader.rb
83
- - lib/marc4j4r/record.rb
84
- - lib/marc4j4r/writer.rb
85
- - spec/alephsequentialreader_spec.rb
86
- - spec/bad.dat
87
- - spec/badbatch.dat
88
- - spec/badbatch.xml
89
- - spec/batch.dat
90
- - spec/batch.txt
91
- - spec/batch.xml
92
- - spec/chinese_utf8.dat
93
- - spec/controlfield_spec.rb
94
- - spec/datafield_spec.rb
95
- - spec/errors.seq
96
- - spec/one.dat
97
- - spec/one.txt
98
- - spec/one.xml
99
- - spec/reader_spec.rb
100
- - spec/record_spec.rb
101
- - spec/spec_helper.rb
102
- - spec/three.seq
77
+ - LICENSE
78
+ - README.rdoc
103
79
  homepage: http://github.com/billdueber/javamarc/tree/master/ruby/marc4j4r/
104
80
  licenses: []
105
- post_install_message:
81
+ post_install_message:
106
82
  rdoc_options: []
107
83
  require_paths:
108
84
  - lib
109
85
  required_ruby_version: !ruby/object:Gem::Requirement
110
- none: false
111
86
  requirements:
112
87
  - - ! '>='
113
88
  - !ruby/object:Gem::Version
114
- version: '0'
115
- required_rubygems_version: !ruby/object:Gem::Requirement
89
+ version: !binary |-
90
+ MA==
116
91
  none: false
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
93
  requirements:
118
94
  - - ! '>='
119
95
  - !ruby/object:Gem::Version
120
- version: '0'
96
+ version: !binary |-
97
+ MA==
98
+ none: false
121
99
  requirements: []
122
- rubyforge_project:
100
+ rubyforge_project:
123
101
  rubygems_version: 1.8.24
124
- signing_key:
102
+ signing_key:
125
103
  specification_version: 3
126
104
  summary: Use marc4j java library in JRuby in a more ruby-ish way
127
105
  test_files: []
data/CHANGES DELETED
@@ -1,27 +0,0 @@
1
- 1.4.0
2
- Update to use newest version of marc4j_extra_readers_writers.jar; before I wasn't
3
- correctly turning '^' into ' ' in leaders and control fields.
4
-
5
- 1.3.0
6
- Updated to use jlogger; added logging #nextRecord (also used by #each) to
7
- AlephSequentialReader and PermissiveStreamReader
8
-
9
- 1.2.0
10
- Fixed encoding problem with to_marc and from_string roundtrip
11
- Added to_hash/to_marc_in_json and from_hash/from_marc_in_json (see
12
- http://dilettantes.code4lib.org/blog/2010/09/a-proposal-to-serialize-marc-in-json/)
13
-
14
- 1.1
15
- Added native java method to turn a record into XML (20% speedup or so)
16
- 1.0
17
- Arbitrary decision that this is 1.0
18
- Using javamarc.jar (fork of marc4j) from http://github.com/billdueber/javamarc
19
- Including alephsequential reader (but not writer) and specs
20
- Added code to Reader#each to deal with #errors object if provided by the
21
- specific reader (right now, :permissivemarc and :alephsequential) and specs
22
- to test
23
- 0.9.1
24
- Updated to latest marc4j; changes involve character conversion
25
-
26
- 0.9.0
27
- First real public release
data/Rakefile DELETED
@@ -1,71 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "marc4j4r"
8
- gem.summary = %Q{Use marc4j java library in JRuby in a more ruby-ish way}
9
- gem.description = %Q{Syntactic sugar and some extra methods to deal with MARC data using the java .jar marc4j}
10
- gem.email = "bill@dueber.com"
11
- gem.homepage = "http://github.com/billdueber/javamarc/tree/master/ruby/marc4j4r/"
12
- gem.authors = ["BillDueber"]
13
-
14
- gem.add_dependency "jlogger", ">= 0.0.4"
15
- gem.add_development_dependency "bacon", ">= 0"
16
- gem.add_development_dependency "yard", ">= 0"
17
-
18
- gem.files.include 'jars/*.jar'
19
-
20
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
21
- end
22
- Jeweler::GemcutterTasks.new
23
- rescue LoadError
24
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
25
- end
26
-
27
-
28
- # Make sure we've got the right .jar
29
- LOCALJAR = 'jars/javamarc.jar'
30
- JAVAJAR = '../../javamarc.jar'
31
-
32
-
33
-
34
- file LOCALJAR => JAVAJAR do |t|
35
- FileUtils.cp(JAVAJAR, LOCALJAR)
36
- end
37
-
38
-
39
-
40
- require 'rake/testtask'
41
- Rake::TestTask.new(:spec) do |spec|
42
- spec.libs << 'lib' << 'spec'
43
- spec.pattern = 'spec/**/*_spec.rb'
44
- spec.verbose = true
45
- end
46
-
47
- begin
48
- require 'rcov/rcovtask'
49
- Rcov::RcovTask.new do |spec|
50
- spec.libs << 'spec'
51
- spec.pattern = 'spec/**/*_spec.rb'
52
- spec.verbose = true
53
- end
54
- rescue LoadError
55
- task :rcov do
56
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
57
- end
58
- end
59
-
60
- task :spec => [:check_dependencies, LOCALJAR]
61
-
62
- task :default => :spec
63
-
64
- begin
65
- require 'yard'
66
- YARD::Rake::YardocTask.new
67
- rescue LoadError
68
- task :yardoc do
69
- abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
70
- end
71
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.4.1
data/benchj.rb DELETED
@@ -1,73 +0,0 @@
1
- $:.unshift 'lib'
2
- require 'marc4j4r'
3
-
4
- require 'benchmark'
5
-
6
- # require 'yajl'
7
- # require 'json/pure'
8
- # require 'msgpack'
9
-
10
-
11
- jsonsize = 0.0
12
- marcsize = 0.0
13
- mpsize = 0.0
14
-
15
-
16
- # Use Benchmark.measure
17
- # sjptime = Benchmark::Tms.new(0,0,0,0,0, "JSON Pure")
18
- smtime = Benchmark::Tms.new(0,0,0,0,0, "MARC")
19
- smptime = Benchmark::Tms.new(0,0,0,0,0, "Msgpack")
20
- sjptime = Benchmark::Tms.new(0,0,0,0,0, "JSON")
21
-
22
- djptime = Benchmark::Tms.new(0,0,0,0,0, "JSON")
23
- dmtime = Benchmark::Tms.new(0,0,0,0,0, "MARC")
24
- dmptime = Benchmark::Tms.new(0,0,0,0,0, "Msgpack")
25
-
26
-
27
-
28
- i = 0
29
- iterations = 1
30
-
31
- iterations.times do
32
- reader = MARC4J4R::Reader.new('topics.xml', :marcxml)
33
-
34
- reader.each_with_index do |r, i|
35
- marc = nil
36
- json = nil
37
- mp = nil
38
- copy = nil
39
-
40
-
41
- smtime += Benchmark.measure {marc = r.to_marc}
42
- dmtime += Benchmark.measure {copy = MARC4J4R::Record.from_string(marc)}
43
-
44
-
45
- sjptime += Benchmark.measure {json = r.to_marc_in_json}
46
- djptime += Benchmark.measure {copy = MARC4J4R::Record.new_from_marc_in_json(json)}
47
-
48
- # break if i > 1000
49
-
50
- end
51
- end
52
-
53
- puts "Total of #{i} records run #{iterations} times"
54
-
55
- puts "\nSERIALIZING"
56
-
57
- base = smtime.total
58
- puts ' %-15s %8.2f s (%3.0f%%)' % ['MARC', smtime.total, smtime.total / base * 100]
59
- puts ' %-15s %8.2f s (%3.0f%%)' % ['Json', sjptime.total, sjptime.total / base * 100]
60
- # puts ' %-15s %8.2f s (%3.0f%%)' % ['Msgpack', smptime.total, smptime.total / base * 100]
61
-
62
- base = dmtime.total
63
- puts "\nDESERIALIZING"
64
- puts ' %-15s %8.2f s (%3.0f%%)' % ['MARC', dmtime.total, dmtime.total / base * 100]
65
- puts ' %-15s %8.2f s (%3.0f%%)' % ['Json', djptime.total, djptime.total / base * 100]
66
- # puts ' %-15s %8.2f s (%3.0f%%)' % ['Msgpack', dmptime.total, dmptime.total / base * 100]
67
-
68
- base = dmtime.total + smtime.total
69
- puts "\nSERIALIZE + DESERIALIZE"
70
- puts ' %-15s %8.2f s (%3.0f%%)' % ['MARC', dmtime.total + smtime.total, (dmtime.total + smtime.total) / base * 100]
71
- puts ' %-15s %8.2f s (%3.0f%%)' % ['Json', djptime.total + sjptime.total, (djptime.total + sjptime.total) / base * 100]
72
- # puts ' %-15s %8.2f s (%3.0f%%)' % ['Msgpack', dmptime.total + smptime.total, (dmptime.total + smptime.total) / base * 100]
73
-
@@ -1,70 +0,0 @@
1
- unless defined? JRUBY_VERSION
2
- raise "Only works under JRUBY"
3
- end
4
-
5
- jardir = File.join(File.dirname(__FILE__), '..', 'jars')
6
-
7
- # For each jar, check for a representative class in each
8
- # and include the jar if it's not defined
9
-
10
- begin
11
- include_class Java::org.marc4j.marc.impl.RecordImpl
12
- rescue NameError => e
13
- require "#{jardir}/javamarc.jar"
14
- end
15
-
16
- begin
17
- include_class Java::org.marc4j.MarcAlephSequentialReader
18
- rescue
19
- require "#{jardir}/marc4j-extra-readers-writers.jar"
20
- end
21
-
22
- begin
23
- include_class Java::org.codehaus.jackson.map.ObjectMapper
24
- rescue
25
- require "#{jardir}/jackson-all-1.6.0.jar"
26
- end
27
-
28
-
29
- # Define a method that will take a string (filename), IO object, or StringIO object,
30
- # and return an inputstream/outputstream
31
-
32
- module IOConvert
33
-
34
- def byteinstream(fromwhere)
35
- stream = nil
36
- if fromwhere.is_a? Java::JavaIO::InputStream
37
- stream = fromwhere
38
- elsif fromwhere.is_a? String
39
- stream = java.io.FileInputStream.new(fromwhere.to_java_string)
40
- elsif fromwhere.respond_to? :to_inputstream
41
- stream = fromwhere.to_inputstream
42
- end
43
- return stream
44
- end
45
-
46
- def byteoutstream towhere
47
- stream = nil
48
- if towhere.is_a? Java::JavaIO::OutputStream
49
- stream = towhere
50
- elsif towhere.is_a? String
51
- stream = java.io.FileOutputStream.new(towhere.to_java_string)
52
- elsif towhere.respond_to? :to_outputstream
53
- stream = towhere.to_outputstream
54
- end
55
- return stream
56
- end
57
-
58
-
59
- module_function :byteinstream, :byteoutstream
60
-
61
- end
62
-
63
-
64
-
65
-
66
-
67
- require 'marc4j4r/record.rb'
68
- require 'marc4j4r/controlfield.rb'
69
- require 'marc4j4r/reader.rb'
70
- require 'marc4j4r/datafield.rb'
@@ -1,32 +0,0 @@
1
- module MARC4J4R
2
- ControlField = Java::org.marc4j.marc.impl::ControlFieldImpl
3
- class ControlField
4
- def value
5
- return self.data
6
- end
7
-
8
- def value= str
9
- self.data = str
10
- end
11
-
12
- def controlField?
13
- return true
14
- end
15
-
16
- def self.control_tag? tag
17
- return Java::org.marc4j.marc.impl.Verifier.isControlField tag
18
- end
19
-
20
- # Pretty-print
21
- # @param [String] joiner What string to use to join the subfields
22
- # @param [String] The pretty string
23
- def to_s
24
- return self.tag + " " + self.value
25
- end
26
-
27
- def == other
28
- self.tag == other.tag && self.value == other.value
29
- end
30
-
31
- end
32
- end