curation_concerns 0.14.0.pre4 → 0.14.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: 0f26ce391fb38ff166cbb42ab25a0672e00c4afb
4
- data.tar.gz: 147ccb6fca4723a76d739f63209605c6fc60dab1
3
+ metadata.gz: 7127b05e9a9109e92a2781d2e82010ebfc58bd40
4
+ data.tar.gz: b646ef71a42e4fcd0debd50953cd189cfcbcc7ee
5
5
  SHA512:
6
- metadata.gz: a6e502b77d4b2dceb8516c696bc0a79325eab35f666b642d279a329109cce3924973ccd489c214a084449130aad4f391f781c0f153f73b785c8dd94901821fb1
7
- data.tar.gz: 34ecae91255788a87ff51aff846b1ecdaba2c68eb9456bec585a08315a8a6256e9ef9aa1d1424766ec79b262f5301831bb6be222791e9d63de91511103340cfa
6
+ metadata.gz: 67ac875f8235ed5dfc2bbe3826c8fa4bd223e40d84051774f509432c65111514f4bf3eedbd9a60b87881dba9c331c0c2aeb51eb17800c8f6ed0c82cee8993541
7
+ data.tar.gz: dbc29e4c2628fec8e03c5f79adf694b115c951266bc6ed809e22c398a07b619e2f945f619dd46daffb6300e917ddc13b2e295ff3beeaaed8eedb6dfe21bd106c
data/.rubocop.yml CHANGED
@@ -9,25 +9,13 @@ AllCops:
9
9
  - 'script/**/*'
10
10
  - 'vendor/**/*'
11
11
  - '.internal_test_app/**/*'
12
- - 'app/models/concerns/curation_concerns/file_set/export.rb'
13
12
 
14
13
  Rails:
15
14
  Enabled: true
16
15
 
17
- Performance/RedundantBlockCall:
18
- # We can remove this exclusion when this commit is released:
19
- # https://github.com/bbatsov/rubocop/commit/7df382531db4f66cd9872a4f478bd486d6ce6712
20
- Exclude:
21
- - 'lib/curation_concerns/null_logger.rb'
22
-
23
16
  Performance/RedundantMerge:
24
17
  Enabled: false
25
18
 
26
- Lint/AssignmentInCondition:
27
- Exclude:
28
- - 'app/services/curation_concerns/persist_derivatives.rb'
29
- - 'app/actors/curation_concerns/file_set_actor.rb'
30
-
31
19
  Metrics/LineLength:
32
20
  Enabled: false
33
21
 
@@ -38,18 +26,11 @@ Metrics/CyclomaticComplexity:
38
26
  Exclude:
39
27
  - 'app/services/curation_concerns/file_set_audit_service.rb'
40
28
  - 'app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb'
41
- - 'app/helpers/curation_concerns/curation_concerns_helper_behavior.rb'
42
- - 'app/helpers/curation_concerns/attribute_helper.rb'
43
- - 'app/actors/curation_concerns/file_set_actor.rb'
44
- - 'app/actors/curation_concerns/work_actor_behavior.rb'
45
29
 
46
30
  Metrics/PerceivedComplexity:
47
31
  Exclude:
48
32
  - 'app/services/curation_concerns/file_set_audit_service.rb'
49
33
  - 'app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb'
50
- - 'app/helpers/curation_concerns/curation_concerns_helper_behavior.rb'
51
- - 'app/helpers/curation_concerns/attribute_helper.rb'
52
- - 'app/actors/curation_concerns/file_set_actor.rb'
53
34
 
54
35
  Metrics/MethodLength:
55
36
  Enabled: false
@@ -63,10 +44,7 @@ Metrics/ClassLength:
63
44
  Metrics/ModuleLength:
64
45
  Exclude:
65
46
  - 'app/controllers/concerns/curation_concerns/curation_concern_controller.rb'
66
- - 'app/controllers/concerns/curation_concerns/users_controller_behavior.rb'
67
- - 'app/controllers/concerns/curation_concerns/catalog_controller.rb'
68
47
  - 'app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb'
69
- - 'app/helpers/curation_concerns/curation_concerns_helper_behavior.rb'
70
48
  - 'app/models/concerns/curation_concerns/solr_document_behavior.rb'
71
49
  - 'app/controllers/concerns/curation_concerns/collections_controller_behavior.rb'
72
50
 
@@ -129,9 +107,6 @@ Style/HashSyntax:
129
107
 
130
108
  Style/PredicateName:
131
109
  Exclude:
132
- - 'app/helpers/curation_concerns/curation_concerns_helper_behavior.rb'
133
- - 'app/controllers/concerns/curation_concerns/controller.rb'
134
- - 'app/helpers/curation_concerns/collections_helper.rb'
135
110
  - 'app/helpers/curation_concerns/collections_helper_behavior.rb'
136
111
 
137
112
  Style/GlobalVars:
data/README.md CHANGED
@@ -25,8 +25,6 @@ Curation Concerns requires the following software to work:
25
25
 
26
26
  ## Installation
27
27
 
28
- Checkout the dependencies for [curation_concerns-models](https://github.com/projecthydra-labs/curation_concerns/tree/master/curation_concerns-models#dependencies), which is installed as part of curation_concerns.
29
-
30
28
  Add this line to your application's Gemfile:
31
29
 
32
30
  gem 'curation_concerns'
@@ -40,10 +38,10 @@ Then run the install generator. You will be prompted if you want to overwrite t
40
38
  $ rails generate curation_concerns:install
41
39
  $ rake db:migrate
42
40
 
43
- ### FITS 0.6.2
41
+ ### FITS 0.8.5
44
42
 
45
43
  To install FITS:
46
- * Go to http://projects.iq.harvard.edu/fits/downloads, download __fits-0.6.2.zip__, and unpack it somewhere on your machine. You can also install FITS on OSX with homebrew: `brew install fits` (you may also have to create a symlink from fits.sh -> fits in the next step).
44
+ * Go to http://projects.iq.harvard.edu/fits/downloads, download __fits-0.8.5.zip__, and unpack it somewhere on your machine. You can also install FITS on OSX with homebrew: `brew install fits` (you may also have to create a symlink from fits.sh -> fits in the next step).
47
45
  * Mark fits.sh as executable (chmod a+x fits.sh)
48
46
  * Run "fits.sh -h" from the command line and see a help message to ensure FITS is properly installed
49
47
  * Give your app access to FITS by:
@@ -50,7 +50,7 @@ module CurationConcerns
50
50
  end
51
51
 
52
52
  def apply_save_data_to_curation_concern(attributes)
53
- attributes[:rights] = Array(attributes[:rights]) if attributes.key? :rights
53
+ attributes[:rights] = Array.wrap(attributes[:rights]) if attributes.key? :rights
54
54
  remove_blank_attributes!(attributes)
55
55
  curation_concern.attributes = attributes.symbolize_keys
56
56
  curation_concern.date_modified = CurationConcerns::TimeService.time_in_utc
@@ -56,7 +56,7 @@ module CurationConcerns
56
56
  # Overriden to cast 'rights' to an array
57
57
  def sanitize_params(form_params)
58
58
  super.tap do |params|
59
- params['rights'] = Array(params['rights']) if params.key?('rights')
59
+ params['rights'] = Array.wrap(params['rights']) if params.key?('rights')
60
60
  end
61
61
  end
62
62
  end
@@ -3,11 +3,10 @@ module CurationConcerns
3
3
  module Indexing
4
4
  extend ActiveSupport::Concern
5
5
 
6
- module ClassMethods
7
- # override the default indexing service
8
- def indexer
9
- CurationConcerns::FileSetIndexer
10
- end
6
+ included do
7
+ class_attribute :indexer
8
+ # the default indexing service
9
+ self.indexer = CurationConcerns::FileSetIndexer
11
10
  end
12
11
  end
13
12
  end
@@ -2,9 +2,9 @@ module CurationConcerns
2
2
  module Serializers
3
3
  def to_s
4
4
  if title.present?
5
- Array(title).join(' | ')
5
+ Array.wrap(title).join(' | ')
6
6
  elsif label.present?
7
- Array(label).join(' | ')
7
+ Array.wrap(label).join(' | ')
8
8
  else
9
9
  'No Title'
10
10
  end
@@ -37,7 +37,7 @@ module CurationConcerns
37
37
  end
38
38
 
39
39
  def human_readable_type
40
- Array(self[Solrizer.solr_name('human_readable_type', :stored_searchable)]).first
40
+ Array.wrap(self[Solrizer.solr_name('human_readable_type', :stored_searchable)]).first
41
41
  end
42
42
 
43
43
  def representative_id
@@ -58,24 +58,24 @@ module CurationConcerns
58
58
  end
59
59
 
60
60
  def depositor(default = '')
61
- val = Array(self[Solrizer.solr_name('depositor')]).first
61
+ val = Array.wrap(self[Solrizer.solr_name('depositor')]).first
62
62
  val.present? ? val : default
63
63
  end
64
64
 
65
65
  def title
66
- Array(self[Solrizer.solr_name('title')]).first
66
+ Array.wrap(self[Solrizer.solr_name('title')]).first
67
67
  end
68
68
 
69
69
  def description
70
- Array(self[Solrizer.solr_name('description')]).first
70
+ Array.wrap(self[Solrizer.solr_name('description')]).first
71
71
  end
72
72
 
73
73
  def label
74
- Array(self[Solrizer.solr_name('label')]).first
74
+ Array.wrap(self[Solrizer.solr_name('label')]).first
75
75
  end
76
76
 
77
77
  def file_format
78
- Array(self[Solrizer.solr_name('file_format')]).first
78
+ Array.wrap(self[Solrizer.solr_name('file_format')]).first
79
79
  end
80
80
 
81
81
  def creator
@@ -17,14 +17,11 @@ module CurationConcerns::WorkBehavior
17
17
 
18
18
  included do
19
19
  property :owner, predicate: RDF::URI.new('http://opaquenamespace.org/ns/hydra/owner'), multiple: false
20
- class_attribute :human_readable_short_description
20
+ class_attribute :human_readable_short_description, :indexer
21
+ self.indexer = CurationConcerns::WorkIndexer
21
22
  end
22
23
 
23
24
  module ClassMethods
24
- def indexer
25
- CurationConcerns::WorkIndexer
26
- end
27
-
28
25
  # This governs which partial to draw when you render this type of object
29
26
  def _to_partial_path #:nodoc:
30
27
  @_to_partial_path ||= begin
@@ -37,7 +34,7 @@ module CurationConcerns::WorkBehavior
37
34
 
38
35
  def to_s
39
36
  if title.present?
40
- Array(title).join(' | ')
37
+ Array.wrap(title).join(' | ')
41
38
  else
42
39
  'No Title'
43
40
  end
@@ -25,11 +25,11 @@ module CurationConcerns
25
25
  :depositor, :tags, :title_or_label, to: :solr_document
26
26
 
27
27
  def page_title
28
- Array(solr_document['label_tesim']).first
28
+ Array.wrap(solr_document['label_tesim']).first
29
29
  end
30
30
 
31
31
  def link_name
32
- current_ability.can?(:read, id) ? Array(solr_document['label_tesim']).first : 'File'
32
+ current_ability.can?(:read, id) ? Array.wrap(solr_document['label_tesim']).first : 'File'
33
33
  end
34
34
  end
35
35
  end
@@ -25,7 +25,7 @@ module CurationConcerns
25
25
  return markup if !values.present? && !options[:include_empty]
26
26
  markup << %(<tr><th>#{label}</th>\n<td><ul class='tabular'>)
27
27
  attributes = microdata_object_attributes(field).merge(class: "attribute #{field}")
28
- Array(values).each do |value|
28
+ Array.wrap(values).each do |value|
29
29
  markup << "<li#{html_attributes(attributes)}>#{attribute_value_to_html(value.to_s)}</li>"
30
30
  end
31
31
  markup << %(</ul></td></tr>)
@@ -22,14 +22,14 @@ module CurationConcerns
22
22
  end
23
23
 
24
24
  def work_clauses
25
- return [] if blacklight_params.key?(:f) && Array(blacklight_params[:f][:generic_type_sim]).include?('Collection')
25
+ return [] if blacklight_params.key?(:f) && Array.wrap(blacklight_params[:f][:generic_type_sim]).include?('Collection')
26
26
  work_types.map do |klass|
27
27
  ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: klass.to_class_uri)
28
28
  end
29
29
  end
30
30
 
31
31
  def collection_clauses
32
- return [] if blacklight_params.key?(:f) && Array(blacklight_params[:f][:generic_type_sim]).include?('Work')
32
+ return [] if blacklight_params.key?(:f) && Array.wrap(blacklight_params[:f][:generic_type_sim]).include?('Work')
33
33
  [ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: ::Collection.to_class_uri)]
34
34
  end
35
35
  end
@@ -3,12 +3,14 @@ module RightsService
3
3
  self.authority = Qa::Authorities::Local.subauthority_for('rights')
4
4
 
5
5
  def self.select_options
6
- authority.all.map do |element|
7
- [element[:label], element[:id]]
8
- end
6
+ active_elements.map { |e| [e[:label], e[:id]] }
9
7
  end
10
8
 
11
9
  def self.label(id)
12
10
  authority.find(id).fetch('term')
13
11
  end
12
+
13
+ def self.active_elements
14
+ authority.all.select { |e| authority.find(e[:id])[:active] }
15
+ end
14
16
  end
@@ -142,7 +142,7 @@ module CurationConcerns
142
142
  # Registers the given curation concern model in the configuration
143
143
  # @param [Array<Symbol>,Symbol] curation_concern_types
144
144
  def register_curation_concern(*curation_concern_types)
145
- Array(curation_concern_types).flatten.compact.each do |cc_type|
145
+ Array.wrap(curation_concern_types).flatten.compact.each do |cc_type|
146
146
  unless @registered_concerns.include?(cc_type)
147
147
  @registered_concerns << cc_type
148
148
  end
@@ -1,3 +1,3 @@
1
1
  module CurationConcerns
2
- VERSION = "0.14.0.pre4".freeze
2
+ VERSION = "0.14.0".freeze
3
3
  end
@@ -1,19 +1,28 @@
1
1
  terms:
2
2
  - id: http://creativecommons.org/licenses/by/3.0/us/
3
3
  term: Attribution 3.0 United States
4
+ active: true
4
5
  - id: http://creativecommons.org/licenses/by-sa/3.0/us/
5
6
  term: Attribution-ShareAlike 3.0 United States
7
+ active: true
6
8
  - id: http://creativecommons.org/licenses/by-nc/3.0/us/
7
9
  term: Attribution-NonCommercial 3.0 United States
10
+ active: true
8
11
  - id: http://creativecommons.org/licenses/by-nd/3.0/us/
9
12
  term: Attribution-NoDerivs 3.0 United States
13
+ active: true
10
14
  - id: http://creativecommons.org/licenses/by-nc-nd/3.0/us/
11
15
  term: Attribution-NonCommercial-NoDerivs 3.0 United States
16
+ active: true
12
17
  - id: http://creativecommons.org/licenses/by-nc-sa/3.0/us/
13
18
  term: Attribution-NonCommercial-ShareAlike 3.0 United States
19
+ active: true
14
20
  - id: http://creativecommons.org/publicdomain/mark/1.0/
15
21
  term: Public Domain Mark 1.0
22
+ active: true
16
23
  - id: http://creativecommons.org/publicdomain/zero/1.0/
17
24
  term: CC0 1.0 Universal
25
+ active: true
18
26
  - id: http://www.europeana.eu/portal/rights/rr-r.html
19
27
  term: All rights reserved
28
+ active: true
@@ -12,7 +12,7 @@ describe CurationConcerns::WorkBehavior do
12
12
 
13
13
  subject { EssentialWork.new }
14
14
 
15
- it 'mixs together all the goodness' do
15
+ it 'mixes together all the goodness' do
16
16
  [::CurationConcerns::WithFileSets, ::CurationConcerns::HumanReadableType, CurationConcerns::Noid, CurationConcerns::Serializers, Hydra::WithDepositor, Hydra::AccessControls::Embargoable, Solrizer::Common].each do |mixin|
17
17
  expect(subject.class.ancestors).to include(mixin)
18
18
  end
@@ -38,4 +38,12 @@ describe CurationConcerns::WorkBehavior do
38
38
  expect(subject.to_solr.keys).to include(:id)
39
39
  expect(subject.to_solr.keys).to include('has_model_ssim')
40
40
  end
41
+
42
+ describe 'indexer' do
43
+ let(:klass) { Class.new }
44
+ it 'is settable' do
45
+ EssentialWork.indexer = klass
46
+ expect(subject.indexer).to eq klass
47
+ end
48
+ end
41
49
  end
@@ -27,7 +27,7 @@ describe FileSet do
27
27
  context 'when it is initialized' do
28
28
  it 'has empty arrays for all the properties' do
29
29
  subject.attributes.each do |_k, v|
30
- expect(Array(v)).to eq([])
30
+ expect(Array.wrap(v)).to eq([])
31
31
  end
32
32
  end
33
33
  end
@@ -148,6 +148,23 @@ describe FileSet do
148
148
  describe '#indexer' do
149
149
  subject { described_class.indexer }
150
150
  it { is_expected.to eq CurationConcerns::FileSetIndexer }
151
+
152
+ describe "setting" do
153
+ before do
154
+ class AltFile < ActiveFedora::Base
155
+ include CurationConcerns::FileSetBehavior
156
+ end
157
+ end
158
+ after do
159
+ Object.send(:remove_const, :AltFile)
160
+ end
161
+ let(:klass) { Class.new }
162
+ subject { AltFile.new }
163
+ it 'is settable' do
164
+ AltFile.indexer = klass
165
+ expect(subject.indexer).to eq klass
166
+ end
167
+ end
151
168
  end
152
169
 
153
170
  it 'supports multi-valued fields in solr' do
@@ -1,17 +1,29 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe RightsService do
4
- describe "select_options" do
5
- subject { described_class.select_options }
4
+ before do
5
+ # Configure QA to use fixtures
6
+ qa_fixtures = { local_path: File.expand_path('../../fixtures/authorities', __FILE__) }
7
+ stub_const("Qa::Authorities::LocalSubauthority::AUTHORITIES_CONFIG", qa_fixtures)
8
+ end
9
+
10
+ describe "#select_options" do
11
+ it "returns active terms" do
12
+ expect(described_class.select_options).to include(["First Active Term", "demo_id_01"], ["Second Active Term", "demo_id_02"])
13
+ end
6
14
 
7
- it "has a select list" do
8
- expect(subject.first).to eq ["Attribution 3.0 United States", "http://creativecommons.org/licenses/by/3.0/us/"]
15
+ it "does not return inactive terms" do
16
+ expect(described_class.select_options).not_to include(["Third is an Inactive Term", "demo_id_03"], ["Fourth is an Inactive Term", "demo_id_04"])
9
17
  end
10
18
  end
11
19
 
12
- describe "label" do
13
- subject { described_class.label("http://www.europeana.eu/portal/rights/rr-r.html") }
20
+ describe "#label" do
21
+ it "resolves for ids of active terms" do
22
+ expect(described_class.label('demo_id_01')).to eq("First Active Term")
23
+ end
14
24
 
15
- it { is_expected.to eq 'All rights reserved' }
25
+ it "resolves for ids of inactive terms" do
26
+ expect(described_class.label('demo_id_03')).to eq("Third is an Inactive Term")
27
+ end
16
28
  end
17
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curation_concerns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0.pre4
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-05-02 00:00:00.000000000 Z
13
+ date: 2016-05-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hydra-head
@@ -1211,9 +1211,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1211
1211
  version: '0'
1212
1212
  required_rubygems_version: !ruby/object:Gem::Requirement
1213
1213
  requirements:
1214
- - - ">"
1214
+ - - ">="
1215
1215
  - !ruby/object:Gem::Version
1216
- version: 1.3.1
1216
+ version: '0'
1217
1217
  requirements: []
1218
1218
  rubyforge_project:
1219
1219
  rubygems_version: 2.5.1