traject_alephsequential_reader 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NTI2NjdlMTVhMWYyODM3ZTQ1YzNkYzYxZmRlOTZkZGQzY2U3NTQwMQ==
5
+ data.tar.gz: !binary |-
6
+ YjdkNjE3ZjU4MWJmMmMwMGY5MzU5ZGViYWM1NWJmNTMxMjMwNGE5MQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDMzZjdlMGFkNjA1NjEwYjgyOTM3NjQ1YzAxOWIwZmRjNGQyN2Q1ZGI1ODQ5
10
+ Mjc3N2Y2ODYzM2RlMWFmOTQ0ZDY0MGRiMGZlNjRjNjA4YTlmY2Y1MzIxMTdi
11
+ MTM1M2MyMzVlNTU0YjIxMjE5MjYyNjdmY2Q1YTNhMDE3ZjUzZGI=
12
+ data.tar.gz: !binary |-
13
+ NGY2NzE0ODI4MjdhMThiMjg4NmYxMDgxZWJiZmJlNzkzZGJjMGZiMzBiN2Nm
14
+ ZDliYzk3N2Y3M2I3YTMxMzI5NjI0OTRhN2NmZjY2MzRhNjAwZTQ2ZWM4OTQw
15
+ NDgxM2UxNDE1M2ZhNzRhNzJlNjgxYTI5NzQwMjc3ZTM4MGU2ODE=
data/.document ADDED
@@ -0,0 +1,3 @@
1
+ -
2
+ ChangeLog.md
3
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ Gemfile.lock
2
+ doc/
3
+ pkg/
4
+ vendor/cache/*.gem
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --markup markdown --title "traject_alephsequential_reader Documentation" --protected
data/ChangeLog.md ADDED
@@ -0,0 +1,4 @@
1
+ ### 0.1.0 / 2013-10-07
2
+
3
+ * Initial release:
4
+
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org/'
2
+
3
+ gemspec
4
+
5
+ gem 'marc'
6
+ gem 'marc_alephsequential'
7
+ gem 'yell'
8
+
9
+
10
+ group :development do
11
+ gem 'kramdown'
12
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Bill Dueber
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # traject_alephsequential_reader
2
+
3
+ * [Homepage](https://github.com/billdueber/traject_alephsequential_reader#readme)
4
+ * [Issues](https://github.com/billdueber/traject_alephsequential_reader/issues)
5
+ * [Documentation](http://rubydoc.info/gems/traject_alephsequential_reader/frames)
6
+ * [Email](mailto:bill at dueber.com)
7
+
8
+ ## Description
9
+
10
+ A paper-thin wrapper around [marc_alephsequential](http://github.com/billdueber/marc_alephsequential) for use in the
11
+ [traject](http://github.com/jrochkind/traject/) indexing software.
12
+
13
+ Will transparently deal with gzipped files so long as their name ends in '.gz'.
14
+
15
+ For features of the reader itself, see [marc_alephsequential](http://github.com/billdueber/marc_alephsequential).
16
+
17
+
18
+ ## Examples
19
+
20
+ ```ruby
21
+
22
+ # A sample traject configuration file to use an alephseqential source
23
+ require 'traject_alephsequential_reader'
24
+
25
+ settings do
26
+ store "reader_class_name", "Traject::AlephSequentialReader"
27
+ end
28
+ ```
29
+
30
+ ## Install
31
+
32
+ $ gem install traject_alephsequential_reader
33
+
34
+ ## Copyright
35
+
36
+ Copyright (c) 2013 Bill Dueber
37
+
38
+ See {file:LICENSE.txt} for details.
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+
5
+ begin
6
+ require 'bundler'
7
+ rescue LoadError => e
8
+ warn e.message
9
+ warn "Run `gem install bundler` to install Bundler."
10
+ exit -1
11
+ end
12
+
13
+ begin
14
+ Bundler.setup(:development)
15
+ rescue Bundler::BundlerError => e
16
+ warn e.message
17
+ warn "Run `bundle install` to install missing gems."
18
+ exit e.status_code
19
+ end
20
+
21
+ require 'rake'
22
+
23
+ require "bundler/gem_tasks"
24
+
25
+ require 'yard'
26
+ YARD::Rake::YardocTask.new
27
+ task :doc => :yard
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
@@ -0,0 +1,35 @@
1
+ require 'traject/alephsequential_reader/version'
2
+ require 'marc_alephsequential'
3
+ require 'zlib'
4
+ require 'yell'
5
+
6
+ module Traject
7
+ class AlephSequentialReader
8
+ include Enumerable
9
+
10
+ def initialize(input_stream, settings)
11
+ @settings = settings
12
+ @input_stream = input_stream
13
+ if settings['command_line.filename'] =~ /\.gz$/
14
+ @input_stream = Zlib::GzipReader.new(@input_stream, :external_encoding => "UTF-8")
15
+ end
16
+
17
+ @internal_reader = MARC::AlephSequential::Reader.new(@input_stream)
18
+ end
19
+
20
+ def logger
21
+ @logger ||= (settings[:logger] || Yell.new(STDERR, :level => "gt.fatal")) # null logger)
22
+ end
23
+
24
+ def each
25
+ unless block_given?
26
+ return enum_for(:each)
27
+ end
28
+
29
+ @internal_reader.each {|r| yield r}
30
+ end
31
+
32
+ end
33
+ end
34
+
35
+
@@ -0,0 +1,5 @@
1
+ module Traject
2
+ class AlephsequentialReader
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
data/test/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 'test/unit'
20
+
21
+ class Test::Unit::TestCase
22
+ end
@@ -0,0 +1,12 @@
1
+ require 'helper'
2
+ require 'traject/alephsequential_reader'
3
+
4
+ class TestTrajectAlephsequentialReader < Test::Unit::TestCase
5
+
6
+ def test_version
7
+ version = Traject::AlephsequentialReader.const_get('VERSION')
8
+
9
+ assert !version.empty?, 'should have a VERSION constant'
10
+ end
11
+
12
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require File.expand_path('../lib/traject/alephsequential_reader/version', __FILE__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "traject_alephsequential_reader"
7
+ gem.version = Traject::AlephsequentialReader::VERSION
8
+ gem.summary = %q{Traject reader for AlephSequential files using stock ruby-marc}
9
+ gem.description = %q{A basic traject reader to process Ex Libris's AlephSequential format on input}
10
+ gem.license = "MIT"
11
+ gem.authors = ["Bill Dueber"]
12
+ gem.email = "bill@dueber.com"
13
+ gem.homepage = "https://github.com/billdueber/traject_alephsequential_reader#readme"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ['lib']
19
+
20
+ gem.add_development_dependency 'bundler'
21
+ gem.add_development_dependency 'rake'
22
+ gem.add_development_dependency 'yard'
23
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: traject_alephsequential_reader
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
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: yard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A basic traject reader to process Ex Libris's AlephSequential format
56
+ on input
57
+ email: bill@dueber.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .document
63
+ - .gitignore
64
+ - .yardopts
65
+ - ChangeLog.md
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - lib/traject/alephsequential_reader.rb
71
+ - lib/traject/alephsequential_reader/version.rb
72
+ - test/helper.rb
73
+ - test/test_traject_alephsequential_reader.rb
74
+ - traject_alephsequential_reader.gemspec
75
+ homepage: https://github.com/billdueber/traject_alephsequential_reader#readme
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.1.5
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Traject reader for AlephSequential files using stock ruby-marc
99
+ test_files:
100
+ - test/helper.rb
101
+ - test/test_traject_alephsequential_reader.rb
102
+ has_rdoc: