valkyrie 3.0.0.pre.beta.1 → 3.0.0.pre.beta.2

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
  SHA256:
3
- metadata.gz: 240eb74a4be15202ae2036ac9a0067b1aadc23e65ad583638b6cd2874540a845
4
- data.tar.gz: 65568d10c48dcadbee70bff7c23360a6e0b149f874b5ebe493b5770afb6e4362
3
+ metadata.gz: 92a63ed951bdc096d910ffcc3b357f5723607c7014dabe1e7e9e1fd83e33c6aa
4
+ data.tar.gz: 065703d34ed3cc701d72f83fe23a73f56ae504e1f4448db9b35c62c831246049
5
5
  SHA512:
6
- metadata.gz: 29b4ebfb067823191dfb2ca74151765ad8157f2c4b7b89cbecaf882e8e6f32eded31fdfb326ca198192e50574a562f8582205bab921d248707f2993b31960528
7
- data.tar.gz: 1fc174038d3baac66d35e431211ed83e38d2531395f86ecfeee106a612631d42a1f2fa11fe55a561617d3a23561763707100c701a73a06147db11bb073a60636
6
+ metadata.gz: 673a3dd11538cccf8c99de59d303a58ae225bfd672dec42e19c1eb436e5a1112924b49319b72127d1f6cc8c0c555ebb748b2029f3cafb9f81dd5925ac6a3f6b8
7
+ data.tar.gz: 0b3ecfd44279c35865cd42e50ff7d40cc8d983f87cffccc09573f7c8ded1148e19e3855089bb9bdea72708efa528bb91bdd0f877f4c3b9abd33a7dc52f6c8251
data/.circleci/config.yml CHANGED
@@ -98,6 +98,18 @@ workflows:
98
98
  gemfile: "gemfiles/activerecord_6_0.gemfile"
99
99
  ruby: 2.7.0
100
100
  name: "Ruby2-7_Rails6-0"
101
+ - build:
102
+ gemfile: "gemfiles/activerecord_7_0.gemfile"
103
+ ruby: 2.7.5
104
+ name: "Ruby2-7_rails7-0"
105
+ - build:
106
+ gemfile: "gemfiles/faraday_1.gemfile"
107
+ ruby: 2.7.0
108
+ name: "Faraday1"
109
+ - build:
110
+ gemfile: "gemfiles/faraday_0.gemfile"
111
+ ruby: 2.7.0
112
+ name: "Faraday0"
101
113
  - build:
102
114
  gemfile: "gemfiles/activerecord_6_0.gemfile"
103
115
  ruby: 2.6.5
@@ -127,6 +139,14 @@ workflows:
127
139
  gemfile: "gemfiles/activerecord_6_0.gemfile"
128
140
  ruby: 2.7.0
129
141
  name: "Ruby2-7_Rails6-0"
142
+ - build:
143
+ gemfile: "gemfiles/faraday_1.gemfile"
144
+ ruby: 2.7.0
145
+ name: "Faraday1"
146
+ - build:
147
+ gemfile: "gemfiles/faraday_0.gemfile"
148
+ ruby: 2.7.0
149
+ name: "Faraday0"
130
150
  - build:
131
151
  gemfile: "gemfiles/activerecord_6_0.gemfile"
132
152
  ruby: 2.6.5
data/.rubocop.yml CHANGED
@@ -46,3 +46,6 @@ Metrics/MethodLength:
46
46
  Metrics/CyclomaticComplexity:
47
47
  Exclude:
48
48
  - 'lib/valkyrie/persistence/postgres/persister.rb'
49
+ RSpec/VerifiedDoubles:
50
+ Exclude:
51
+ - 'spec/valkyrie/persistence/postgres/metadata_adapter_spec.rb'
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.6.6
1
+ ruby 2.7.5
data/Appraisals CHANGED
@@ -1,4 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
3
+ appraise "activerecord-7-0" do
4
+ gem "activerecord", "~> 7.0.0"
5
+ end
6
+
2
7
  appraise "activerecord-6-0" do
3
8
  gem "activerecord", "~> 6.0.0"
4
9
  end
@@ -6,3 +11,13 @@ end
6
11
  appraise "activerecord-5-2" do
7
12
  gem "activerecord", "~> 5.2.0"
8
13
  end
14
+
15
+ appraise "faraday-0" do
16
+ gem "faraday", "< 1"
17
+ gem "activerecord", "~> 6.0.0"
18
+ end
19
+
20
+ appraise "faraday-1" do
21
+ gem "faraday", "~> 1.0"
22
+ gem "activerecord", "~> 6.0.0"
23
+ end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # v3.0.0.beta2 2022-06-15
2
+
3
+ ## Changes since last release
4
+
5
+ * Update pcdm_use warning
6
+ [dchandekstark](https://github.com/dchandekstark)
7
+ * Add support for Faraday 2
8
+ [tpendragon](https://github.com/tpendragon)
9
+ * Rails 7 Support
10
+ [cgalarza](https://github.com/cgalarza)
11
+ [tpendragon](https://github.com/tpendragon)
12
+ * Support discovery of multiple disk adapters on different paths.
13
+ [no-reply](https://github.com/tpendragon)
14
+ * New Product Owner: Alexandra Dunn!
15
+ [dunn](https://github.com/dunn)
16
+
17
+ Additional thanks to the following for code review and issue reports leading to
18
+ this release:
19
+
20
+ [cjcolvar](https://github.com/cjcolvar)
21
+
1
22
  # v3.0.0.beta1 2021-10-18
2
23
 
3
24
  ## Changes since last release
data/README.md CHANGED
@@ -17,7 +17,7 @@ Jump in: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samv
17
17
  ## Primary Contacts
18
18
 
19
19
  ### Product Owner
20
- [Kate Lynch](https://github.com/kelynch)
20
+ [Alexandra Dunn](https://github.com/dunn)
21
21
 
22
22
  ### Technical Lead
23
23
  [Trey Pendragon](https://github.com/tpendragon)
@@ -180,21 +180,6 @@ attribute :authors, Valkyrie::Types::Array.meta(ordered: true)
180
180
  Defining resource attributes is explained in greater detail on the [Using Types Wiki
181
181
  page](https://github.com/samvera/valkyrie/wiki/Using-Types).
182
182
 
183
- #### Work Types Generator
184
-
185
- To create a custom Valkyrie model in your application, you can use the Rails generator. For example, to
186
- generate a model named `FooBar` with an unordered `title` field and an ordered `member_ids` field:
187
-
188
- ```
189
- rails generate valkyrie:resource FooBar title member_ids:array
190
- ```
191
-
192
- You can namespace your model class by including a slash in the model name:
193
-
194
- ```
195
- rails generate valkyrie:resource Foo/Bar title member_ids:array
196
- ```
197
-
198
183
  ### Read and Write Data
199
184
  ```
200
185
  # initialize a metadata adapter
data/Rakefile CHANGED
@@ -2,7 +2,7 @@
2
2
  require "bundler/gem_tasks"
3
3
  require "rspec/core/rake_task"
4
4
  require 'yaml'
5
- require 'config/database_connection'
5
+ require_relative 'spec/support/database_connection.rb'
6
6
  require 'active_record'
7
7
  require 'rubocop/rake_task'
8
8
  load 'tasks/dev.rake'
data/db/config.yml CHANGED
@@ -5,7 +5,7 @@ default: &default
5
5
  pool: <%= Integer(ENV.fetch("DB_POOL", 5)) %>
6
6
  reaping_frequency: <%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
7
7
  timeout: 5000
8
- host: localhost
8
+ host: 127.0.0.1
9
9
  username: postgres
10
10
  password:
11
11
 
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
-
3
2
  # This file was generated by Appraisal
4
3
 
5
4
  source "https://rubygems.org"
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
-
3
2
  # This file was generated by Appraisal
4
3
 
5
4
  source "https://rubygems.org"
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+ # This file was generated by Appraisal
3
+
4
+ source "https://rubygems.org"
5
+
6
+ gem "activerecord", "~> 7.0.0"
7
+ gem "ldp"
8
+ gem "pg"
9
+ gem "rsolr"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ # This file was generated by Appraisal
3
+
4
+ source "https://rubygems.org"
5
+
6
+ gem "activerecord", "~> 6.0.0"
7
+ gem "ldp"
8
+ gem "pg"
9
+ gem "rsolr"
10
+ gem "faraday", "< 1"
11
+
12
+ gemspec path: "../"
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+ # This file was generated by Appraisal
3
+
4
+ source "https://rubygems.org"
5
+
6
+ gem "activerecord", "~> 6.0.0"
7
+ gem "ldp"
8
+ gem "pg"
9
+ gem "rsolr"
10
+ gem "faraday", "~> 1.0"
11
+
12
+ gemspec path: "../"
@@ -33,12 +33,10 @@ module Valkyrie::Persistence::Fedora
33
33
  # empty, tail.prev is the first element.
34
34
  def tail
35
35
  @tail ||=
36
- begin
37
- if tail_subject
38
- TailSentinel.new(self, prev_node: build_node(tail_subject))
39
- else
40
- head.next
41
- end
36
+ if tail_subject
37
+ TailSentinel.new(self, prev_node: build_node(tail_subject))
38
+ else
39
+ head.next
42
40
  end
43
41
  end
44
42
 
@@ -31,9 +31,19 @@ module Valkyrie::Persistence::Postgres
31
31
  # @return [Valkyrie::ID]
32
32
  def id
33
33
  @id ||= begin
34
- to_hash = "#{resource_factory.orm_class.connection_config['host']}:#{resource_factory.orm_class.connection_config['database']}"
34
+ to_hash = "#{connection_configuration[:host]}:#{connection_configuration[:database]}"
35
35
  Valkyrie::ID.new(Digest::MD5.hexdigest(to_hash))
36
36
  end
37
37
  end
38
+
39
+ private
40
+
41
+ def connection_configuration
42
+ if resource_factory.orm_class.respond_to?(:connection_db_config)
43
+ resource_factory.orm_class.connection_db_config.configuration_hash
44
+ else
45
+ resource_factory.orm_class.connection_config
46
+ end
47
+ end
38
48
  end
39
49
  end
@@ -37,8 +37,10 @@ module Valkyrie
37
37
  autoload :Fedora, 'valkyrie/persistence/fedora'
38
38
  class ObjectNotFoundError < StandardError
39
39
  end
40
+
40
41
  class UnsupportedDatatype < StandardError
41
42
  end
43
+
42
44
  class StaleObjectError < StandardError
43
45
  end
44
46
 
@@ -9,6 +9,7 @@ module RDF
9
9
  ::JSON::LD::API.fromRdf([RDF::Statement.new(RDF::URI(""), RDF::URI(""), self)])[0][""][0]
10
10
  end
11
11
  end
12
+
12
13
  class URI
13
14
  def as_json(*_args)
14
15
  ::JSON::LD::API.fromRdf([RDF::Statement.new(RDF::URI(""), RDF::URI(""), self)])[0][""][0]
@@ -8,6 +8,7 @@ RSpec.shared_examples 'a Valkyrie::ChangeSetPersister' do |*_flags|
8
8
  attribute :member_ids
9
9
  attribute :nested_resource
10
10
  end
11
+
11
12
  class Valkyrie::Specs::CustomChangeSet < Valkyrie::ChangeSet
12
13
  self.fields = [:title]
13
14
  end
@@ -340,7 +340,7 @@ RSpec.shared_examples 'a Valkyrie::Persister' do |*flags|
340
340
  end
341
341
 
342
342
  after do
343
- ActiveSupport::Dependencies.remove_constant("MyLockingResource")
343
+ Object.send(:remove_const, :MyLockingResource)
344
344
  end
345
345
 
346
346
  describe "#save" do
@@ -10,8 +10,10 @@ RSpec.shared_examples 'a Valkyrie query provider' do
10
10
  attribute :a_member_of, Valkyrie::Types::Array
11
11
  attribute :an_ordered_member_of, Valkyrie::Types::Array.meta(ordered: true)
12
12
  end
13
+
13
14
  class Valkyrie::Specs::SecondResource < Valkyrie::Resource
14
15
  end
16
+
15
17
  class Valkyrie::Specs::ThirdResource < Valkyrie::Resource
16
18
  attribute :a_member_of, Valkyrie::Types::Array
17
19
  attribute :an_ordered_member_of, Valkyrie::Types::Array.meta(ordered: true)
@@ -353,9 +355,11 @@ RSpec.shared_examples 'a Valkyrie query provider' do
353
355
  context "when the property is ordered for one child but not the other" do
354
356
  before do
355
357
  class Valkyrie::Specs::Parent < Valkyrie::Resource; end
358
+
356
359
  class Valkyrie::Specs::ChildWithUnorderedParents < Valkyrie::Resource
357
360
  attribute :a_member_of, Valkyrie::Types::Array
358
361
  end
362
+
359
363
  class Valkyrie::Specs::ChildWithOrderedParents < Valkyrie::Resource
360
364
  attribute :a_member_of, Valkyrie::Types::Array.meta(ordered: true)
361
365
  end
@@ -24,7 +24,7 @@ module Valkyrie::Storage
24
24
  # @param id [Valkyrie::ID]
25
25
  # @return [Boolean] true if this adapter can handle this type of identifer
26
26
  def handles?(id:)
27
- id.to_s.start_with?("disk://")
27
+ id.to_s.start_with?("disk://#{base_path}")
28
28
  end
29
29
 
30
30
  def file_path(id)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Valkyrie
3
- VERSION = "3.0.0-beta.1"
3
+ VERSION = "3.0.0-beta.2"
4
4
  end
@@ -47,7 +47,8 @@ module Valkyrie::Vocab
47
47
  "rdf:subClassOf": %(http://pcdm.org/resources#File),
48
48
  "rdfs:isDefinedBy": %(pcdmuse:),
49
49
  type: "rdfs:Class"
50
- warn "[DEPRECATION] PCDM is deprecating '#{self.class}#PreservationMasterFile'. Use #{self.class}#PreservationFile instead."
50
+ warn "[DEPRECATION] PCDM is deprecating '#{name}#PreservationMasterFile'. Use '#{name}#PreservationFile' instead. " \
51
+ "This warning does *not* indicate that usage of the deprecated term has been detected."
51
52
  # @deprecated
52
53
  term :PreservationMasterFile,
53
54
  comment: %(Best quality representation of the Object appropriate for long-term
data/lib/valkyrie.rb CHANGED
@@ -27,7 +27,6 @@ module Valkyrie
27
27
  require 'valkyrie/indexers/access_controls_indexer'
28
28
  require 'valkyrie/storage'
29
29
  require 'valkyrie/vocab/pcdm_use'
30
- require 'generators/valkyrie/resource_generator'
31
30
  require 'valkyrie/engine' if defined?(Rails)
32
31
  def config
33
32
  @config ||= Config.new(
data/valkyrie.gemspec CHANGED
@@ -31,7 +31,8 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency 'json-ld'
32
32
  spec.add_dependency 'json'
33
33
  spec.add_dependency 'rdf-vocab'
34
- spec.add_dependency 'faraday', '< 1.0'
34
+ spec.add_dependency 'faraday', '>= 0.9', '!= 2.0.0', '< 3'
35
+ spec.add_dependency 'faraday-multipart'
35
36
 
36
37
  spec.add_development_dependency "bundler", "> 1.16.0", "< 3"
37
38
  spec.add_development_dependency "rake", ">= 10"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valkyrie
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre.beta.1
4
+ version: 3.0.0.pre.beta.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trey Pendragon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-26 00:00:00.000000000 Z
11
+ date: 2022-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -174,16 +174,42 @@ dependencies:
174
174
  name: faraday
175
175
  requirement: !ruby/object:Gem::Requirement
176
176
  requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0.9'
180
+ - - "!="
181
+ - !ruby/object:Gem::Version
182
+ version: 2.0.0
177
183
  - - "<"
178
184
  - !ruby/object:Gem::Version
179
- version: '1.0'
185
+ version: '3'
180
186
  type: :runtime
181
187
  prerelease: false
182
188
  version_requirements: !ruby/object:Gem::Requirement
183
189
  requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0.9'
193
+ - - "!="
194
+ - !ruby/object:Gem::Version
195
+ version: 2.0.0
184
196
  - - "<"
185
197
  - !ruby/object:Gem::Version
186
- version: '1.0'
198
+ version: '3'
199
+ - !ruby/object:Gem::Dependency
200
+ name: faraday-multipart
201
+ requirement: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ type: :runtime
207
+ prerelease: false
208
+ version_requirements: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ version: '0'
187
213
  - !ruby/object:Gem::Dependency
188
214
  name: bundler
189
215
  requirement: !ruby/object:Gem::Requirement
@@ -428,10 +454,9 @@ files:
428
454
  - db/schema.rb
429
455
  - gemfiles/activerecord_5_2.gemfile
430
456
  - gemfiles/activerecord_6_0.gemfile
431
- - lib/config/database_connection.rb
432
- - lib/generators/valkyrie/resource_generator.rb
433
- - lib/generators/valkyrie/templates/resource.rb.erb
434
- - lib/generators/valkyrie/templates/resource_spec.rb.erb
457
+ - gemfiles/activerecord_7_0.gemfile
458
+ - gemfiles/faraday_0.gemfile
459
+ - gemfiles/faraday_1.gemfile
435
460
  - lib/valkyrie.rb
436
461
  - lib/valkyrie/adapter_container.rb
437
462
  - lib/valkyrie/change_set.rb
@@ -553,7 +578,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
553
578
  - !ruby/object:Gem::Version
554
579
  version: 1.3.1
555
580
  requirements: []
556
- rubygems_version: 3.0.3
581
+ rubygems_version: 3.1.6
557
582
  signing_key:
558
583
  specification_version: 4
559
584
  summary: An ORM using the Data Mapper pattern, specifically built to solve Digital
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'active_record'
3
- require 'erb'
4
-
5
- module DatabaseConnection
6
- def self.connect!(env)
7
- # Ref https://github.com/puma/puma#clustered-mode
8
- ActiveSupport.on_load(:active_record) do
9
- ::ActiveRecord::Base.connection_pool.disconnect! if ::ActiveRecord::Base.connected?
10
- ::ActiveRecord::Base.configurations = YAML.safe_load(ERB.new(File.read("db/config.yml")).result, [], [], true) || {}
11
- config = ::ActiveRecord::Base.configurations[env.to_s]
12
- ::ActiveRecord::Base.establish_connection(config)
13
- end
14
- end
15
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rails/generators'
3
- require 'rails/generators/model_helpers'
4
-
5
- class Valkyrie::ResourceGenerator < Rails::Generators::NamedBase
6
- # Include ModelHelpers to warn about pluralization when generating new models or scaffolds
7
- include Rails::Generators::ModelHelpers
8
-
9
- source_root File.expand_path('../templates', __FILE__)
10
-
11
- argument :attributes, type: :array, default: [], banner: 'field:type field:type'
12
-
13
- def create_model
14
- template('resource.rb.erb', File.join('app/models', class_path, "#{file_name}.rb"))
15
- end
16
-
17
- def create_model_spec
18
- return unless rspec_installed?
19
- template('resource_spec.rb.erb', File.join('spec/models', class_path, "#{file_name}_spec.rb"))
20
- end
21
-
22
- private
23
-
24
- def rspec_installed?
25
- defined?(RSpec) && defined?(RSpec::Rails)
26
- end
27
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
- # Generated with `rails generate valkyrie:model <%= class_name %>`
3
- class <%= class_name %> < Valkyrie::Resource
4
- include Valkyrie::Resource::AccessControls
5
- <%- attributes.each do |att| -%>
6
- attribute :<%= att.name %>, Valkyrie::Types::<%= (att.type == :array) ? 'Array' : 'Set' %>
7
- <%- end -%>
8
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
- # Generated with `rails generate valkyrie:model <%= class_name %>`
3
- require 'rails_helper'
4
- require 'valkyrie/specs/shared_specs'
5
-
6
- RSpec.describe <%= class_name %> do
7
- let(:resource_klass) { described_class }
8
- it_behaves_like "a Valkyrie::Resource"
9
-
10
- it "has tests" do
11
- skip "Add your tests here"
12
- end
13
- end