ddr-models 2.3.2 → 2.4.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -3
  3. data/ddr-models.gemspec +1 -1
  4. data/lib/ddr/auth.rb +10 -6
  5. data/lib/ddr/auth/group.rb +2 -1
  6. data/lib/ddr/auth/grouper_gateway.rb +7 -6
  7. data/lib/ddr/auth/permissions.rb +2 -1
  8. data/lib/ddr/auth/roles.rb +3 -2
  9. data/lib/ddr/auth/roles/role_set.rb +3 -2
  10. data/lib/ddr/datastreams/administrative_metadata_datastream.rb +3 -0
  11. data/lib/ddr/derivatives/png_generator.rb +1 -1
  12. data/lib/ddr/index/fields.rb +11 -1
  13. data/lib/ddr/index/filter.rb +4 -3
  14. data/lib/ddr/index/legacy_license_fields.rb +0 -2
  15. data/lib/ddr/index/query_clause.rb +2 -2
  16. data/lib/ddr/index/query_value.rb +6 -3
  17. data/lib/ddr/jobs.rb +5 -1
  18. data/lib/ddr/jobs/fits_file_characterization.rb +2 -40
  19. data/lib/ddr/jobs/fixity_check.rb +13 -0
  20. data/lib/ddr/jobs/job.rb +36 -0
  21. data/lib/ddr/jobs/queue.rb +27 -0
  22. data/lib/ddr/jobs/update_index.rb +13 -0
  23. data/lib/ddr/managers/derivatives_manager.rb +21 -17
  24. data/lib/ddr/models.rb +14 -2
  25. data/lib/ddr/models/access_controllable.rb +3 -6
  26. data/lib/ddr/models/admin_set.rb +5 -3
  27. data/lib/ddr/models/base.rb +2 -3
  28. data/lib/ddr/models/contact.rb +17 -0
  29. data/lib/ddr/models/file_characterization.rb +37 -0
  30. data/lib/ddr/models/has_admin_metadata.rb +2 -1
  31. data/lib/ddr/models/has_content.rb +4 -2
  32. data/lib/ddr/models/indexing.rb +5 -0
  33. data/lib/ddr/models/licenses/license.rb +5 -3
  34. data/lib/ddr/models/solr_document.rb +1 -1
  35. data/lib/ddr/models/version.rb +1 -1
  36. data/lib/ddr/models/with_content_file.rb +37 -0
  37. data/lib/ddr/vocab/asset.rb +3 -0
  38. data/spec/derivatives/png_generator_spec.rb +7 -0
  39. data/spec/factories/test_model_factories.rb +1 -1
  40. data/spec/fixtures/arrow1rightred_e0.gif +0 -0
  41. data/spec/fixtures/bird.jpg +0 -0
  42. data/spec/index/query_value_spec.rb +33 -0
  43. data/spec/jobs/fits_file_characterization_spec.rb +8 -44
  44. data/spec/jobs/fixity_check_spec.rb +22 -0
  45. data/spec/jobs/job_spec.rb +40 -0
  46. data/spec/jobs/update_index_spec.rb +22 -0
  47. data/spec/managers/derivatives_manager_spec.rb +16 -12
  48. data/spec/models/admin_set_spec.rb +3 -3
  49. data/spec/models/contact_spec.rb +22 -0
  50. data/spec/models/effective_license_spec.rb +17 -7
  51. data/spec/models/file_characterization_spec.rb +39 -0
  52. data/spec/models/has_admin_metadata_spec.rb +8 -5
  53. data/spec/models/indexing_spec.rb +2 -0
  54. data/spec/models/license_spec.rb +3 -1
  55. data/spec/models/solr_document_spec.rb +6 -3
  56. data/spec/models/with_content_file_spec.rb +37 -0
  57. data/spec/spec_helper.rb +2 -0
  58. metadata +43 -30
  59. data/lib/ddr/contacts.rb +0 -25
  60. data/lib/ddr/index_fields.rb +0 -14
  61. data/spec/auth/ldap_gateway_spec.rb +0 -9
  62. data/spec/contacts/contacts_spec.rb +0 -26
@@ -1,25 +0,0 @@
1
- module Ddr
2
- module Contacts
3
- extend ActiveSupport::Autoload
4
-
5
- class << self
6
- attr_accessor :contacts
7
- end
8
-
9
- def self.get(contact_slug)
10
- load_contacts unless contacts
11
- contacts[contact_slug]
12
- end
13
-
14
- def self.load_contacts
15
- self.contacts = OpenStruct.new
16
- contacts_file = File.join(Rails.root, 'config', 'contacts.yml')
17
- YAML.load_file(contacts_file).each do |key, value|
18
- contacts[key] = OpenStruct.new(value.merge('slug' => key))
19
- end
20
- rescue SystemCallError
21
- Rails.logger.warn("Unable to load Contacts file: #{contacts_file}")
22
- end
23
-
24
- end
25
- end
@@ -1,14 +0,0 @@
1
- module Ddr
2
- module IndexFields
3
-
4
- warn "[DEPRECATION] `Ddr::IndexFields` is deprecated and will be removed in ddr-models 3.0." \
5
- " Use `Ddr::Index::Fields` instead."
6
-
7
- include Ddr::Index::Fields
8
-
9
- def self.get(name)
10
- Ddr::Index::Fields.get(name)
11
- end
12
-
13
- end
14
- end
@@ -1,9 +0,0 @@
1
- require "net/ldap"
2
-
3
- module Ddr::Auth
4
- RSpec.describe LdapGateway do
5
-
6
- # write some tests or delete this module
7
-
8
- end
9
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Ddr
4
- RSpec.describe Contacts, contacts: true do
5
-
6
- before do
7
- allow(YAML).to receive(:load_file) { { 'a' => { 'name' => 'Contact A', 'short_name' => 'A' },
8
- 'b' => { 'name' => 'Contact B', 'short_name' => 'B' } } }
9
- Contacts.load_contacts
10
- end
11
-
12
- describe "load_contacts" do
13
- it "should load the contacts" do
14
- expect(Contacts.contacts.to_h).to_not be_empty
15
- end
16
- end
17
-
18
- describe "get" do
19
- it "should return the appropriate contact" do
20
- expect(Contacts.get('a').name).to eq('Contact A')
21
- expect(Contacts.get('b').name).to eq('Contact B')
22
- end
23
- end
24
-
25
- end
26
- end