blacklight 6.7.2 → 6.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +11 -0
- data/.rubocop_todo.yml +23 -17
- data/VERSION +1 -1
- data/app/presenters/blacklight/link_alternate_presenter.rb +8 -4
- data/blacklight.gemspec +1 -1
- data/spec/helpers/facets_helper_spec.rb +0 -2
- data/spec/presenters/blacklight/link_alternate_presenter_spec.rb +30 -0
- data/spec/spec_helper.rb +1 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b010c38e55760896be7d71da9b207fd9683fd635
|
4
|
+
data.tar.gz: fcafe80dfca427f26122f7a05e2e18c9825ba24b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccd2af1a8f740736a05dccc542e1277de04e363dc1e50a02f9d0936592837ad62ebbad88108479d92a8807c12a81c202189d1009e801cc1000247d101bab90f9
|
7
|
+
data.tar.gz: e29b7a34a42498627f67ee4575c0981e7d8b6e697f6b9a925d829bf84c1b8f57f7aa7b24d93895e0d196c6a7885b1b8dd12fc81b15abc04114644029a8556288
|
data/.rubocop.yml
CHANGED
@@ -4,6 +4,7 @@ inherit_from:
|
|
4
4
|
- .rubocop_todo.yml
|
5
5
|
|
6
6
|
AllCops:
|
7
|
+
DisplayCopNames: true
|
7
8
|
Exclude:
|
8
9
|
- "lib/generators/blacklight/templates/**/*"
|
9
10
|
- "spec/**/*"
|
@@ -27,3 +28,13 @@ Rails/OutputSafety:
|
|
27
28
|
Style/MethodMissing:
|
28
29
|
Exclude:
|
29
30
|
- 'lib/blacklight/utils.rb'
|
31
|
+
|
32
|
+
# engine_cart block includes conditional, not duplication
|
33
|
+
Bundler/DuplicatedGem:
|
34
|
+
Exclude:
|
35
|
+
- 'Gemfile'
|
36
|
+
|
37
|
+
# engine_cart block is following default Rails order
|
38
|
+
Bundler/OrderedGems:
|
39
|
+
Exclude:
|
40
|
+
- 'Gemfile'
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2016-
|
3
|
+
# on 2016-10-31 11:13:16 -0700 using RuboCop version 0.45.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -74,7 +74,7 @@ Lint/UselessAssignment:
|
|
74
74
|
- 'lib/blacklight/solr/response/spelling.rb'
|
75
75
|
- 'lib/railties/blacklight.rake'
|
76
76
|
|
77
|
-
# Offense count:
|
77
|
+
# Offense count: 60
|
78
78
|
Metrics/AbcSize:
|
79
79
|
Max: 53
|
80
80
|
|
@@ -85,13 +85,13 @@ Metrics/BlockNesting:
|
|
85
85
|
# Offense count: 2
|
86
86
|
# Configuration parameters: CountComments.
|
87
87
|
Metrics/ClassLength:
|
88
|
-
Max:
|
88
|
+
Max: 193
|
89
89
|
|
90
90
|
# Offense count: 20
|
91
91
|
Metrics/CyclomaticComplexity:
|
92
92
|
Max: 12
|
93
93
|
|
94
|
-
# Offense count:
|
94
|
+
# Offense count: 50
|
95
95
|
# Configuration parameters: CountComments.
|
96
96
|
Metrics/MethodLength:
|
97
97
|
Max: 52
|
@@ -172,7 +172,7 @@ Style/CaseIndentation:
|
|
172
172
|
- 'lib/blacklight/configuration/fields.rb'
|
173
173
|
- 'lib/blacklight/search_builder.rb'
|
174
174
|
|
175
|
-
# Offense count:
|
175
|
+
# Offense count: 50
|
176
176
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
177
177
|
# SupportedStyles: nested, compact
|
178
178
|
Style/ClassAndModuleChildren:
|
@@ -186,7 +186,7 @@ Style/ConditionalAssignment:
|
|
186
186
|
Exclude:
|
187
187
|
- 'lib/blacklight/solr/response/spelling.rb'
|
188
188
|
|
189
|
-
# Offense count:
|
189
|
+
# Offense count: 91
|
190
190
|
Style/Documentation:
|
191
191
|
Enabled: false
|
192
192
|
|
@@ -216,7 +216,7 @@ Style/ElseAlignment:
|
|
216
216
|
- 'lib/blacklight/solr/response/facets.rb'
|
217
217
|
- 'lib/blacklight/solr/search_builder_behavior.rb'
|
218
218
|
|
219
|
-
# Offense count:
|
219
|
+
# Offense count: 20
|
220
220
|
# Cop supports --auto-correct.
|
221
221
|
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
222
222
|
Style/ExtraSpacing:
|
@@ -226,7 +226,6 @@ Style/ExtraSpacing:
|
|
226
226
|
- 'app/models/concerns/blacklight/document/dublin_core.rb'
|
227
227
|
- 'app/models/concerns/blacklight/document/export.rb'
|
228
228
|
- 'app/models/record_mailer.rb'
|
229
|
-
- 'blacklight.gemspec'
|
230
229
|
- 'config/routes.rb'
|
231
230
|
- 'lib/blacklight/configuration.rb'
|
232
231
|
- 'lib/generators/blacklight/controller_generator.rb'
|
@@ -247,10 +246,10 @@ Style/GuardClause:
|
|
247
246
|
- 'app/helpers/blacklight/catalog_helper_behavior.rb'
|
248
247
|
- 'lib/blacklight/solr/search_builder_behavior.rb'
|
249
248
|
|
250
|
-
# Offense count:
|
249
|
+
# Offense count: 103
|
251
250
|
# Cop supports --auto-correct.
|
252
251
|
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
253
|
-
# SupportedStyles: ruby19,
|
252
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
254
253
|
Style/HashSyntax:
|
255
254
|
Enabled: false
|
256
255
|
|
@@ -279,7 +278,7 @@ Style/IndentHash:
|
|
279
278
|
Exclude:
|
280
279
|
- 'lib/blacklight/configuration.rb'
|
281
280
|
|
282
|
-
# Offense count:
|
281
|
+
# Offense count: 20
|
283
282
|
# Cop supports --auto-correct.
|
284
283
|
# Configuration parameters: Width.
|
285
284
|
Style/IndentationWidth:
|
@@ -298,7 +297,7 @@ Style/IndentationWidth:
|
|
298
297
|
- 'lib/blacklight/solr/search_builder_behavior.rb'
|
299
298
|
- 'lib/generators/blacklight/assets_generator.rb'
|
300
299
|
|
301
|
-
# Offense count:
|
300
|
+
# Offense count: 5
|
302
301
|
# Cop supports --auto-correct.
|
303
302
|
Style/LeadingCommentSpace:
|
304
303
|
Exclude:
|
@@ -308,7 +307,7 @@ Style/LeadingCommentSpace:
|
|
308
307
|
- 'lib/blacklight/configuration.rb'
|
309
308
|
- 'lib/blacklight/solr/response/spelling.rb'
|
310
309
|
|
311
|
-
# Offense count:
|
310
|
+
# Offense count: 116
|
312
311
|
# Cop supports --auto-correct.
|
313
312
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
314
313
|
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
|
@@ -322,6 +321,13 @@ Style/MultilineBlockLayout:
|
|
322
321
|
- 'lib/generators/blacklight/install_generator.rb'
|
323
322
|
- 'lib/generators/blacklight/test_support_generator.rb'
|
324
323
|
|
324
|
+
# Offense count: 3
|
325
|
+
# Cop supports --auto-correct.
|
326
|
+
Style/MultilineIfModifier:
|
327
|
+
Exclude:
|
328
|
+
- 'lib/blacklight/solr/response/facets.rb'
|
329
|
+
- 'lib/blacklight/solr/search_builder_behavior.rb'
|
330
|
+
|
325
331
|
# Offense count: 13
|
326
332
|
# Cop supports --auto-correct.
|
327
333
|
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
@@ -372,7 +378,7 @@ Style/PredicateName:
|
|
372
378
|
Style/RedundantSelf:
|
373
379
|
Enabled: false
|
374
380
|
|
375
|
-
# Offense count:
|
381
|
+
# Offense count: 16
|
376
382
|
# Cop supports --auto-correct.
|
377
383
|
Style/SpaceAfterComma:
|
378
384
|
Exclude:
|
@@ -416,7 +422,7 @@ Style/SpaceAroundEqualsInParameterDefault:
|
|
416
422
|
- 'app/presenters/blacklight/show_presenter.rb'
|
417
423
|
- 'lib/blacklight/search_state.rb'
|
418
424
|
|
419
|
-
# Offense count:
|
425
|
+
# Offense count: 10
|
420
426
|
# Cop supports --auto-correct.
|
421
427
|
# Configuration parameters: AllowForAlignment.
|
422
428
|
Style/SpaceAroundOperators:
|
@@ -482,7 +488,7 @@ Style/SpaceInsideBrackets:
|
|
482
488
|
Exclude:
|
483
489
|
- 'lib/blacklight/configuration/fields.rb'
|
484
490
|
|
485
|
-
# Offense count:
|
491
|
+
# Offense count: 19
|
486
492
|
# Cop supports --auto-correct.
|
487
493
|
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
|
488
494
|
# SupportedStyles: space, no_space, compact
|
@@ -513,7 +519,7 @@ Style/SpaceInsideParens:
|
|
513
519
|
- 'lib/blacklight/search_state.rb'
|
514
520
|
- 'lib/blacklight/solr/search_builder_behavior.rb'
|
515
521
|
|
516
|
-
# Offense count:
|
522
|
+
# Offense count: 190
|
517
523
|
# Cop supports --auto-correct.
|
518
524
|
Style/TrailingWhitespace:
|
519
525
|
Enabled: false
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
6.7.
|
1
|
+
6.7.3
|
@@ -4,13 +4,13 @@ module Blacklight
|
|
4
4
|
include ActionView::Helpers::OutputSafetyHelper
|
5
5
|
include ActionView::Helpers::TagHelper
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@
|
7
|
+
def initialize(view_context, document, options)
|
8
|
+
@view_context = view_context
|
9
9
|
@document = document
|
10
10
|
@options = { unique: false, exclude: [] }.merge(options)
|
11
11
|
end
|
12
12
|
|
13
|
-
attr_reader :
|
13
|
+
attr_reader :view_context, :document, :options
|
14
14
|
|
15
15
|
# Renders links to alternate representations
|
16
16
|
# provided by export formats. Returns empty string if no links available.
|
@@ -22,8 +22,12 @@ module Blacklight
|
|
22
22
|
|
23
23
|
seen.add(spec[:content_type])
|
24
24
|
|
25
|
-
tag(:link, rel: "alternate", title: format, type: spec[:content_type], href:
|
25
|
+
tag(:link, rel: "alternate", title: format, type: spec[:content_type], href: href(format))
|
26
26
|
end.compact, "\n")
|
27
27
|
end
|
28
|
+
|
29
|
+
def href(format)
|
30
|
+
view_context.polymorphic_url(view_context.search_state.url_for_document(document), format: format)
|
31
|
+
end
|
28
32
|
end
|
29
33
|
end
|
data/blacklight.gemspec
CHANGED
@@ -45,5 +45,5 @@ Gem::Specification.new do |s|
|
|
45
45
|
s.add_development_dependency "coveralls"
|
46
46
|
s.add_development_dependency "simplecov"
|
47
47
|
s.add_development_dependency "rubocop"
|
48
|
-
s.add_development_dependency "rubocop-rspec"
|
48
|
+
s.add_development_dependency "rubocop-rspec", '~> 1.8.0'
|
49
49
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe Blacklight::LinkAlternatePresenter do
|
5
|
+
let(:view_context) { double }
|
6
|
+
let(:document) { SolrDocument.new(id: 9999) }
|
7
|
+
let(:options) { {} }
|
8
|
+
let(:config) { Blacklight::Configuration.new }
|
9
|
+
let(:parameter_class) { ActionController::Parameters }
|
10
|
+
let(:params) { parameter_class.new }
|
11
|
+
let(:search_state) { Blacklight::SearchState.new(params, config) }
|
12
|
+
|
13
|
+
let(:presenter) { described_class.new(view_context, document, options) }
|
14
|
+
before do
|
15
|
+
allow(view_context).to receive(:search_state).and_return(search_state)
|
16
|
+
allow(view_context).to receive(:polymorphic_url) do |doc, opts|
|
17
|
+
"http://test.host/catalog/#{doc.to_param}.#{opts[:format]}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#render" do
|
22
|
+
subject { presenter.render }
|
23
|
+
let(:expected_html) do
|
24
|
+
'<link rel="alternate" title="xml" type="application/xml" href="http://test.host/catalog/9999.xml" />' \
|
25
|
+
'<link rel="alternate" title="dc_xml" type="text/xml" href="http://test.host/catalog/9999.dc_xml" />' \
|
26
|
+
'<link rel="alternate" title="oai_dc_xml" type="text/xml" href="http://test.host/catalog/9999.oai_dc_xml" />'
|
27
|
+
end
|
28
|
+
it { is_expected.to be_equivalent_to expected_html }
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.7.
|
4
|
+
version: 6.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: exe
|
19
19
|
cert_chain: []
|
20
|
-
date:
|
20
|
+
date: 2017-01-09 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -301,16 +301,16 @@ dependencies:
|
|
301
301
|
name: rubocop-rspec
|
302
302
|
requirement: !ruby/object:Gem::Requirement
|
303
303
|
requirements:
|
304
|
-
- - "
|
304
|
+
- - "~>"
|
305
305
|
- !ruby/object:Gem::Version
|
306
|
-
version:
|
306
|
+
version: 1.8.0
|
307
307
|
type: :development
|
308
308
|
prerelease: false
|
309
309
|
version_requirements: !ruby/object:Gem::Requirement
|
310
310
|
requirements:
|
311
|
-
- - "
|
311
|
+
- - "~>"
|
312
312
|
- !ruby/object:Gem::Version
|
313
|
-
version:
|
313
|
+
version: 1.8.0
|
314
314
|
description: |-
|
315
315
|
Blacklight is an open source Solr user interface discovery platform.
|
316
316
|
You can use Blacklight to enable searching and browsing of your
|
@@ -688,6 +688,7 @@ files:
|
|
688
688
|
- spec/models/record_mailer_spec.rb
|
689
689
|
- spec/models/search_spec.rb
|
690
690
|
- spec/models/solr_document_spec.rb
|
691
|
+
- spec/presenters/blacklight/link_alternate_presenter_spec.rb
|
691
692
|
- spec/presenters/document_presenter_spec.rb
|
692
693
|
- spec/presenters/index_presenter_spec.rb
|
693
694
|
- spec/presenters/pipeline_spec.rb
|
@@ -747,7 +748,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
747
748
|
version: '0'
|
748
749
|
requirements: []
|
749
750
|
rubyforge_project:
|
750
|
-
rubygems_version: 2.
|
751
|
+
rubygems_version: 2.6.8
|
751
752
|
signing_key:
|
752
753
|
specification_version: 4
|
753
754
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|
@@ -826,6 +827,7 @@ test_files:
|
|
826
827
|
- spec/models/record_mailer_spec.rb
|
827
828
|
- spec/models/search_spec.rb
|
828
829
|
- spec/models/solr_document_spec.rb
|
830
|
+
- spec/presenters/blacklight/link_alternate_presenter_spec.rb
|
829
831
|
- spec/presenters/document_presenter_spec.rb
|
830
832
|
- spec/presenters/index_presenter_spec.rb
|
831
833
|
- spec/presenters/pipeline_spec.rb
|