hydra-collections 5.0.3 → 5.0.4

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: 7585019c90e5e1209d393c315e52f88b73169a95
4
- data.tar.gz: 2655fad70f96136e738e3e11ffd81dcabb9ddfec
3
+ metadata.gz: 36ddec8b1586e43c728658973979db06786efb05
4
+ data.tar.gz: 07d3a47de4e1fac51cb63cbce5dcab0e7f1078e0
5
5
  SHA512:
6
- metadata.gz: ac2cedd5a619df9ae770e8c1f3998dd36ce5ab8352be884d75e08512f8dc0649890625ad7f384f4d697d216cc7f77653ab9e8ce60002d83a991528326d2a776b
7
- data.tar.gz: cee8d4465333e5378c95c1ff3575b996b8e843cc8a552f1d3d713be40f7a6963bf55d538a229958ff6b560ef4c433d3ca6ba45360f87e5ce33d407e1b0d402ec
6
+ metadata.gz: 008fb15b304508524d24bbf9c25246e6e32db12b744d974fe762659544acde8f2b266f8a641a6ba39491a9d6400096e382a3ff0e48930cdb587170fe500ae261
7
+ data.tar.gz: 995ff18102b0a35df5e089ea1c45818323a7d16460f2c386993f4b64fe06b5d5321d73d393b34d513a5d9f4678d4c3e7ddf9b297bfbfaa4ccef54bd54db23c65
data/.gitignore CHANGED
@@ -18,5 +18,5 @@ spec/reports
18
18
  test/tmp
19
19
  test/version_tmp
20
20
  tmp
21
- spec/internal
21
+ .internal_test_app
22
22
  jetty
@@ -2,13 +2,12 @@ language: ruby
2
2
  cache: bundler
3
3
  sudo: false
4
4
  rvm:
5
- - 2.1
5
+ - 2.2
6
6
  env:
7
7
  global:
8
8
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
9
9
  matrix:
10
- - "RAILS_VERSION=4.1.10"
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
- gem 'slop', '~> 3.6' # because rails installs byebug in the Gemfile
20
-
21
- file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__))
22
- if File.exists?(file)
23
- puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
24
- instance_eval File.read(file)
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'] and ENV['RAILS_VERSION'] !~ /^4.2/
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: ::RDF::URI.new("http://id.loc.gov/vocabulary/relators/dpt"), multiple: false do |index|
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
- property :contributor, predicate: RDF::DC.contributor do |index|
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
- property :creator, predicate: RDF::DC.creator do |index|
14
+
15
+ property :creator, predicate: RDF::Vocab::DC.creator do |index|
14
16
  index.as :stored_searchable, :facetable
15
17
  end
16
- property :title, predicate: RDF::DC.title, multiple: false do |index|
17
- index.as :stored_searchable
18
+
19
+ property :title, predicate: RDF::Vocab::DC.title, multiple: false do |index|
20
+ index.as :stored_searchable, :sortable
18
21
  end
19
- property :description, predicate: RDF::DC.description, multiple: false do |index|
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
- property :publisher, predicate: RDF::DC.publisher do |index|
27
+
28
+ property :publisher, predicate: RDF::Vocab::DC.publisher do |index|
24
29
  index.as :stored_searchable, :facetable
25
30
  end
26
- property :date_created, predicate: RDF::DC.created do |index|
31
+
32
+ property :date_created, predicate: RDF::Vocab::DC.created do |index|
27
33
  index.as :stored_searchable
28
34
  end
29
- property :date_uploaded, predicate: RDF::DC.dateSubmitted, multiple: false do |index|
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
- property :date_modified, predicate: RDF::DC.modified, multiple: false do |index|
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
- property :subject, predicate: RDF::DC.subject do |index|
45
+
46
+ property :subject, predicate: RDF::Vocab::DC.subject do |index|
38
47
  index.as :stored_searchable, :facetable
39
48
  end
40
- property :language, predicate: RDF::DC.language do |index|
49
+
50
+ property :language, predicate: RDF::Vocab::DC.language do |index|
41
51
  index.as :stored_searchable, :facetable
42
52
  end
43
- property :rights, predicate: RDF::DC.rights do |index|
53
+
54
+ property :rights, predicate: RDF::Vocab::DC.rights do |index|
44
55
  index.as :stored_searchable
45
56
  end
46
- property :resource_type, predicate: RDF::DC.type do |index|
57
+
58
+ property :resource_type, predicate: RDF::Vocab::DC.type do |index|
47
59
  index.as :stored_searchable, :facetable
48
60
  end
49
- property :identifier, predicate: RDF::DC.identifier do |index|
61
+
62
+ property :identifier, predicate: RDF::Vocab::DC.identifier do |index|
50
63
  index.as :stored_searchable
51
64
  end
52
- property :based_near, predicate: RDF::FOAF.based_near do |index|
65
+
66
+ property :based_near, predicate: RDF::Vocab::FOAF.based_near do |index|
53
67
  index.as :stored_searchable, :facetable
54
68
  end
55
- property :tag, predicate: RDF::DC.relation do |index|
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
@@ -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.5'
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
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module Collections
3
- VERSION = "5.0.3"
3
+ VERSION = "5.0.4"
4
4
  end
5
5
  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 "should show a list of collections" do
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 [collection1.id, collection2.id]
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 "should use 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])
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 "should have title and depositor information" do
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
@@ -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 File.expand_path("config/environment", ENV['RAILS_ROOT'] || File.expand_path("../internal", __FILE__))
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.3
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: 2015-09-03 00:00:00.000000000 Z
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.5'
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.5'
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.2.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