hydra-collections 5.0.3 → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +2 -3
- data/Gemfile +18 -9
- data/app/controllers/concerns/hydra/collections/selects_collections.rb +1 -1
- data/app/models/concerns/hydra/collections/metadata.rb +34 -19
- data/hydra-collections.gemspec +2 -1
- data/lib/hydra/collections/search_behaviors.rb +11 -0
- data/lib/hydra/collections/version.rb +1 -1
- data/spec/controllers/collections_controller_spec.rb +5 -5
- data/spec/controllers/selects_collections_spec.rb +2 -2
- data/spec/models/collection_spec.rb +2 -1
- data/spec/spec_helper.rb +3 -4
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- metadata +19 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 36ddec8b1586e43c728658973979db06786efb05
|
|
4
|
+
data.tar.gz: 07d3a47de4e1fac51cb63cbce5dcab0e7f1078e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 008fb15b304508524d24bbf9c25246e6e32db12b744d974fe762659544acde8f2b266f8a641a6ba39491a9d6400096e382a3ff0e48930cdb587170fe500ae261
|
|
7
|
+
data.tar.gz: 995ff18102b0a35df5e089ea1c45818323a7d16460f2c386993f4b64fe06b5d5321d73d393b34d513a5d9f4678d4c3e7ddf9b297bfbfaa4ccef54bd54db23c65
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
|
@@ -2,13 +2,12 @@ language: ruby
|
|
|
2
2
|
cache: bundler
|
|
3
3
|
sudo: false
|
|
4
4
|
rvm:
|
|
5
|
-
- 2.
|
|
5
|
+
- 2.2
|
|
6
6
|
env:
|
|
7
7
|
global:
|
|
8
8
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
|
9
9
|
matrix:
|
|
10
|
-
- "RAILS_VERSION=4.
|
|
11
|
-
- "RAILS_VERSION=4.2.1"
|
|
10
|
+
- "RAILS_VERSION=4.2.5"
|
|
12
11
|
notifications:
|
|
13
12
|
email:
|
|
14
13
|
recipients:
|
data/Gemfile
CHANGED
|
@@ -16,19 +16,28 @@ group :development, :test do
|
|
|
16
16
|
gem 'rspec-activemodel-mocks'
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
# BEGIN ENGINE_CART BLOCK
|
|
20
|
+
# engine_cart: 0.8.0
|
|
21
|
+
# engine_cart stanza: 0.8.0
|
|
22
|
+
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
|
|
23
|
+
file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path(".internal_test_app", File.dirname(__FILE__)))
|
|
24
|
+
if File.exist?(file)
|
|
25
|
+
begin
|
|
26
|
+
eval_gemfile file
|
|
27
|
+
rescue Bundler::GemfileError => e
|
|
28
|
+
Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
|
|
29
|
+
Bundler.ui.warn e.message
|
|
30
|
+
end
|
|
25
31
|
else
|
|
32
|
+
Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
|
|
33
|
+
|
|
26
34
|
gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
|
|
27
35
|
|
|
28
|
-
if ENV['RAILS_VERSION']
|
|
29
|
-
gem 'sass-rails', "< 5.0"
|
|
30
|
-
else
|
|
36
|
+
if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
|
|
31
37
|
gem 'responders', "~> 2.0"
|
|
32
38
|
gem 'sass-rails', ">= 5.0"
|
|
39
|
+
else
|
|
40
|
+
gem 'sass-rails', "< 5.0"
|
|
33
41
|
end
|
|
34
42
|
end
|
|
43
|
+
# END ENGINE_CART BLOCK
|
|
@@ -66,7 +66,7 @@ module Hydra::Collections::SelectsCollections
|
|
|
66
66
|
# Defines which search_params_logic should be used when searching for Collections
|
|
67
67
|
def collection_search_params_logic
|
|
68
68
|
[:default_solr_parameters, :add_query_to_solr, :add_access_controls_to_solr_params,
|
|
69
|
-
:add_collection_filter, :some_rows]
|
|
69
|
+
:add_collection_filter, :some_rows, :sort_by_title]
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
end
|
|
@@ -2,61 +2,76 @@ module Hydra::Collections
|
|
|
2
2
|
module Metadata
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
4
|
included do
|
|
5
|
-
property :depositor, predicate:
|
|
5
|
+
property :depositor, predicate: RDF::Vocab::MARCRelators.dpt, multiple: false do |index|
|
|
6
6
|
index.as :symbol, :stored_searchable
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
property :part_of, predicate: RDF::DC.isPartOf
|
|
10
|
-
|
|
9
|
+
property :part_of, predicate: RDF::Vocab::DC.isPartOf
|
|
10
|
+
|
|
11
|
+
property :contributor, predicate: RDF::Vocab::DC.contributor do |index|
|
|
11
12
|
index.as :stored_searchable, :facetable
|
|
12
13
|
end
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
property :creator, predicate: RDF::Vocab::DC.creator do |index|
|
|
14
16
|
index.as :stored_searchable, :facetable
|
|
15
17
|
end
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
property :title, predicate: RDF::Vocab::DC.title, multiple: false do |index|
|
|
20
|
+
index.as :stored_searchable, :sortable
|
|
18
21
|
end
|
|
19
|
-
|
|
22
|
+
|
|
23
|
+
property :description, predicate: RDF::Vocab::DC.description, multiple: false do |index|
|
|
20
24
|
index.type :text
|
|
21
25
|
index.as :stored_searchable
|
|
22
26
|
end
|
|
23
|
-
|
|
27
|
+
|
|
28
|
+
property :publisher, predicate: RDF::Vocab::DC.publisher do |index|
|
|
24
29
|
index.as :stored_searchable, :facetable
|
|
25
30
|
end
|
|
26
|
-
|
|
31
|
+
|
|
32
|
+
property :date_created, predicate: RDF::Vocab::DC.created do |index|
|
|
27
33
|
index.as :stored_searchable
|
|
28
34
|
end
|
|
29
|
-
|
|
35
|
+
|
|
36
|
+
property :date_uploaded, predicate: RDF::Vocab::DC.dateSubmitted, multiple: false do |index|
|
|
30
37
|
index.type :date
|
|
31
38
|
index.as :stored_sortable
|
|
32
39
|
end
|
|
33
|
-
|
|
40
|
+
|
|
41
|
+
property :date_modified, predicate: RDF::Vocab::DC.modified, multiple: false do |index|
|
|
34
42
|
index.type :date
|
|
35
43
|
index.as :stored_sortable
|
|
36
44
|
end
|
|
37
|
-
|
|
45
|
+
|
|
46
|
+
property :subject, predicate: RDF::Vocab::DC.subject do |index|
|
|
38
47
|
index.as :stored_searchable, :facetable
|
|
39
48
|
end
|
|
40
|
-
|
|
49
|
+
|
|
50
|
+
property :language, predicate: RDF::Vocab::DC.language do |index|
|
|
41
51
|
index.as :stored_searchable, :facetable
|
|
42
52
|
end
|
|
43
|
-
|
|
53
|
+
|
|
54
|
+
property :rights, predicate: RDF::Vocab::DC.rights do |index|
|
|
44
55
|
index.as :stored_searchable
|
|
45
56
|
end
|
|
46
|
-
|
|
57
|
+
|
|
58
|
+
property :resource_type, predicate: RDF::Vocab::DC.type do |index|
|
|
47
59
|
index.as :stored_searchable, :facetable
|
|
48
60
|
end
|
|
49
|
-
|
|
61
|
+
|
|
62
|
+
property :identifier, predicate: RDF::Vocab::DC.identifier do |index|
|
|
50
63
|
index.as :stored_searchable
|
|
51
64
|
end
|
|
52
|
-
|
|
65
|
+
|
|
66
|
+
property :based_near, predicate: RDF::Vocab::FOAF.based_near do |index|
|
|
53
67
|
index.as :stored_searchable, :facetable
|
|
54
68
|
end
|
|
55
|
-
|
|
69
|
+
|
|
70
|
+
property :tag, predicate: RDF::Vocab::DC.relation do |index|
|
|
56
71
|
index.as :stored_searchable, :facetable
|
|
57
72
|
end
|
|
58
|
-
property :related_url, predicate: RDF::RDFS.seeAlso
|
|
59
73
|
|
|
74
|
+
property :related_url, predicate: RDF::RDFS.seeAlso
|
|
60
75
|
end
|
|
61
76
|
end
|
|
62
77
|
end
|
data/hydra-collections.gemspec
CHANGED
|
@@ -21,7 +21,8 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.add_dependency 'hydra-head', '~> 9.1'
|
|
22
22
|
spec.add_dependency 'deprecation', '~> 0.1'
|
|
23
23
|
spec.add_dependency 'blacklight', '~> 5.10'
|
|
24
|
+
spec.add_dependency 'rdf-vocab', '~> 0'
|
|
24
25
|
|
|
25
|
-
spec.add_development_dependency 'engine_cart', '~> 0.
|
|
26
|
+
spec.add_development_dependency 'engine_cart', '~> 0.8'
|
|
26
27
|
spec.add_development_dependency 'rspec-rails', '~> 3.1'
|
|
27
28
|
end
|
|
@@ -19,6 +19,13 @@ module Hydra::Collections::SearchBehaviors
|
|
|
19
19
|
solr_parameters[:fq] << ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: ::Collection.to_class_uri)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
# Sort results by title if no query was supplied.
|
|
23
|
+
# This overrides the default 'relevance' sort.
|
|
24
|
+
def sort_by_title(solr_parameters)
|
|
25
|
+
return if solr_parameters[:q]
|
|
26
|
+
solr_parameters[:sort] ||= "#{sort_field} asc"
|
|
27
|
+
end
|
|
28
|
+
|
|
22
29
|
def discovery_perms= perms
|
|
23
30
|
@discovery_perms = perms
|
|
24
31
|
end
|
|
@@ -27,4 +34,8 @@ module Hydra::Collections::SearchBehaviors
|
|
|
27
34
|
@discovery_perms || super
|
|
28
35
|
end
|
|
29
36
|
|
|
37
|
+
def sort_field
|
|
38
|
+
Solrizer.solr_name('title', :sortable)
|
|
39
|
+
end
|
|
40
|
+
|
|
30
41
|
end
|
|
@@ -14,7 +14,7 @@ describe CollectionsController, :type => :controller do
|
|
|
14
14
|
include Hydra::Collections::Collectible
|
|
15
15
|
include Hydra::AccessControls::Permissions
|
|
16
16
|
|
|
17
|
-
property :title, predicate: ::RDF::DC.title, multiple: false
|
|
17
|
+
property :title, predicate: ::RDF::Vocab::DC.title, multiple: false
|
|
18
18
|
|
|
19
19
|
def to_solr(solr_doc={})
|
|
20
20
|
super.tap do |solr_doc|
|
|
@@ -39,15 +39,15 @@ describe CollectionsController, :type => :controller do
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
describe "#index" do
|
|
42
|
-
let!(:collection1) { Collection.create { |c| c.apply_depositor_metadata(user.user_key) } }
|
|
43
|
-
let!(:collection2) { Collection.create { |c| c.apply_depositor_metadata(user.user_key) } }
|
|
42
|
+
let!(:collection1) { Collection.create(title: 'Beta') { |c| c.apply_depositor_metadata(user.user_key) } }
|
|
43
|
+
let!(:collection2) { Collection.create(title: 'Alpha') { |c| c.apply_depositor_metadata(user.user_key) } }
|
|
44
44
|
let!(:generic_file) { GenericFile.create }
|
|
45
45
|
|
|
46
|
-
it "
|
|
46
|
+
it "shows a list of collections sorted alphabetically" do
|
|
47
47
|
get :index
|
|
48
48
|
expect(response).to be_successful
|
|
49
49
|
expect(assigns[:document_list].map(&:id)).not_to include generic_file.id
|
|
50
|
-
expect(assigns[:document_list].map(&:id)).to eq [
|
|
50
|
+
expect(assigns[:document_list].map(&:id)).to eq [collection2.id, collection1.id]
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -11,8 +11,8 @@ end
|
|
|
11
11
|
describe SelectsCollectionsController, :type => :controller do
|
|
12
12
|
|
|
13
13
|
describe "#find_collections" do
|
|
14
|
-
it "
|
|
15
|
-
expect(subject.collection_search_params_logic).to eq
|
|
14
|
+
it "uses collection_search_params_logic" do
|
|
15
|
+
expect(subject.collection_search_params_logic).to eq [:default_solr_parameters, :add_query_to_solr, :add_access_controls_to_solr_params, :add_collection_filter, :some_rows, :sort_by_title]
|
|
16
16
|
expect(Hydra::Collections::SearchBuilder).to receive(:new).with(subject.collection_search_params_logic, subject).and_call_original
|
|
17
17
|
subject.find_collections
|
|
18
18
|
end
|
|
@@ -23,8 +23,9 @@ describe Collection, :type => :model do
|
|
|
23
23
|
|
|
24
24
|
subject { collection.to_solr }
|
|
25
25
|
|
|
26
|
-
it "
|
|
26
|
+
it "has title and depositor information" do
|
|
27
27
|
expect(subject['title_tesim']).to eq ['A good title']
|
|
28
|
+
expect(subject['title_si']).to eq 'A good title'
|
|
28
29
|
expect(subject['depositor_tesim']).to eq [user.user_key]
|
|
29
30
|
expect(subject['depositor_ssim']).to eq [user.user_key]
|
|
30
31
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -5,12 +5,11 @@ else
|
|
|
5
5
|
require 'byebug'
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
10
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
11
8
|
ENV["RAILS_ENV"] ||= 'test'
|
|
12
9
|
|
|
13
|
-
require
|
|
10
|
+
require 'engine_cart'
|
|
11
|
+
EngineCart.load_application!
|
|
12
|
+
|
|
14
13
|
require 'rspec/rails'
|
|
15
14
|
require 'hydra-collections'
|
|
16
15
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'rails/generators'
|
|
2
2
|
|
|
3
3
|
class TestAppGenerator < Rails::Generators::Base
|
|
4
|
-
source_root File.expand_path("../../../../test_app_templates", __FILE__)
|
|
4
|
+
source_root File.expand_path("../../../../spec/test_app_templates", __FILE__)
|
|
5
5
|
|
|
6
6
|
def update_gemfile
|
|
7
7
|
append_to_file "Gemfile" do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hydra-collections
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.0.
|
|
4
|
+
version: 5.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carolyn Cole
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: hydra-head
|
|
@@ -52,20 +52,34 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '5.10'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rdf-vocab
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: engine_cart
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
58
72
|
requirements:
|
|
59
73
|
- - "~>"
|
|
60
74
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0.
|
|
75
|
+
version: '0.8'
|
|
62
76
|
type: :development
|
|
63
77
|
prerelease: false
|
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
79
|
requirements:
|
|
66
80
|
- - "~>"
|
|
67
81
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0.
|
|
82
|
+
version: '0.8'
|
|
69
83
|
- !ruby/object:Gem::Dependency
|
|
70
84
|
name: rspec-rails
|
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -205,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
205
219
|
version: '0'
|
|
206
220
|
requirements: []
|
|
207
221
|
rubyforge_project:
|
|
208
|
-
rubygems_version: 2.
|
|
222
|
+
rubygems_version: 2.4.5.1
|
|
209
223
|
signing_key:
|
|
210
224
|
specification_version: 4
|
|
211
225
|
summary: A rails engine for managing Hydra Collections
|