hydra-collections 6.0.0.rc1 → 6.0.0.rc2

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: f660059815d3e4687d927cbfebc290aa43b1c029
4
- data.tar.gz: 3eec16c408c10c7f08d9f4c77a52ec6ea9555619
3
+ metadata.gz: 70208265112262f5fb9156ac22eddc1cb7566e45
4
+ data.tar.gz: 033f7fbf3ad9571401b8ad2d74a22d9c36b26018
5
5
  SHA512:
6
- metadata.gz: 61d400608b2fb3b865dfbee6c14d73d39f5aa70172bd5d88c9ab379207798f36065bf22d9d1a08fc2ec85ff61a3ed92ca7793b26cbf7b5b112e9c355162e75c6
7
- data.tar.gz: e4f3c3ef0120f0734ab46fc6d76f67767f6b2965235cca7f3008635ef2b73043fb8dd961e17dadf72002db15dd6b5d47018a153dedca079158608bb3231bb5cf
6
+ metadata.gz: 7ee7153015e13dd46a7f23ea9e45183bc9a3608f58691617f9a2199e285aec2010c1cbeb16611878853c3d90adc98a671db0906b94a0b6549a5cd8f175cf35b7
7
+ data.tar.gz: b43ab33b68eb9ee9b55374ffcbb78a049ee641027ce6d01c230f60b3900277e2ee80c56390bab45a64a377448ac7d2277beae3fa81b4d2b46b222b06c61915f7
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
data/.travis.yml CHANGED
@@ -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
@@ -14,22 +14,28 @@ group :development, :test do
14
14
  gem 'rspec-activemodel-mocks'
15
15
  end
16
16
 
17
- gem 'slop', '~> 3.6' # because rails installs byebug in the Gemfile
18
-
19
- file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__))
20
- if File.exists?(file)
21
- puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
22
- instance_eval File.read(file)
17
+ # BEGIN ENGINE_CART BLOCK
18
+ # engine_cart: 0.8.0
19
+ # engine_cart stanza: 0.8.0
20
+ # the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
21
+ file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path(".internal_test_app", File.dirname(__FILE__)))
22
+ if File.exist?(file)
23
+ begin
24
+ eval_gemfile file
25
+ rescue Bundler::GemfileError => e
26
+ Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
27
+ Bundler.ui.warn e.message
28
+ end
23
29
  else
24
- extra_file = File.expand_path("../spec/test_app_templates/Gemfile.extra", __FILE__)
25
- instance_eval File.read(extra_file)
30
+ Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
26
31
 
27
32
  gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
28
33
 
29
- if ENV['RAILS_VERSION'] and ENV['RAILS_VERSION'] !~ /^4.2/
30
- gem 'sass-rails', "< 5.0"
31
- else
34
+ if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
32
35
  gem 'responders', "~> 2.0"
33
36
  gem 'sass-rails', ">= 5.0"
37
+ else
38
+ gem 'sass-rails', "< 5.0"
34
39
  end
35
40
  end
41
+ # END ENGINE_CART BLOCK
data/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Add collections to your Hydra application. These collections are typically created by depositors (instead of librarians or curators). Any collectible item can belong to many different collections. The collection does not confer access rights onto any of the members of the collections.
4
4
 
5
+ ## CAVEAT (READ THIS)
6
+
7
+ If you do **not** require PCDM, or do not know what PCDM is, please disregard this README (which is for a release candidate version of Hydra::Collections that relies upon a new stack of gems in support of PCDM) and use [Hydra::Collections' latest stable branch README](https://github.com/projecthydra/hydra-collections/blob/5.0-stable/README.md) instead.
8
+
5
9
  ## Installation
6
10
 
7
11
  Add this line to your application's Gemfile:
@@ -35,16 +39,16 @@ Or install it yourself as:
35
39
 
36
40
  ### Make your Models Collectible
37
41
 
38
- Add `include Hydra::Works::GenericWorkBehavior` to the models for anything that you want to be able to add to collections (ie. GenericFile, Book, Article, etc.).
42
+ Add `include Hydra::Works::WorkBehavior` to the models for anything that you want to be able to add to collections (ie. GenericFile, Book, Article, etc.).
39
43
 
40
44
  Example:
41
45
  ```ruby
42
46
  class GenericFile < ActiveFedora::Base
43
- include Hydra::Works::GenericWorkBehavior
47
+ include Hydra::Works::WorkBehavior
44
48
  end
45
49
  ```
46
50
 
47
- Any items that include the `Hydra::Works::GenericWorkBehavior` module can look up which collections they belong to via `.in_collections`.
51
+ Any items that include the `Hydra::Works::WorkBehavior` module can look up which collections they belong to via `.in_collections`.
48
52
 
49
53
  ### Make your Controller Accept a Batch
50
54
 
@@ -57,7 +57,7 @@ module Hydra::Collections::SelectsCollections
57
57
  end
58
58
 
59
59
  def collections_search_builder(access_level = nil)
60
- @collections_search_builder ||= collections_search_builder_class.new(collection_search_params_logic, self).tap do |builder|
60
+ collections_search_builder_class.new(collection_search_params_logic, self).tap do |builder|
61
61
  builder.current_ability = current_ability
62
62
  builder.discovery_perms = access_levels[access_level] if access_level
63
63
  end
@@ -1,54 +1,50 @@
1
1
  # View Helpers for Hydra Collections functionality
2
- module CollectionsHelper
3
-
4
-
2
+ module CollectionsHelper
5
3
  # Displays the Collections create collection button. Put this in your search result page template. We recommend putting it in catalog/_sort_and_per_page.html.erb
6
4
  def button_for_create_collection(label = 'Create Collection')
7
- render partial:'/collections/button_create_collection', locals:{label:label}
5
+ render '/collections/button_create_collection', label: label
8
6
  end
9
7
 
10
8
  # Displays the Collections update collection button. Put this in your search result page template. We recommend putting it in catalog/_sort_and_per_page.html.erb
11
- def button_for_update_collection(label = 'Update Collection', collection_id = 'collection_replace_id' )
12
- render partial:'/collections/button_for_update_collection', locals:{label:label, collection_id:collection_id}
9
+ def button_for_update_collection(label = 'Update Collection', collection_id = 'collection_replace_id')
10
+ render '/collections/button_for_update_collection', label: label, collection_id: collection_id
13
11
  end
14
-
12
+
15
13
  # Displays the Collections delete collection button. Put this in your search result page for each collection found.
16
- def button_for_delete_collection(collection, label = 'Delete Collection', confirm = 'Are you sure?')
17
- render partial:'/collections/button_for_delete_collection', locals:{collection:collection,label:label, confirm:confirm}
14
+ def button_for_delete_collection(collection, label = 'Delete Collection', confirm = 'Are you sure?')
15
+ render '/collections/button_for_delete_collection', collection: collection, label: label, confirm: confirm
18
16
  end
19
17
 
20
18
  def button_for_remove_from_collection(document, label = 'Remove From Collection')
21
- render partial:'/collections/button_remove_from_collection', locals:{label:label, document:document}
19
+ render '/collections/button_remove_from_collection', label: label, document: document
22
20
  end
23
21
 
24
22
  def button_for_remove_selected_from_collection(collection, label = 'Remove From Collection')
25
- render partial:'/collections/button_for_remove_selected_from_collection', locals:{collection:collection, label:label}
23
+ render '/collections/button_for_remove_selected_from_collection', collection: collection, label: label
26
24
  end
27
25
 
28
-
29
26
  # add hidden fields to a form for removing a single document from a collection
30
27
  def single_item_action_remove_form_fields(form, document)
31
- single_item_action_form_fields(form, document, "remove")
28
+ single_item_action_form_fields(form, document, 'remove')
32
29
  end
33
-
30
+
34
31
  # add hidden fields to a form for adding a single document to a collection
35
32
  def single_item_action_add_form_fields(form, document)
36
- single_item_action_form_fields(form, document, "add")
33
+ single_item_action_form_fields(form, document, 'add')
37
34
  end
38
35
 
39
- # add hidden fields to a form for performing an action on a single document on a collection
36
+ # add hidden fields to a form for performing an action on a single document on a collection
40
37
  def single_item_action_form_fields(form, document, action)
41
- render partial:'/collections/single_item_action_fields', locals:{form:form, document:document, action: action}
38
+ render '/collections/single_item_action_fields', form: form, document: document, action: action
42
39
  end
43
40
 
44
41
  def hidden_collection_members
45
42
  _erbout = ''
46
43
  if params[:batch_document_ids].present?
47
44
  params[:batch_document_ids].each do |batch_item|
48
- _erbout.concat hidden_field_tag("batch_document_ids[]", batch_item)
45
+ _erbout.concat hidden_field_tag('batch_document_ids[]', batch_item)
49
46
  end
50
47
  end
51
48
  _erbout.html_safe
52
49
  end
53
-
54
50
  end
@@ -2,57 +2,57 @@ 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
+ property :contributor, predicate: RDF::Vocab::DC.contributor do |index|
11
11
  index.as :stored_searchable, :facetable
12
12
  end
13
- property :creator, predicate: RDF::DC.creator do |index|
13
+ property :creator, predicate: RDF::Vocab::DC.creator do |index|
14
14
  index.as :stored_searchable, :facetable
15
15
  end
16
- property :title, predicate: RDF::DC.title, multiple: false do |index|
16
+ property :title, predicate: RDF::Vocab::DC.title, multiple: false do |index|
17
17
  index.as :stored_searchable
18
18
  end
19
- property :description, predicate: RDF::DC.description, multiple: false do |index|
19
+ property :description, predicate: RDF::Vocab::DC.description, multiple: false do |index|
20
20
  index.type :text
21
21
  index.as :stored_searchable
22
22
  end
23
- property :publisher, predicate: RDF::DC.publisher do |index|
23
+ property :publisher, predicate: RDF::Vocab::DC.publisher do |index|
24
24
  index.as :stored_searchable, :facetable
25
25
  end
26
- property :date_created, predicate: RDF::DC.created do |index|
26
+ property :date_created, predicate: RDF::Vocab::DC.created do |index|
27
27
  index.as :stored_searchable
28
28
  end
29
- property :date_uploaded, predicate: RDF::DC.dateSubmitted, multiple: false do |index|
29
+ property :date_uploaded, predicate: RDF::Vocab::DC.dateSubmitted, multiple: false do |index|
30
30
  index.type :date
31
31
  index.as :stored_sortable
32
32
  end
33
- property :date_modified, predicate: RDF::DC.modified, multiple: false do |index|
33
+ property :date_modified, predicate: RDF::Vocab::DC.modified, multiple: false do |index|
34
34
  index.type :date
35
35
  index.as :stored_sortable
36
36
  end
37
- property :subject, predicate: RDF::DC.subject do |index|
37
+ property :subject, predicate: RDF::Vocab::DC.subject do |index|
38
38
  index.as :stored_searchable, :facetable
39
39
  end
40
- property :language, predicate: RDF::DC.language do |index|
40
+ property :language, predicate: RDF::Vocab::DC.language do |index|
41
41
  index.as :stored_searchable, :facetable
42
42
  end
43
- property :rights, predicate: RDF::DC.rights do |index|
43
+ property :rights, predicate: RDF::Vocab::DC.rights do |index|
44
44
  index.as :stored_searchable
45
45
  end
46
- property :resource_type, predicate: RDF::DC.type do |index|
46
+ property :resource_type, predicate: RDF::Vocab::DC.type do |index|
47
47
  index.as :stored_searchable, :facetable
48
48
  end
49
- property :identifier, predicate: RDF::DC.identifier do |index|
49
+ property :identifier, predicate: RDF::Vocab::DC.identifier do |index|
50
50
  index.as :stored_searchable
51
51
  end
52
- property :based_near, predicate: RDF::FOAF.based_near do |index|
52
+ property :based_near, predicate: RDF::Vocab::FOAF.based_near do |index|
53
53
  index.as :stored_searchable, :facetable
54
54
  end
55
- property :tag, predicate: RDF::DC.relation do |index|
55
+ property :tag, predicate: RDF::Vocab::DC.relation do |index|
56
56
  index.as :stored_searchable, :facetable
57
57
  end
58
58
  property :related_url, predicate: RDF::RDFS.seeAlso
@@ -21,8 +21,9 @@ 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 'hydra-works', '~> 0.2'
24
+ spec.add_dependency 'hydra-works', '~> 0.4'
25
+ spec.add_dependency 'rdf', '~> 1.99'
25
26
 
26
- spec.add_development_dependency 'engine_cart', '~> 0.5'
27
+ spec.add_development_dependency 'engine_cart', '~> 0.8'
27
28
  spec.add_development_dependency 'rspec-rails', '~> 3.1'
28
29
  end
@@ -7,8 +7,8 @@ module Hydra::Collections
7
7
  extend Deprecation
8
8
 
9
9
  included do
10
- include Hydra::Works::GenericWorkBehavior
11
- Deprecation.warn(Collectible, "Hydra::Collections::Collectible is deprecated. include Hydra::Works::GenericWorkBehavior instead. Hydra::Collections::Collectible will be removed in Hydra::Collections 7.0")
10
+ include Hydra::Works::WorkBehavior
11
+ Deprecation.warn(Collectible, "Hydra::Collections::Collectible is deprecated. include Hydra::Works::WorkBehavior instead. Hydra::Collections::Collectible will be removed in Hydra::Collections 7.0")
12
12
  end
13
13
 
14
14
  def collection_ids
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module Collections
3
- VERSION = "6.0.0.rc1"
3
+ VERSION = "6.0.0.rc2"
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ describe CollectionsController, :type => :controller do
12
12
 
13
13
  class GenericWork < ActiveFedora::Base
14
14
  include Hydra::AccessControls::Permissions
15
- include Hydra::Works::GenericWorkBehavior
15
+ include Hydra::Works::WorkBehavior
16
16
 
17
17
  property :title, predicate: ::RDF::DC.title, multiple: false
18
18
 
@@ -8,7 +8,7 @@ describe OtherCollectionsController, :type => :controller do
8
8
  end
9
9
 
10
10
  class Member < ActiveFedora::Base
11
- include Hydra::Works::GenericWorkBehavior
11
+ include Hydra::Works::WorkBehavior
12
12
  include Hydra::AccessControls::Permissions
13
13
  end
14
14
  end
@@ -86,15 +86,26 @@ describe SelectsCollectionsController, :type => :controller do
86
86
  describe "signed in" do
87
87
  before { sign_in @user }
88
88
 
89
- it "should return only public or editable collections" do
89
+ it "returns only public or editable collections" do
90
90
  subject.find_collections_with_edit_access
91
91
  expect(assigns[:user_collections].map(&:id)).to match_array [@collection.id, @collection3.id]
92
92
  end
93
93
 
94
- it "should return only public or editable collections & instructions" do
94
+ it "returns only public or editable collections & instructions" do
95
95
  subject.find_collections_with_edit_access(true)
96
96
  expect(assigns[:user_collections].map(&:id)).to match_array [-1, @collection.id, @collection3.id]
97
97
  end
98
+
99
+ context "after querying for read access" do
100
+ before do
101
+ subject.find_collections
102
+ subject.find_collections_with_edit_access
103
+ end
104
+
105
+ it "returns collections with edit access" do
106
+ expect(assigns[:user_collections].map(&:id)).to match_array [@collection.id, @collection3.id]
107
+ end
108
+ end
98
109
  end
99
110
  end
100
111
  end
@@ -62,7 +62,7 @@ describe CollectionsHelper, :type => :helper do
62
62
  before(:all) do
63
63
  class OtherCollection < ActiveFedora::Base
64
64
  include Hydra::Collection
65
- include Hydra::Works::GenericWorkBehavior
65
+ include Hydra::Works::WorkBehavior
66
66
  end
67
67
 
68
68
  @collection = OtherCollection.create
@@ -23,15 +23,7 @@ describe Hydra::Collections::SearchService do
23
23
  expect(@group_query).to eq('edit_access_group_ssim:umg\/test.group.1')
24
24
  end
25
25
  it "should allow overriding Solr's access control suffix" do
26
- module Hydra
27
- module Collections
28
- class SearchService
29
- def solr_access_control_suffix(key)
30
- "edit_#{key}_customfield"
31
- end
32
- end
33
- end
34
- end
26
+ allow_any_instance_of(Hydra::Collections::SearchService).to receive(:solr_access_control_suffix).and_return("edit_group_customfield")
35
27
  @service = Hydra::Collections::SearchService.new({}, '')
36
28
  params = @service.apply_gated_search({}, {})
37
29
  @public_query = params[:fq].first.split(' OR ')[0]
@@ -4,7 +4,7 @@ describe Collection, :type => :model do
4
4
  before(:all) do
5
5
  @user = FactoryGirl.find_or_create(:user)
6
6
  class GenericFile < ActiveFedora::Base
7
- include Hydra::Works::GenericWorkBehavior
7
+ include Hydra::Works::WorkBehavior
8
8
  end
9
9
  end
10
10
  after(:all) do
@@ -144,7 +144,7 @@ describe Collection, :type => :model do
144
144
  end
145
145
 
146
146
  class Member < ActiveFedora::Base
147
- include Hydra::Works::GenericWorkBehavior
147
+ include Hydra::Works::WorkBehavior
148
148
  end
149
149
  end
150
150
  after do
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 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,2 +1 @@
1
1
  gem 'kaminari', github: 'jcoyne/kaminari', branch: 'sufia'
2
- gem 'active-fedora', github: 'projecthydra/active_fedora'
@@ -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
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'collections/show.html.erb' do
4
- let(:response) { Blacklight::SolrResponse.new(sample_response, {}) }
4
+ let(:response) { Blacklight::Solr::Response.new(sample_response, {}) }
5
5
  let(:collection) { mock_model(Collection, id: '123', title: "My Collection", description: "Just a collection") }
6
6
 
7
7
  let(:blacklight_config) { CatalogController.blacklight_config }
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: 6.0.0.rc1
4
+ version: 6.0.0.rc2
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-18 00:00:00.000000000 Z
11
+ date: 2015-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hydra-head
@@ -58,28 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.2'
61
+ version: '0.4'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.2'
68
+ version: '0.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdf
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.99'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.99'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: engine_cart
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '0.5'
89
+ version: '0.8'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '0.5'
96
+ version: '0.8'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec-rails
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -218,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
232
  version: 1.3.1
219
233
  requirements: []
220
234
  rubyforge_project:
221
- rubygems_version: 2.4.5.1
235
+ rubygems_version: 2.5.0
222
236
  signing_key:
223
237
  specification_version: 4
224
238
  summary: A rails engine for managing Hydra Collections