valkyrie 2.0.1 → 2.0.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: e1b458c0bf12323ee7593ba335f9b11d933bbf3bc8e2dd1174f2a682e0be10c7
4
- data.tar.gz: 59ec4d50795fa715b260fd77b773a4113d90731ae12719d8ed35d494f600f056
3
+ metadata.gz: 06e5a897c18679418660d531ae88c69f4ed675289080ddf712a52d2efa700344
4
+ data.tar.gz: 78c96247bff42a505751b299f3314c4028240c2e68ac727d42cb71d1f92ab8af
5
5
  SHA512:
6
- metadata.gz: 9625fb7adb62fd504dde9e216a4b86b10c3054258f3363eb717da22e5bd1a81c8dc72608022739311a5b914528d9ac045dd66063148ec58da1de63e5cda08575
7
- data.tar.gz: 4692ea78e86c4a8a74ddbea67c2b74660f7c7a2f4d69efd0c6755f6f2ba9258620eeaa7d03f1455b24a81e4c61dff5533f47072db6f9945eff92d1779696df6e
6
+ metadata.gz: dcbf37ca3daa89d25bf7c28d0d1684c2959fb6d26eff6ba8ca427b64f6a4413774702dd588a19e797648266b26786f526eb3b6423a2aeb48d78e8a0d4c6603f5
7
+ data.tar.gz: 20dc3cc1aacd225b29eec0d2cdafe8bc42c7d46b0bdbd4ad81af75dae79017477fb116b00320c9d4be4bf5e7aa5fcd23b6a88c8d4b5c7ac7dbaeb436ebed8caa
@@ -67,6 +67,10 @@ workflows:
67
67
  version: 2
68
68
  build:
69
69
  jobs:
70
+ - build:
71
+ gemfile: "gemfiles/activerecord_6_0.gemfile"
72
+ ruby: 2.6.3
73
+ name: "Ruby2-6_Rails6-0"
70
74
  - build:
71
75
  gemfile: "gemfiles/activerecord_5_2.gemfile"
72
76
  ruby: 2.6.3
@@ -100,6 +104,10 @@ workflows:
100
104
  only:
101
105
  - master
102
106
  jobs:
107
+ - build:
108
+ gemfile: "gemfiles/activerecord_6_0.gemfile"
109
+ ruby: 2.6.3
110
+ name: "Ruby2-6_Rails6-0"
103
111
  - build:
104
112
  gemfile: "gemfiles/activerecord_5_2.gemfile"
105
113
  ruby: 2.6.3
@@ -8,13 +8,13 @@ volumes:
8
8
  solr_index:
9
9
  services:
10
10
  fedora4:
11
- image: nulib/fcrepo4:4.7.5
11
+ image: samvera/fcrepo4:4.7.5
12
12
  volumes:
13
13
  - fedora4:/data
14
14
  ports:
15
15
  - 8986:8080
16
16
  fedora5:
17
- image: nulib/fcrepo4:5.0.0
17
+ image: samvera/fcrepo4:5.1.0
18
18
  volumes:
19
19
  - fedora5:/data
20
20
  ports:
@@ -8,13 +8,13 @@ volumes:
8
8
  solr_index:
9
9
  services:
10
10
  fedora4:
11
- image: nulib/fcrepo4:4.7.5
11
+ image: samvera/fcrepo4:4.7.5
12
12
  volumes:
13
13
  - fedora4:/data
14
14
  ports:
15
15
  - 8988:8080
16
16
  fedora5:
17
- image: nulib/fcrepo4:5.0.0
17
+ image: samvera/fcrepo4:5.1.0
18
18
  volumes:
19
19
  - fedora5:/data
20
20
  ports:
data/Appraisals CHANGED
@@ -1,4 +1,8 @@
1
1
  # frozen_string_literal: true
2
+ appraise "activerecord-6-0" do
3
+ gem "activerecord", "~> 6.0.0"
4
+ end
5
+
2
6
  appraise "activerecord-5-2" do
3
7
  gem "activerecord", "~> 5.2.0"
4
8
  end
@@ -1,3 +1,17 @@
1
+ # v2.0.2 2019-10-17
2
+
3
+ ## Changes since last release
4
+
5
+ * Fix nil not persisting with the ActiveRecord adapter.
6
+ [tpendragon](https://github.com/tpendragon)
7
+ * Define setters when building a Resource schema with `.attributes`
8
+ [no-reply](https://github.com/no-reply)
9
+
10
+ Additional thanks to the following for code review and issue reports leading to
11
+ this release:
12
+
13
+ [coblej](https://github.com/coblej)
14
+
1
15
  # v2.0.1 2019-07-03
2
16
 
3
17
  ## Changes since last release
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 6.0.0"
6
+ gem "ldp"
7
+ gem "pg"
8
+ gem "rsolr"
9
+
10
+ gemspec path: "../"
@@ -20,7 +20,7 @@ module Valkyrie::Persistence::Postgres
20
20
  orm_object.internal_resource = resource.internal_resource
21
21
  process_lock_token(orm_object)
22
22
  orm_object.disable_optimistic_locking! unless resource.optimistic_locking_enabled?
23
- orm_object.metadata.merge!(attributes)
23
+ orm_object.metadata = attributes
24
24
  end
25
25
  end
26
26
 
@@ -13,6 +13,7 @@ module Valkyrie
13
13
  # @see https://github.com/samvera-labs/valkyrie/wiki/ChangeSets-and-Dirty-Tracking Validation and change tracking is provided by change sets
14
14
  #
15
15
  # @see lib/valkyrie/specs/shared_specs/resource.rb
16
+ # rubocop:disable Metrics/ClassLength
16
17
  class Resource < Dry::Struct
17
18
  include Draper::Decoratable
18
19
  # Allows a Valkyrie::Resource to be instantiated without providing every
@@ -48,13 +49,34 @@ module Valkyrie
48
49
  raise ReservedAttributeError, "#{name} is a reserved attribute and defined by Valkyrie::Resource, do not redefine it." if reserved_attributes.include?(name.to_sym) &&
49
50
  attribute_names.include?(name.to_sym) &&
50
51
  !internal
51
- define_method("#{name}=") do |value|
52
- set_value(name, value)
53
- end
52
+
54
53
  type = type.meta(ordered: true) if name == :member_ids
55
54
  super(name, type)
56
55
  end
57
56
 
57
+ # @param [Hash{Symbol => Dry::Types::Type}] new_schema
58
+ # @return [Dry::Struct]
59
+ # @raise [RepeatedAttributeError] when trying to define attribute with the
60
+ # same name as previously defined one
61
+ # @see #attribute
62
+ # @note extends {Dry::Struct} by adding `#attr=` style setters
63
+ def self.attributes(new_schema)
64
+ super
65
+
66
+ new_schema.each_key do |key|
67
+ key = key.to_s.chomp('?')
68
+ next if instance_methods.include?("#{key}=".to_sym)
69
+
70
+ class_eval(<<-RUBY)
71
+ def #{key}=(value)
72
+ set_value("#{key}".to_sym, value)
73
+ end
74
+ RUBY
75
+ end
76
+
77
+ self
78
+ end
79
+
58
80
  def self.reserved_attributes
59
81
  [:id, :internal_resource, :created_at, :updated_at, :new_record]
60
82
  end
@@ -166,4 +188,5 @@ module Valkyrie
166
188
 
167
189
  class ReservedAttributeError < StandardError; end
168
190
  end
191
+ # rubocop:enable Metrics/ClassLength
169
192
  end
@@ -56,6 +56,14 @@ RSpec.shared_examples 'a Valkyrie::Persister' do |*flags|
56
56
  output = persister.save(resource: resource)
57
57
 
58
58
  expect(output.single_value).to eq "A single value"
59
+
60
+ reloaded = query_service.find_by(id: output.id)
61
+
62
+ reloaded.single_value = nil
63
+ persister.save(resource: reloaded)
64
+ reloaded = query_service.find_by(id: reloaded.id)
65
+
66
+ expect(reloaded.single_value).to eq nil
59
67
  end
60
68
 
61
69
  it "returns nil for an unset single value" do
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Valkyrie
3
- VERSION = "2.0.1"
3
+ VERSION = "2.0.2"
4
4
  end
@@ -9,7 +9,7 @@ namespace :server do
9
9
  SolrWrapper.wrap(shared_solr_opts.merge(port: 8984, instance_dir: 'tmp/blacklight-core-test')) do |solr|
10
10
  solr.with_collection(name: "blacklight-core-test", dir: Pathname.new(__dir__).join("..", "solr", "config").to_s) do
11
11
  FcrepoWrapper.wrap(shared_fedora_opts.merge(port: 8988, fcrepo_home_dir: "tmp/fcrepo4-test-data", version: "4.7.5", instance_directory: "tmp/fcrepo4")) do |_fcrepo|
12
- FcrepoWrapper::Instance.new(shared_fedora_opts.merge(port: 8998, fcrepo_home_dir: "tmp/fcrepo5-test-data", version: "5.0.0", instance_directory: "tmp/fcrepo5")).wrap do |_other_repo|
12
+ FcrepoWrapper::Instance.new(shared_fedora_opts.merge(port: 8998, fcrepo_home_dir: "tmp/fcrepo5-test-data", version: "5.1.0", instance_directory: "tmp/fcrepo5")).wrap do |_other_repo|
13
13
  puts "Setup solr & Fedora"
14
14
  loop do
15
15
  sleep(1)
@@ -40,7 +40,7 @@ namespace :server do
40
40
  SolrWrapper.wrap(shared_solr_opts.merge(port: 8983, instance_dir: 'tmp/blacklight-core')) do |solr|
41
41
  solr.with_collection(name: "blacklight-core", dir: Pathname.new(__dir__).join("..", "solr", "config").to_s) do
42
42
  FcrepoWrapper.wrap(shared_fedora_opts.merge(port: 8986, fcrepo_home_dir: "tmp/fcrepo4-dev-data", version: "4.7.5")) do |_fcrepo|
43
- FcrepoWrapper::Instance.new(shared_fedora_opts.merge(port: 8996, fcrepo_home_dir: "tmp/fcrepo5-dev-data", version: "5.0.0")).wrap do |_fcrepo|
43
+ FcrepoWrapper::Instance.new(shared_fedora_opts.merge(port: 8996, fcrepo_home_dir: "tmp/fcrepo5-dev-data", version: "5.1.0")).wrap do |_fcrepo|
44
44
  puts "Setup solr & Fedora"
45
45
  loop do
46
46
  sleep(1)
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: 2.0.1
4
+ version: 2.0.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: 2019-07-16 00:00:00.000000000 Z
11
+ date: 2019-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -452,6 +452,7 @@ files:
452
452
  - db/seeds.rb
453
453
  - gemfiles/activerecord_5_1.gemfile
454
454
  - gemfiles/activerecord_5_2.gemfile
455
+ - gemfiles/activerecord_6_0.gemfile
455
456
  - lib/config/database_connection.rb
456
457
  - lib/generators/valkyrie/resource_generator.rb
457
458
  - lib/generators/valkyrie/templates/resource.rb.erb