hydra-core 9.8.1 → 9.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/hydra/controller/controller_behavior.rb +1 -1
- data/app/search_builders/hydra/search_builder.rb +6 -0
- data/hydra-core.gemspec +0 -1
- data/lib/generators/hydra/head_generator.rb +7 -0
- data/lib/generators/hydra/templates/catalog_controller.rb +10 -5
- data/lib/hydra-head/version.rb +1 -1
- data/lib/tasks/hydra.rake +13 -0
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/search_builders/search_builder_spec.rb +24 -4
- data/spec/test_app_templates/Gemfile.extra +1 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67a86254605c32e33aa739f20bc785e25b8204e0
|
4
|
+
data.tar.gz: 53c8772a249c394a8f89796d3ceb89ad6551fe3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e00a07e0a403e8a2828a06426b5ce1b7e91e0d5b13034af4c10708044b9647ad0dbc0c71fcbe48833f89f84e4a5749f401128d483c494a6382ec4493dde0640e
|
7
|
+
data.tar.gz: c3ddab7fff80ce0fcf4698d9479a98802d59635b97f19c640aeda798a498d2b55b1b7c10f235b24847f0b3200789585981da550cb46426012962ea3d53c185f2
|
@@ -34,7 +34,7 @@ module Hydra::Controller::ControllerBehavior
|
|
34
34
|
module ClassMethods
|
35
35
|
# get the solr name for a field with this name and using the given solrizer descriptor
|
36
36
|
def solr_name(name, *opts)
|
37
|
-
ActiveFedora
|
37
|
+
ActiveFedora.index_field_mapper.solr_name(name, *opts)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -2,5 +2,11 @@ module Hydra
|
|
2
2
|
class SearchBuilder < Blacklight::SearchBuilder
|
3
3
|
include Blacklight::Solr::SearchBuilderBehavior
|
4
4
|
include Hydra::AccessControlsEnforcement
|
5
|
+
extend Deprecation
|
6
|
+
|
7
|
+
def initialize(*)
|
8
|
+
Deprecation.warn SearchBuilder, "Hydra::SearchBuilder is deprecated and will be removed in hydra-head 10.0. Instead add include Hydra::AccessControlsEnforcement to app/models/search_builder.rb"
|
9
|
+
super
|
10
|
+
end
|
5
11
|
end
|
6
12
|
end
|
data/hydra-core.gemspec
CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
gem.add_dependency "rails", '~> 4.0'
|
22
22
|
gem.add_dependency 'hydra-access-controls', version
|
23
|
-
gem.add_dependency 'active-fedora', '~> 9.8'
|
24
23
|
|
25
24
|
gem.add_development_dependency 'sqlite3', '~> 1.3'
|
26
25
|
gem.add_development_dependency 'yard', '~> 0.8.7'
|
@@ -54,6 +54,13 @@ module Hydra
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
# Add Hydra to the SearchBuilder
|
58
|
+
def inject_hydra_search_builder_behavior
|
59
|
+
insert_into_file "app/models/search_builder.rb", after: "include Blacklight::Solr::SearchBuilderBehavior\n" do
|
60
|
+
" include Hydra::AccessControlsEnforcement\n"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
57
64
|
# Copy all files in templates/config directory to host config
|
58
65
|
def create_configuration_files
|
59
66
|
|
@@ -7,12 +7,17 @@ class CatalogController < ApplicationController
|
|
7
7
|
# These before_filters apply the hydra access controls
|
8
8
|
before_filter :enforce_show_permissions, only: :show
|
9
9
|
|
10
|
-
# This applies appropriate access controls to all solr queries
|
11
|
-
Hydra::SearchBuilder.default_processor_chain += [:add_access_controls_to_solr_params]
|
12
|
-
|
13
|
-
|
14
10
|
configure_blacklight do |config|
|
15
|
-
|
11
|
+
## Class for sending and receiving requests from a search index
|
12
|
+
# config.repository_class = Blacklight::Solr::Repository
|
13
|
+
#
|
14
|
+
## Class for converting Blacklight's url parameters to into request parameters for the search index
|
15
|
+
# config.search_builder_class = ::SearchBuilder
|
16
|
+
#
|
17
|
+
## Model that maps search index responses to the blacklight response model
|
18
|
+
# config.response_model = Blacklight::Solr::Response
|
19
|
+
|
20
|
+
## Default parameters to send to solr for all search-like requests. See also SearchBuilder#processed_parameters
|
16
21
|
config.default_solr_params = {
|
17
22
|
qt: 'search',
|
18
23
|
rows: 10
|
data/lib/hydra-head/version.rb
CHANGED
data/lib/tasks/hydra.rake
CHANGED
@@ -17,4 +17,17 @@ namespace :hydra do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
desc "Start solr and fedora instances for tests"
|
22
|
+
task :test_server do
|
23
|
+
with_server('test',
|
24
|
+
fcrepo_port: ENV.fetch('FCREPO_PORT', '8986'),
|
25
|
+
solr_port: ENV.fetch('SOLR_PORT', '8985')) do
|
26
|
+
begin
|
27
|
+
sleep
|
28
|
+
rescue Interrupt
|
29
|
+
puts "Stopping server"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
20
33
|
end
|
@@ -14,7 +14,7 @@ describe CatalogController do
|
|
14
14
|
let(:config) { CatalogController.blacklight_config }
|
15
15
|
describe "search_builder_class" do
|
16
16
|
subject {config.search_builder_class }
|
17
|
-
it { is_expected.to eq
|
17
|
+
it { is_expected.to eq ::SearchBuilder }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -1,22 +1,42 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe SearchBuilder do
|
4
4
|
let(:processor_chain) { [:add_access_controls_to_solr_params] }
|
5
5
|
let(:context) { double('context') }
|
6
6
|
let(:user) { double('user', user_key: 'joe') }
|
7
7
|
let(:current_ability) { double('ability', user_groups: [], current_user: user) }
|
8
|
+
let(:search_builder) { described_class }
|
8
9
|
|
9
|
-
subject
|
10
|
+
subject do
|
11
|
+
Deprecation.silence(Hydra::SearchBuilder) do
|
12
|
+
search_builder.new(processor_chain, context)
|
13
|
+
end
|
14
|
+
end
|
10
15
|
before { subject.current_ability = current_ability }
|
11
16
|
|
12
|
-
it "
|
17
|
+
it "extends classes with the necessary Hydra modules" do
|
13
18
|
expect(Hydra::SearchBuilder.included_modules).to include(Hydra::AccessControlsEnforcement)
|
14
19
|
end
|
15
20
|
|
16
21
|
context "when a query is generated" do
|
17
|
-
it "
|
22
|
+
it "triggers add_access_controls_to_solr_params" do
|
18
23
|
expect(subject).to receive(:add_access_controls_to_solr_params)
|
19
24
|
subject.query
|
20
25
|
end
|
21
26
|
end
|
27
|
+
|
28
|
+
context "the deprecated Hydra::SearchBuilder" do
|
29
|
+
let(:search_builder) { Hydra::SearchBuilder }
|
30
|
+
|
31
|
+
it "extends classes with the necessary Hydra modules" do
|
32
|
+
expect(Hydra::SearchBuilder.included_modules).to include(Hydra::AccessControlsEnforcement)
|
33
|
+
end
|
34
|
+
|
35
|
+
context "when a query is generated" do
|
36
|
+
it "triggers add_access_controls_to_solr_params" do
|
37
|
+
expect(subject).to receive(:add_access_controls_to_solr_params)
|
38
|
+
subject.query
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
22
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield,
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-03-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -31,28 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 9.
|
34
|
+
version: 9.9.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 9.
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: active-fedora
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - "~>"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '9.8'
|
49
|
-
type: :runtime
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - "~>"
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '9.8'
|
41
|
+
version: 9.9.0
|
56
42
|
- !ruby/object:Gem::Dependency
|
57
43
|
name: sqlite3
|
58
44
|
requirement: !ruby/object:Gem::Requirement
|