marcspec 1.6.3 → 1.6.4
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.
- data/CHANGES +3 -0
- data/README.md +74 -0
- data/Rakefile +3 -3
- data/VERSION +1 -1
- metadata +12 -10
- data/README.rdoc +0 -28
data/CHANGES
CHANGED
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# marcspec
|
2
|
+
|
3
|
+
The MARCSpec contains classes designed to make it (relatively) easy to specify
|
4
|
+
a data field (my use case specifically is solr) in terms of sets of MARC fields and subfields.
|
5
|
+
|
6
|
+
It currently requires the use of `marc4j4r` and hence JRuby, but I'm going to work on making a compatibility layer with [ruby-marc](http://marc.rubyforge.org/) now that the 0.4 version is out.
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
require 'rubygems'
|
12
|
+
require 'marcspec'
|
13
|
+
require 'marc4j4r'
|
14
|
+
require 'marc2solr/marc2solr_custom' # get the custom functions
|
15
|
+
|
16
|
+
ss = MARCSpec::SpecSet.build do
|
17
|
+
field('id') {
|
18
|
+
spec('001')
|
19
|
+
firstOnly # only take the first 001
|
20
|
+
}
|
21
|
+
field('title') {
|
22
|
+
spec('245a') # just the a
|
23
|
+
spec('245ab') # just the ab
|
24
|
+
spec('245') # the whole thing
|
25
|
+
}
|
26
|
+
field('lccn') {
|
27
|
+
spec('010a')
|
28
|
+
}
|
29
|
+
custom('oclc') { # use a custom function
|
30
|
+
function(:valsByPattern) {
|
31
|
+
mod MARC2Solr::Custom
|
32
|
+
args '035', 'a', /(?:oclc|ocolc|ocm|ocn).*?(\d+)/i, 1
|
33
|
+
}
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
reader = MARC4J4R::Reader.new('mymarc.mrc', :strictmarc)
|
38
|
+
|
39
|
+
reader.each do |r|
|
40
|
+
h = ss.hash_from_marc(r)
|
41
|
+
# or doc = ss_doc_from_marc(r) # gets a SolrInputDocument
|
42
|
+
|
43
|
+
puts h['lccn'][0] # the first lccn
|
44
|
+
h['title'].each do |t|
|
45
|
+
puts t
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
```
|
51
|
+
|
52
|
+
|
53
|
+
## Docs and examples
|
54
|
+
|
55
|
+
Docs are hosted at the [[wiki|http://github.com/billdueber/marcspec/wiki/]]
|
56
|
+
|
57
|
+
|
58
|
+
Documented samples are available as part of the [marc2solr_example project](http://github.com/billdueber/marc2solr_example)
|
59
|
+
-- look in the simple_sample area to start with.
|
60
|
+
|
61
|
+
|
62
|
+
##Note on Patches/Pull Requests
|
63
|
+
|
64
|
+
* Fork the project.
|
65
|
+
* Make your feature addition or bug fix.
|
66
|
+
* Add tests for it. This is important so I don't break it in a
|
67
|
+
future version unintentionally.
|
68
|
+
* Commit, do not mess with rakefile, version, or history.
|
69
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
70
|
+
* Send me a pull request. Bonus points for topic branches.
|
71
|
+
|
72
|
+
## Copyright
|
73
|
+
|
74
|
+
Copyright (c) 2010 BillDueber. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -15,9 +15,9 @@ 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 'logback-simple'
|
20
|
-
gem.add_dependency 'jruby_streaming_update_solr_server', '>=0.5.
|
18
|
+
gem.add_dependency 'marc4j4r', '>=1.2.0'
|
19
|
+
gem.add_dependency 'logback-simple', '>=0.0.2'
|
20
|
+
gem.add_dependency 'jruby_streaming_update_solr_server', '>=0.5.3'
|
21
21
|
|
22
22
|
|
23
23
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.4
|
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
|
+
- 4
|
9
|
+
version: 1.6.4
|
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-13 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -62,9 +62,9 @@ dependencies:
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
segments:
|
64
64
|
- 1
|
65
|
-
-
|
65
|
+
- 2
|
66
66
|
- 0
|
67
|
-
version: 1.
|
67
|
+
version: 1.2.0
|
68
68
|
type: :runtime
|
69
69
|
version_requirements: *id004
|
70
70
|
- !ruby/object:Gem::Dependency
|
@@ -76,7 +76,9 @@ dependencies:
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
segments:
|
78
78
|
- 0
|
79
|
-
|
79
|
+
- 0
|
80
|
+
- 2
|
81
|
+
version: 0.0.2
|
80
82
|
type: :runtime
|
81
83
|
version_requirements: *id005
|
82
84
|
- !ruby/object:Gem::Dependency
|
@@ -89,8 +91,8 @@ dependencies:
|
|
89
91
|
segments:
|
90
92
|
- 0
|
91
93
|
- 5
|
92
|
-
-
|
93
|
-
version: 0.5.
|
94
|
+
- 3
|
95
|
+
version: 0.5.3
|
94
96
|
type: :runtime
|
95
97
|
version_requirements: *id006
|
96
98
|
description: Relies on marc4j4r, based on work in solrmarc
|
@@ -101,13 +103,13 @@ extensions: []
|
|
101
103
|
|
102
104
|
extra_rdoc_files:
|
103
105
|
- LICENSE
|
104
|
-
- README.
|
106
|
+
- README.md
|
105
107
|
files:
|
106
108
|
- .document
|
107
109
|
- .gitignore
|
108
110
|
- CHANGES
|
109
111
|
- LICENSE
|
110
|
-
- README.
|
112
|
+
- README.md
|
111
113
|
- Rakefile
|
112
114
|
- VERSION
|
113
115
|
- lib/marcspec.rb
|
data/README.rdoc
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
= marcspec
|
2
|
-
|
3
|
-
The MARCSpec contains classes designed to make it (relatively) easy to specify
|
4
|
-
a data field (my use case specifically is solr) in terms of sets of MARC fields and subfields.
|
5
|
-
|
6
|
-
|
7
|
-
== Docs and examples
|
8
|
-
|
9
|
-
Docs are hosted at the [[wiki|http://github.com/billdueber/marcspec/wiki/]]
|
10
|
-
|
11
|
-
|
12
|
-
Documented samples are available as part of the marc2solr project
|
13
|
-
at http://github.com/billdueber/marc2solr -- look in the simple_sample area.
|
14
|
-
|
15
|
-
|
16
|
-
== Note on Patches/Pull Requests
|
17
|
-
|
18
|
-
* Fork the project.
|
19
|
-
* Make your feature addition or bug fix.
|
20
|
-
* Add tests for it. This is important so I don't break it in a
|
21
|
-
future version unintentionally.
|
22
|
-
* Commit, do not mess with rakefile, version, or history.
|
23
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
24
|
-
* Send me a pull request. Bonus points for topic branches.
|
25
|
-
|
26
|
-
== Copyright
|
27
|
-
|
28
|
-
Copyright (c) 2010 BillDueber. See LICENSE for details.
|