blacklight 6.6.2 → 6.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a1212427a6ef925e7c442010f44118a4931ae67
4
- data.tar.gz: 20da8e50afe0876f9ca7f79a22667933ed3562a8
3
+ metadata.gz: 8d9d1db7c5b929bb935e9ce41c06af1c4707856c
4
+ data.tar.gz: 328b4f96a2f73164e0ee3a8b298157ee4025e9ad
5
5
  SHA512:
6
- metadata.gz: 50044f685027f9733d984402f93891a2cb8969b6d97fdb729a0174f5a1bd118963292ab301bc7aa396a6e5dc4e792a67229a382352fba6ab0e187985bac004e2
7
- data.tar.gz: 1b98e3acfe972a79d3ae486ee7c178ce32f4ebf17277fa44a439cf5136d7b5fcd32af12be96b301f556996cd8069b77252f98175cafb7b4a7b9ca802385f032e
6
+ metadata.gz: 0690cbe4599e64337bbb09a07c9125b6828ee4734ec2f1d38311dbe178d519df9c8bed4fad85c2276d957d8c74d3089a46579c69e864501b41fe6066adba0fef
7
+ data.tar.gz: 9a11b1e9ebe49ae02dfb2395e94cd696a38949e4632dd204d4361254bb41d6f0cd5b90117cdae41434862d174daca5ca33fcaf5bb1d60b01a54105141a31fa21
data/LICENSE CHANGED
@@ -1,15 +1,14 @@
1
- ##########################################################################
2
- # Copyright 2008-2014 Rector and Visitors of the University of Virginia, The Board of Trustees of the Leland Stanford Junior University, Johns Hopkins Universities, and Data Curation Experts
3
- # Additional copyright may be held by others, as reflected in the commit log
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
1
+ Copyright 2008-2016 Rector and Visitors of the University of Virginia, The Board of Trustees of the Leland Stanford Junior University, Johns Hopkins Universities, and Data Curation Experts
2
+ Additional copyright may be held by others, as reflected in the commit log
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.6.2
1
+ 6.7.0
@@ -37,7 +37,7 @@ module Blacklight::SearchContext
37
37
 
38
38
  def find_search_session
39
39
  if params[:search_context].present?
40
- find_or_initialize_search_session_from_params JSON.load(params[:search_context])
40
+ find_or_initialize_search_session_from_params JSON.parse(params[:search_context])
41
41
  elsif params[:search_id].present?
42
42
  begin
43
43
  # TODO: check the search id signature.
@@ -114,7 +114,7 @@ module Blacklight::FacetsHelperBehavior
114
114
  # a link to add that to your restrictions, with count in parens.
115
115
  #
116
116
  # @param [Blacklight::Solr::Response::Facets::FacetField] facet_field
117
- # @param [String] item
117
+ # @param [Blacklight::Solr::Response::Facets::FacetItem] item
118
118
  # @param [Hash] options
119
119
  # @option options [Boolean] :suppress_link display the facet, but don't link to it
120
120
  # @return [String]
@@ -14,6 +14,9 @@
14
14
  # transformation formats.
15
15
  #
16
16
  module Blacklight::Document
17
+ extend Deprecation
18
+ self.deprecation_horizon = 'blacklight 7.0'
19
+
17
20
  autoload :ActiveModelShim, 'blacklight/document/active_model_shim'
18
21
  autoload :SchemaOrg, 'blacklight/document/schema_org'
19
22
  autoload :CacheKey, 'blacklight/document/cache_key'
@@ -38,6 +41,7 @@ module Blacklight::Document
38
41
 
39
42
  attr_reader :response, :_source
40
43
  alias_method :solr_response, :response
44
+ delegate :[], :key?, :keys, :to_h, to: :_source
41
45
 
42
46
  def initialize(source_doc={}, response=nil)
43
47
  @_source = ActiveSupport::HashWithIndifferentAccess.new(source_doc)
@@ -49,15 +53,20 @@ module Blacklight::Document
49
53
  # If a method is missing, it gets sent to @_source
50
54
  # with all of the original params and block
51
55
  def method_missing(m, *args, &b)
56
+ return super if m == :to_hash
57
+
52
58
  if _source_responds_to?(m)
59
+ Deprecation.warn(Blacklight::Solr::Document, "Blacklight::Document##{m} is deprecated; use obj.to_h.#{m} instead.")
53
60
  _source.send(m, *args, &b)
54
61
  else
55
62
  super
56
63
  end
57
64
  end
58
65
 
59
- def respond_to_missing? *args
60
- _source_responds_to?(*args) || super
66
+ def respond_to_missing? m, *args
67
+ return super if m == :to_hash
68
+
69
+ _source_responds_to?(m, *args) || super
61
70
  end
62
71
 
63
72
  # Helper method to check if value/multi-values exist for a given key.
@@ -87,8 +96,6 @@ module Blacklight::Document
87
96
  end
88
97
  end
89
98
  alias has_field? has?
90
-
91
- delegate :key?, to: :_source
92
99
  alias has_key? key?
93
100
 
94
101
  def fetch key, *default
@@ -75,16 +75,14 @@ module Blacklight::Solr::Response::Spelling
75
75
  def collation
76
76
  # FIXME: DRY up with words
77
77
  spellcheck = self.response[:spellcheck]
78
- if spellcheck && spellcheck[:suggestions]
79
- suggestions = spellcheck[:suggestions]
80
- unless suggestions.nil?
81
- if suggestions.index("collation")
82
- suggestions[suggestions.index("collation") + 1]
83
- elsif spellcheck.key?("collations")
84
- spellcheck['collations'].last
85
- end
86
- end
87
- end
78
+ return unless spellcheck && spellcheck[:suggestions]
79
+ suggestions = spellcheck[:suggestions]
80
+
81
+ if suggestions.index("collation")
82
+ suggestions[suggestions.index("collation") + 1]
83
+ elsif spellcheck.key?("collations")
84
+ spellcheck['collations'].last
85
+ end
88
86
  end
89
87
  end
90
88
  end
@@ -94,16 +94,16 @@ EOF
94
94
  end
95
95
 
96
96
  def generate_blacklight_marc_demo
97
- if options[:marc]
98
- blacklight_marc = String.new('blacklight-marc')
99
- gem blacklight_marc, '~> 6.1'
97
+ return unless options[:marc]
100
98
 
101
- Bundler.with_clean_env do
102
- run "bundle install"
103
- end
99
+ blacklight_marc = String.new('blacklight-marc')
100
+ gem blacklight_marc, '~> 6.1'
104
101
 
105
- generate 'blacklight:marc:install'
102
+ Bundler.with_clean_env do
103
+ run "bundle install"
106
104
  end
105
+
106
+ generate 'blacklight:marc:install'
107
107
  end
108
108
 
109
109
  def add_routes
@@ -17,29 +17,29 @@ module Blacklight
17
17
  EOS
18
18
  # Install Devise?
19
19
  def generate_devise_assets
20
- if options[:devise]
21
- gem "devise"
22
- gem "devise-guests", "~> 0.5"
20
+ return unless options[:devise]
23
21
 
24
- Bundler.with_clean_env do
25
- run "bundle install"
26
- end
22
+ gem "devise"
23
+ gem "devise-guests", "~> 0.5"
24
+
25
+ Bundler.with_clean_env do
26
+ run "bundle install"
27
+ end
27
28
 
28
- generate "devise:install"
29
- generate "devise", model_name.classify
30
- generate "devise_guests", model_name.classify
29
+ generate "devise:install"
30
+ generate "devise", model_name.classify
31
+ generate "devise_guests", model_name.classify
31
32
 
32
- # add the #to_s to the model.
33
- insert_into_file("app/models/#{model_name}.rb", before: /end(\n| )*$/) do
34
- "\n # Method added by Blacklight; Blacklight uses #to_s on your\n" \
35
- " # user class to get a user-displayable login/identifier for\n" \
36
- " # the account.\n" \
37
- " def to_s\n" \
38
- " email\n" \
39
- " end\n"
40
- end
41
- gsub_file("config/initializers/devise.rb", "config.sign_out_via = :delete", "config.sign_out_via = :get")
33
+ # add the #to_s to the model.
34
+ insert_into_file("app/models/#{model_name}.rb", before: /end(\n| )*$/) do
35
+ "\n # Method added by Blacklight; Blacklight uses #to_s on your\n" \
36
+ " # user class to get a user-displayable login/identifier for\n" \
37
+ " # the account.\n" \
38
+ " def to_s\n" \
39
+ " email\n" \
40
+ " end\n"
42
41
  end
42
+ gsub_file("config/initializers/devise.rb", "config.sign_out_via = :delete", "config.sign_out_via = :get")
43
43
  end
44
44
 
45
45
  # Add Blacklight to the user model
@@ -80,7 +80,7 @@ describe Blacklight::SearchHelper do
80
80
 
81
81
  expect(Set.new(mash.keys)).to eq Set.new(solr_document.keys)
82
82
 
83
- mash.each_key do |key|
83
+ mash.keys.each do |key|
84
84
  expect(mash[key]).to eq solr_document[key]
85
85
  end
86
86
  end
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.6.2
4
+ version: 6.7.0
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: 2016-09-16 00:00:00.000000000 Z
20
+ date: 2016-09-27 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails