marcspec 1.6.4 → 1.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +3 -0
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/marcspec/controlfieldspec.rb +3 -1
- data/lib/marcspec/map.rb +6 -4
- data/lib/marcspec/multivaluemap.rb +1 -0
- data/lib/marcspec/solrfieldspec.rb +2 -1
- data/lib/marcspec/specset.rb +2 -1
- data/lib/marcspec/variablefieldspec.rb +3 -2
- data/lib/marcspec.rb +0 -2
- data/spec/data/umich/translation_maps/library_map.properties +1 -1
- data/spec/maps_spec.rb +1 -0
- data/spec/spec_helper.rb +2 -2
- metadata +8 -8
data/CHANGES
CHANGED
data/Rakefile
CHANGED
@@ -15,8 +15,8 @@ begin
|
|
15
15
|
gem.add_development_dependency "rspec"
|
16
16
|
gem.add_development_dependency "yard", ">= 0"
|
17
17
|
gem.add_development_dependency 'ci_reporter'
|
18
|
-
gem.add_dependency 'marc4j4r', '>=1.
|
19
|
-
gem.add_dependency '
|
18
|
+
gem.add_dependency 'marc4j4r', '>=1.3.0'
|
19
|
+
gem.add_dependency 'jlogger', '>=0.0.3'
|
20
20
|
gem.add_dependency 'jruby_streaming_update_solr_server', '>=0.5.3'
|
21
21
|
|
22
22
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.5
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'marc4j4r'
|
2
2
|
require 'set'
|
3
3
|
require 'pp'
|
4
|
+
require 'jlogger'
|
5
|
+
|
4
6
|
module MARCSpec
|
5
7
|
# A ControlFieldSpec takes a control tag (generally 001..009) and an optional zero-based range
|
6
8
|
# When called with marc_values(record), it returns either the complete value of all
|
@@ -17,7 +19,7 @@ module MARCSpec
|
|
17
19
|
# substrings are specified.
|
18
20
|
|
19
21
|
class ControlFieldSpec
|
20
|
-
include
|
22
|
+
include JLogger::Simple
|
21
23
|
|
22
24
|
attr_accessor :tag, :range, :rangehistory
|
23
25
|
|
data/lib/marcspec/map.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'jlogger'
|
2
|
+
|
1
3
|
module MARCSpec
|
2
4
|
|
3
5
|
# A Map is just a named lookup table. The access
|
@@ -10,7 +12,7 @@ module MARCSpec
|
|
10
12
|
# NOTE: THIS IS AN ABSTRACT SUPERCLASS. DO NOT INSTANTIATE IT DIRECTLY
|
11
13
|
|
12
14
|
class Map
|
13
|
-
include
|
15
|
+
include JLogger::Simple
|
14
16
|
|
15
17
|
attr_accessor :mapname, :map
|
16
18
|
|
@@ -35,14 +37,14 @@ module MARCSpec
|
|
35
37
|
begin
|
36
38
|
str = File.open(filename).read
|
37
39
|
rescue Exception => e
|
38
|
-
|
40
|
+
"Problem opening #{filename}: #{e}"
|
39
41
|
raise e
|
40
42
|
end
|
41
43
|
|
42
44
|
begin
|
43
45
|
rawmap = eval(str)
|
44
46
|
rescue Exception => e
|
45
|
-
|
47
|
+
log.error "Problem evaluating (with 'eval') file #{filename}: #{e}"
|
46
48
|
raise e
|
47
49
|
end
|
48
50
|
|
@@ -59,7 +61,7 @@ module MARCSpec
|
|
59
61
|
when :multi
|
60
62
|
return MultiValueMap.new(rawmap[:mapname], rawmap[:map])
|
61
63
|
else
|
62
|
-
|
64
|
+
log.fatal "Map file #{filename} doesn't seem to be either a KV map or a MuliValueMap according to :maptype (#{rawmap[:maptype]})"
|
63
65
|
raise ArgumentError, "File #{filename} doesn't evaluate to a valid map"
|
64
66
|
end
|
65
67
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'stringio'
|
2
2
|
require 'marc4j4r/controlfield'
|
3
|
+
require 'jlogger'
|
3
4
|
|
4
5
|
module MARCSpec
|
5
6
|
|
@@ -8,7 +9,7 @@ module MARCSpec
|
|
8
9
|
# from a MARC record.
|
9
10
|
|
10
11
|
class SolrFieldSpec
|
11
|
-
include
|
12
|
+
include JLogger::Simple
|
12
13
|
|
13
14
|
attr_accessor :solrField, :first, :map, :noMapKeyDefault, :marcfieldspecs, :defaultValue, :_mapname
|
14
15
|
attr_reader :arity
|
data/lib/marcspec/specset.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'jruby_streaming_update_solr_server'
|
2
2
|
require 'marc4j4r'
|
3
3
|
require 'benchmark'
|
4
|
+
require 'jlogger'
|
4
5
|
|
5
6
|
|
6
7
|
module MARCSpec
|
@@ -30,7 +31,7 @@ module MARCSpec
|
|
30
31
|
# into a set of key=>value pairs suitable for sending to Solr
|
31
32
|
|
32
33
|
class SpecSet
|
33
|
-
include
|
34
|
+
include JLogger::Simple
|
34
35
|
|
35
36
|
attr_accessor :tmaps, :solrfieldspecs, :benchmarks
|
36
37
|
|
@@ -1,5 +1,6 @@
|
|
1
|
-
require 'set'
|
2
1
|
require 'pp'
|
2
|
+
require 'jlogger'
|
3
|
+
|
3
4
|
module MARCSpec
|
4
5
|
# A VariableFieldSpec has a tag (three chars) and a set of codes. Its #marc_values(r) method will return
|
5
6
|
# all the values for the subfields for the given codes joined by the optional joiner (space by default)
|
@@ -14,7 +15,7 @@ module MARCSpec
|
|
14
15
|
# vfs = MARCSpec::VariableFieldSpec.new('245', 'a'..'b')
|
15
16
|
|
16
17
|
class VariableFieldSpec
|
17
|
-
include
|
18
|
+
include JLogger::Simple
|
18
19
|
|
19
20
|
attr_accessor :tag, :codes, :joiner, :ind1, :ind2, :codehistory
|
20
21
|
|
data/lib/marcspec.rb
CHANGED
@@ -45,4 +45,4 @@ pattern_43 = ^HATCH MOVRD=>Hatcher Graduate Map Library
|
|
45
45
|
pattern_44 = ^HATCH MRAR=>Hatcher Graduate Map Library
|
46
46
|
pattern_45 = ^HATCH MREF=>Hatcher Graduate Map Library
|
47
47
|
pattern_46 = ^HATCH MSHLV=>Hatcher Graduate Map Library
|
48
|
-
pattern_47 = ^HATCH MSOFT=>Hatcher Graduate Map Library
|
48
|
+
pattern_47 = ^HATCH MSOFT=>Hatcher Graduate Map Library
|
data/spec/maps_spec.rb
CHANGED
@@ -160,6 +160,7 @@ describe "MVMaps" do
|
|
160
160
|
|
161
161
|
it "can dump/load a multivalue map via generic map interface" do
|
162
162
|
map = MARCSpec::MultiValueMap.from_solrmarc_file "#{DIR}/data/umich/translation_maps/library_map.properties"
|
163
|
+
map.optimize
|
163
164
|
f = Tempfile.new('mvmap')
|
164
165
|
f.puts map.asPPString
|
165
166
|
path = f.path
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 1.6.
|
8
|
+
- 5
|
9
|
+
version: 1.6.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- BillDueber
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-15 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -62,13 +62,13 @@ dependencies:
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
segments:
|
64
64
|
- 1
|
65
|
-
-
|
65
|
+
- 3
|
66
66
|
- 0
|
67
|
-
version: 1.
|
67
|
+
version: 1.3.0
|
68
68
|
type: :runtime
|
69
69
|
version_requirements: *id004
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
71
|
+
name: jlogger
|
72
72
|
prerelease: false
|
73
73
|
requirement: &id005 !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
@@ -77,8 +77,8 @@ dependencies:
|
|
77
77
|
segments:
|
78
78
|
- 0
|
79
79
|
- 0
|
80
|
-
-
|
81
|
-
version: 0.0.
|
80
|
+
- 3
|
81
|
+
version: 0.0.3
|
82
82
|
type: :runtime
|
83
83
|
version_requirements: *id005
|
84
84
|
- !ruby/object:Gem::Dependency
|