blacklight_marc 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +12 -0
- data/Gemfile +15 -0
- data/README.md +7 -7
- data/Rakefile +67 -0
- data/app/views/catalog/_marc_view.html.erb +32 -0
- data/app/views/catalog/librarian_view.html.erb +10 -0
- data/blacklight_marc.gemspec +4 -2
- data/config/jetty.yml +4 -0
- data/config/locales/blacklight.en.yml +13 -0
- data/config/locales/blacklight.fr.yml +13 -0
- data/config/routes.rb +17 -0
- data/lib/blacklight/solr/document/marc.rb +1 -0
- data/lib/blacklight/solr/document/marc_export.rb +7 -22
- data/lib/blacklight_marc.rb +10 -9
- data/lib/blacklight_marc/catalog.rb +12 -0
- data/lib/blacklight_marc/engine.rb +8 -0
- data/lib/blacklight_marc/railtie.rb +17 -0
- data/lib/blacklight_marc/routes.rb +41 -0
- data/lib/blacklight_marc/version.rb +1 -1
- data/lib/generators/blacklight_marc/marc_generator.rb +17 -21
- data/spec/features/librarian_view_spec.rb +13 -0
- data/spec/integration/solr_document_spec.rb +59 -0
- data/spec/lib/blacklight_solr_document_marc_spec.rb +89 -0
- data/spec/lib/marc_export_spec.rb +743 -0
- data/spec/lib/tasks/solr_marc_task_spec.rb +60 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/test_app_templates/Gemfile.extra +26 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +34 -0
- data/spec/test_app_templates/lib/tasks/blacklight_test_app.rake +14 -0
- metadata +77 -12
@@ -0,0 +1,60 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
3
|
+
|
4
|
+
require "rake"
|
5
|
+
describe "solr:marc:*" do
|
6
|
+
# saves original $stdout in variable
|
7
|
+
# set $stdout as local instance of StringIO
|
8
|
+
# yields to code execution
|
9
|
+
# returns the local instance of StringIO
|
10
|
+
# resets $stout to original value
|
11
|
+
def capture_stdout
|
12
|
+
out = StringIO.new
|
13
|
+
$stdout = out
|
14
|
+
yield
|
15
|
+
return out.string
|
16
|
+
ensure
|
17
|
+
$stdout = STDOUT
|
18
|
+
end
|
19
|
+
|
20
|
+
before(:all) do
|
21
|
+
@rake = Rake::Application.new
|
22
|
+
Rake.application = @rake
|
23
|
+
Rake.application.rake_require "../lib/railties/solr_marc"
|
24
|
+
Rake::Task.define_task(:environment)
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'solr:marc:index_test_data' do
|
28
|
+
it 'should print out usage using NOOP=true' do
|
29
|
+
root = Rails.root
|
30
|
+
ENV['NOOP'] = "true"
|
31
|
+
o = capture_stdout do
|
32
|
+
@rake['solr:marc:index_test_data'].invoke
|
33
|
+
end
|
34
|
+
|
35
|
+
o.should match(Regexp.escape("SolrMarc command that will be run:"))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "solr:marc:index" do
|
40
|
+
it "should produce proper java command" do
|
41
|
+
# can NOT figure out how to actually run solr:marc:index and trap
|
42
|
+
# it's backtick system call. So we'll run solr:marc:index:info and
|
43
|
+
# just test it's dry run output
|
44
|
+
ENV["MARC_FILE"] = "dummy.mrc"
|
45
|
+
output = capture_stdout do
|
46
|
+
@rake['solr:marc:index:info'].invoke
|
47
|
+
end
|
48
|
+
output =~ /SolrMarc command that will be run:\n\s*\n\s*(.*)\n/
|
49
|
+
java_cmd = $1
|
50
|
+
|
51
|
+
java_cmd.should_not be_nil
|
52
|
+
java_cmd.should match "java -Xmx512m"
|
53
|
+
java_cmd.should match /-jar .*\/SolrMarc\.jar/
|
54
|
+
java_cmd.should match "#{Rails.root}/config/SolrMarc/config-test.properties dummy.mrc"
|
55
|
+
java_cmd.should match "-Dsolr.hosturl=http://127.0.0.1:[0-9]{2,5}/solr"
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
ENV["RAILS_ENV"] ||= 'test'
|
5
|
+
|
6
|
+
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
7
|
+
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.9/ and ruby_engine != "jruby"
|
8
|
+
require 'simplecov'
|
9
|
+
|
10
|
+
SimpleCov.start do
|
11
|
+
root File.expand_path(File.dirname(__FILE__) + "../../..")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
require File.expand_path("config/environment", ENV['RAILS_ROOT'] || File.expand_path("../internal", __FILE__))
|
16
|
+
|
17
|
+
require 'rspec/rails'
|
18
|
+
|
19
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
20
|
+
# in spec/support/ and its subdirectories.
|
21
|
+
# Blacklight, again, make sure we're looking in the right place for em.
|
22
|
+
# Relative to HERE, NOT to Rails.root, which is off somewhere else.
|
23
|
+
Dir[Pathname.new(File.expand_path("../support/**/*.rb", __FILE__))].each {|f| require f}
|
24
|
+
|
25
|
+
RSpec.configure do |config|
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
platforms :jruby do
|
2
|
+
gem 'jdbc-sqlite3'
|
3
|
+
gem 'mediashelf-loggable', '>= 0.4.8'
|
4
|
+
gem 'therubyrhino'
|
5
|
+
end
|
6
|
+
|
7
|
+
platforms :ruby do
|
8
|
+
gem 'sqlite3'
|
9
|
+
end
|
10
|
+
|
11
|
+
gem 'jquery-rails'
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem 'rspec-rails', '~> 2.13'
|
15
|
+
gem 'generator_spec'
|
16
|
+
if defined? :JRUBY_VERSION
|
17
|
+
gem 'capybara', '~> 1.0'
|
18
|
+
else
|
19
|
+
gem 'capybara'
|
20
|
+
end
|
21
|
+
gem 'simplecov', :platform => :mri_19
|
22
|
+
end
|
23
|
+
|
24
|
+
gem 'blacklight', :github => 'projectblacklight/blacklight', :branch => 'no_marc'
|
25
|
+
gem 'jettywrapper', '>= 1.2.0'
|
26
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
class TestAppGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../../../../test_app_templates", __FILE__)
|
5
|
+
|
6
|
+
def fix_travis_rails_4
|
7
|
+
if ENV['TRAVIS']
|
8
|
+
insert_into_file 'app/assets/stylesheets/application.css', :before =>'/*' do
|
9
|
+
"@charset \"UTF-8\";\n"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def copy_blacklight_test_app_rake_task
|
15
|
+
copy_file "lib/tasks/blacklight_test_app.rake"
|
16
|
+
end
|
17
|
+
|
18
|
+
def remove_index
|
19
|
+
remove_file "public/index.html"
|
20
|
+
remove_file 'app/assets/images/rails.png'
|
21
|
+
end
|
22
|
+
|
23
|
+
def run_blacklight_generator
|
24
|
+
say_status("warning", "GENERATING BL", :yellow)
|
25
|
+
|
26
|
+
generate 'blacklight', '--marc'
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_test_support_generator
|
30
|
+
say_status("warning", "GENERATING test_support", :yellow)
|
31
|
+
|
32
|
+
generate 'blacklight:test_support'
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rspec/core/rake_task'
|
2
|
+
|
3
|
+
desc "run the blacklight gem spec"
|
4
|
+
gem_home = File.expand_path('../../../../..', __FILE__)
|
5
|
+
|
6
|
+
namespace :blacklight_test_app do
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
9
|
+
t.pattern = gem_home + '/spec/**/*_spec.rb'
|
10
|
+
t.rspec_opts = "--colour"
|
11
|
+
t.ruby_opts = "-I#{gem_home}/spec"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_marc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,25 +39,61 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
49
53
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
51
|
-
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
52
63
|
prerelease: false
|
53
64
|
version_requirements: !ruby/object:Gem::Requirement
|
54
65
|
requirements:
|
55
66
|
- - '>='
|
56
67
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
58
|
-
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jettywrapper
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
59
74
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
61
97
|
- !ruby/object:Gem::Dependency
|
62
98
|
name: marc
|
63
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,15 +122,26 @@ extensions: []
|
|
86
122
|
extra_rdoc_files: []
|
87
123
|
files:
|
88
124
|
- .gitignore
|
125
|
+
- .travis.yml
|
89
126
|
- Gemfile
|
90
127
|
- LICENSE.txt
|
91
128
|
- README.md
|
92
129
|
- Rakefile
|
130
|
+
- app/views/catalog/_marc_view.html.erb
|
131
|
+
- app/views/catalog/librarian_view.html.erb
|
93
132
|
- blacklight_marc.gemspec
|
133
|
+
- config/jetty.yml
|
134
|
+
- config/locales/blacklight.en.yml
|
135
|
+
- config/locales/blacklight.fr.yml
|
136
|
+
- config/routes.rb
|
94
137
|
- lib/SolrMarc.jar
|
95
138
|
- lib/blacklight/solr/document/marc.rb
|
96
139
|
- lib/blacklight/solr/document/marc_export.rb
|
97
140
|
- lib/blacklight_marc.rb
|
141
|
+
- lib/blacklight_marc/catalog.rb
|
142
|
+
- lib/blacklight_marc/engine.rb
|
143
|
+
- lib/blacklight_marc/railtie.rb
|
144
|
+
- lib/blacklight_marc/routes.rb
|
98
145
|
- lib/blacklight_marc/version.rb
|
99
146
|
- lib/generators/blacklight_marc/marc_generator.rb
|
100
147
|
- lib/generators/blacklight_marc/templates/config/SolrMarc/config-test.properties
|
@@ -110,6 +157,15 @@ files:
|
|
110
157
|
- lib/generators/blacklight_marc/templates/config/SolrMarc/translation_maps/instrument_map.properties
|
111
158
|
- lib/generators/blacklight_marc/templates/config/SolrMarc/translation_maps/language_map.properties
|
112
159
|
- lib/railties/solr_marc.rake
|
160
|
+
- spec/features/librarian_view_spec.rb
|
161
|
+
- spec/integration/solr_document_spec.rb
|
162
|
+
- spec/lib/blacklight_solr_document_marc_spec.rb
|
163
|
+
- spec/lib/marc_export_spec.rb
|
164
|
+
- spec/lib/tasks/solr_marc_task_spec.rb
|
165
|
+
- spec/spec_helper.rb
|
166
|
+
- spec/test_app_templates/Gemfile.extra
|
167
|
+
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
168
|
+
- spec/test_app_templates/lib/tasks/blacklight_test_app.rake
|
113
169
|
- test_support/data/test_data.utf8.mrc
|
114
170
|
homepage: ''
|
115
171
|
licenses:
|
@@ -131,9 +187,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
187
|
version: '0'
|
132
188
|
requirements: []
|
133
189
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.
|
190
|
+
rubygems_version: 2.1.11
|
135
191
|
signing_key:
|
136
192
|
specification_version: 4
|
137
193
|
summary: SolrMarc support for Blacklight
|
138
|
-
test_files:
|
194
|
+
test_files:
|
195
|
+
- spec/features/librarian_view_spec.rb
|
196
|
+
- spec/integration/solr_document_spec.rb
|
197
|
+
- spec/lib/blacklight_solr_document_marc_spec.rb
|
198
|
+
- spec/lib/marc_export_spec.rb
|
199
|
+
- spec/lib/tasks/solr_marc_task_spec.rb
|
200
|
+
- spec/spec_helper.rb
|
201
|
+
- spec/test_app_templates/Gemfile.extra
|
202
|
+
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
203
|
+
- spec/test_app_templates/lib/tasks/blacklight_test_app.rake
|
139
204
|
has_rdoc:
|