valkyrie 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +33 -29
- data/.lando.yml +40 -0
- data/.rubocop.yml +4 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +26 -0
- data/README.md +19 -47
- data/Rakefile +21 -20
- data/db/config.yml +3 -10
- data/lib/generators/valkyrie/resource_generator.rb +3 -3
- data/lib/valkyrie.rb +13 -13
- data/lib/valkyrie/change_set.rb +3 -3
- data/lib/valkyrie/id.rb +14 -14
- data/lib/valkyrie/indexers/access_controls_indexer.rb +17 -17
- data/lib/valkyrie/persistence/fedora/list_node.rb +43 -43
- data/lib/valkyrie/persistence/fedora/ordered_list.rb +90 -90
- data/lib/valkyrie/persistence/fedora/ordered_reader.rb +5 -5
- data/lib/valkyrie/persistence/fedora/permissive_schema.rb +1 -1
- data/lib/valkyrie/persistence/fedora/persister.rb +80 -82
- data/lib/valkyrie/persistence/fedora/persister/model_converter.rb +15 -15
- data/lib/valkyrie/persistence/fedora/persister/orm_converter.rb +38 -18
- data/lib/valkyrie/persistence/fedora/query_service.rb +38 -40
- data/lib/valkyrie/persistence/memory/persister.rb +33 -33
- data/lib/valkyrie/persistence/memory/query_service.rb +26 -30
- data/lib/valkyrie/persistence/postgres/orm_converter.rb +52 -52
- data/lib/valkyrie/persistence/postgres/query_service.rb +34 -34
- data/lib/valkyrie/persistence/shared/json_value_mapper.rb +1 -1
- data/lib/valkyrie/persistence/solr/model_converter.rb +337 -337
- data/lib/valkyrie/persistence/solr/orm_converter.rb +3 -3
- data/lib/valkyrie/persistence/solr/queries/find_members_query.rb +1 -1
- data/lib/valkyrie/persistence/solr/query_service.rb +12 -12
- data/lib/valkyrie/specs/shared_specs/persister.rb +2 -2
- data/lib/valkyrie/storage/fedora.rb +16 -16
- data/lib/valkyrie/storage_adapter.rb +11 -11
- data/lib/valkyrie/version.rb +1 -1
- data/tasks/dev.rake +14 -51
- data/valkyrie.gemspec +3 -4
- metadata +22 -33
- data/.docker-stack/valkyrie-development/docker-compose.yml +0 -53
- data/.docker-stack/valkyrie-test/docker-compose.yml +0 -53
- data/tasks/docker.rake +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d82ceafa985dc327a594ad39da9f4feb343579e6330ae7f30a6fd7894471083
|
4
|
+
data.tar.gz: 56f54340890de9a799588b47eb4fb3ee6f400d598db03c7bf97d4163d128d831
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2676a955ae6333f4c9b82a4f2a0e131bb235e4cdef8b05951bdfb787ac1218a9e2da410a476928482824b909a12ade0f2d6e2074915c3738922ca4f3a8004337
|
7
|
+
data.tar.gz: 67a8b919a2ce033240db9d8b507140f84a8c49edfbf7283f205a41a7a09d2ba99940e5c465f0959cc27ce707e52d68b5e2d04a0f67376f482ae560c4713608ee
|
data/.circleci/config.yml
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
version: 2.1
|
3
3
|
jobs:
|
4
4
|
build:
|
5
|
-
machine: true
|
6
5
|
parameters:
|
7
6
|
gemfile:
|
8
7
|
description: "Gemfile to run"
|
@@ -12,32 +11,42 @@ jobs:
|
|
12
11
|
description: "Ruby version"
|
13
12
|
default: "2.6.5"
|
14
13
|
type: "string"
|
14
|
+
docker:
|
15
|
+
- image: circleci/ruby:<< parameters.ruby >>-node-browsers
|
16
|
+
environment:
|
17
|
+
RAILS_ENV: test
|
18
|
+
- image: postgres:10.6-alpine
|
19
|
+
environment:
|
20
|
+
POSTGRES_USER: postgres
|
21
|
+
POSTGRES_DB: Valkyrie_gem_test
|
22
|
+
POSTGRES_HOST_AUTH_METHOD: trust
|
23
|
+
- image: samvera/fcrepo4:4.7.5
|
24
|
+
environment:
|
25
|
+
CATALINA_OPTS: "-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"
|
26
|
+
JAVA_OPTIONS: "-Djetty.http.port=8988"
|
27
|
+
- image: samvera/fcrepo4:5.1.0
|
28
|
+
environment:
|
29
|
+
CATALINA_OPTS: "-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"
|
30
|
+
JAVA_OPTIONS: "-Djetty.http.port=8998 -Dfcrepo.dynamic.jms.port=61618 -Dfcrepo.dynamic.stomp.port=61614"
|
31
|
+
- image: solr:7.7-alpine
|
32
|
+
command: bin/solr -cloud -noprompt -f -p 8994
|
15
33
|
environment:
|
16
34
|
BUNDLE_GEMFILE: << parameters.gemfile >>
|
35
|
+
POSTGRES_PORT: 5432
|
17
36
|
steps:
|
18
37
|
- checkout
|
19
38
|
- run:
|
20
|
-
name:
|
21
|
-
command:
|
22
|
-
rvm install << parameters.ruby >>
|
23
|
-
echo . $(rvm << parameters.ruby >> do rvm env --path) >> $BASH_ENV
|
24
|
-
- run:
|
25
|
-
shell: /bin/bash -l
|
26
|
-
name: Uninstall global Bundler
|
27
|
-
command: |
|
28
|
-
rvm use << parameters.ruby >>
|
29
|
-
rvm gemset use global
|
30
|
-
gem uninstall bundler -x
|
31
|
-
echo Uninstalled
|
39
|
+
name: Wait for solr
|
40
|
+
command: dockerize -wait tcp://localhost:8994 -timeout 1m
|
32
41
|
- run:
|
33
|
-
name:
|
42
|
+
name: Load config into solr
|
34
43
|
command: |
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
44
|
+
cd solr/config
|
45
|
+
zip -1 -r solr_config.zip ./*
|
46
|
+
curl -H "Content-type:application/octet-stream" --data-binary @solr_config.zip "http://localhost:8994/solr/admin/configs?action=UPLOAD&name=valkyrie"
|
47
|
+
curl -H 'Content-type: application/json' http://localhost:8994/api/collections/ -d '{create: {name: valkyrie-core-test, config: valkyrie, numShards: 1}}'
|
48
|
+
# Install Bundler
|
49
|
+
- run: gem install bundler -v '~> 2.0'
|
41
50
|
- restore_cache:
|
42
51
|
keys:
|
43
52
|
- bundle-{{ checksum "<< parameters.gemfile >>" }}-{{ checksum "valkyrie.gemspec" }}-<< parameters.ruby >>-6
|
@@ -57,9 +66,12 @@ jobs:
|
|
57
66
|
- run:
|
58
67
|
name: Run Rubocop
|
59
68
|
command: bundle exec rake rubocop
|
69
|
+
- run:
|
70
|
+
name: Set up database
|
71
|
+
command: bundle exec rake db:migrate
|
60
72
|
- run:
|
61
73
|
name: Run Specs
|
62
|
-
command: bundle exec
|
74
|
+
command: bundle exec rspec spec
|
63
75
|
- store_artifacts:
|
64
76
|
path: coverage
|
65
77
|
destination: coverage
|
@@ -87,10 +99,6 @@ workflows:
|
|
87
99
|
gemfile: "gemfiles/activerecord_5_2.gemfile"
|
88
100
|
ruby: 2.5.7
|
89
101
|
name: "Ruby2-5_Rails5-2"
|
90
|
-
- build:
|
91
|
-
gemfile: "gemfiles/activerecord_5_2.gemfile"
|
92
|
-
ruby: 2.4.9
|
93
|
-
name: "Ruby2-4_Rails5-2"
|
94
102
|
nightly:
|
95
103
|
triggers:
|
96
104
|
- schedule:
|
@@ -120,7 +128,3 @@ workflows:
|
|
120
128
|
gemfile: "gemfiles/activerecord_5_2.gemfile"
|
121
129
|
ruby: 2.5.7
|
122
130
|
name: "Ruby2-5_Rails5-2"
|
123
|
-
- build:
|
124
|
-
gemfile: "gemfiles/activerecord_5_2.gemfile"
|
125
|
-
ruby: 2.4.9
|
126
|
-
name: "Ruby2-4_Rails5-2"
|
data/.lando.yml
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
name: valkyrie
|
2
|
+
app_mount: false
|
3
|
+
services:
|
4
|
+
valkyrie_test_solr_7:
|
5
|
+
app_mount: false
|
6
|
+
type: solr:7
|
7
|
+
portforward: 8994
|
8
|
+
core: valkyrie-core-test
|
9
|
+
config:
|
10
|
+
dir: solr/config
|
11
|
+
valkyrie_database:
|
12
|
+
app_mount: false
|
13
|
+
type: postgres:10
|
14
|
+
portforward: 5433
|
15
|
+
valkyrie_fedora_4:
|
16
|
+
type: compose
|
17
|
+
app_mount: false
|
18
|
+
volumes:
|
19
|
+
fedora4:
|
20
|
+
services:
|
21
|
+
image: samvera/fcrepo4:4.7.5
|
22
|
+
command: /fedora-entrypoint.sh
|
23
|
+
volumes:
|
24
|
+
- fedora4:/data
|
25
|
+
ports:
|
26
|
+
- 8988:8080
|
27
|
+
portforward: true
|
28
|
+
valkyrie_fedora_5:
|
29
|
+
type: compose
|
30
|
+
app_mount: false
|
31
|
+
volumes:
|
32
|
+
fedora5:
|
33
|
+
services:
|
34
|
+
image: samvera/fcrepo4:5.1.0
|
35
|
+
command: /fedora-entrypoint.sh
|
36
|
+
volumes:
|
37
|
+
- fedora5:/data
|
38
|
+
ports:
|
39
|
+
- 8998:8080
|
40
|
+
portforward: true
|
data/.rubocop.yml
CHANGED
@@ -4,7 +4,6 @@ inherit_gem:
|
|
4
4
|
bixby: bixby_default.yml
|
5
5
|
AllCops:
|
6
6
|
DisplayCopNames: true
|
7
|
-
TargetRubyVersion: 2.3
|
8
7
|
Exclude:
|
9
8
|
- 'bin/*'
|
10
9
|
- 'db/schema.rb'
|
@@ -26,6 +25,10 @@ RSpec/MultipleExpectations:
|
|
26
25
|
Enabled: false
|
27
26
|
Rails/TimeZone:
|
28
27
|
Enabled: false
|
28
|
+
Rails/RakeEnvironment:
|
29
|
+
Enabled: false
|
30
|
+
Rails/ApplicationRecord:
|
31
|
+
Enabled: false
|
29
32
|
Naming/PredicateName:
|
30
33
|
Exclude:
|
31
34
|
- "lib/valkyrie/resource.rb"
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 2.
|
1
|
+
ruby 2.6.6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
# v2.1.2 2020-03-12
|
2
|
+
|
3
|
+
## Changes since last release
|
4
|
+
|
5
|
+
* Tighten reform dependency
|
6
|
+
[tpendragon](https://github.com/tpendragon)
|
7
|
+
* Loosen RDF Dependency
|
8
|
+
[no-reply](https://github.com/no-reply)
|
9
|
+
* Update development ruby version in .tool-versions
|
10
|
+
[hackartisan](https://github.com/hackartisan)
|
11
|
+
* Use Lando for development
|
12
|
+
[tpendragon](https://github.com/tpendragon)
|
13
|
+
* Deprecate Blacklist in favor of Denylist.
|
14
|
+
[jeremyf](https://github.com/jeremyf)
|
15
|
+
* Make DateTime handling in Fedora/Solr persisters consistent with others.
|
16
|
+
[hcayless](https://github.com/hcayless)
|
17
|
+
* Add open-ended Rake support.
|
18
|
+
[no-reply](https://github.com/no-reply)
|
19
|
+
|
20
|
+
Additional thanks to the following for code review and issue reports leading to
|
21
|
+
this release:
|
22
|
+
|
23
|
+
[cjcolvar](https://github.com/cjcolvar)
|
24
|
+
[escowles](https://github.com/escowles)
|
25
|
+
[jeremyf](https://github.com/jeremyf)
|
26
|
+
|
1
27
|
# v2.1.1 2020-03-12
|
2
28
|
|
3
29
|
## Changes since last release
|
data/README.md
CHANGED
@@ -252,53 +252,25 @@ config. If Fedora requires auth, you can also include that in the URL, e.g.:
|
|
252
252
|
|
253
253
|
## Installing a Development environment
|
254
254
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
shell to run them in the foreground)
|
275
|
-
1. Run `rake db:create db:migrate` to initialize the database
|
276
|
-
1. Develop!
|
277
|
-
1. Run `rake docker:dev:down` to stop the server stack
|
278
|
-
* Development servers maintain data between runs. To clean them out, run `rake docker:dev:clean`
|
279
|
-
|
280
|
-
#### To run the test suite with all dependencies in one go
|
281
|
-
1. `rake docker:spec`
|
282
|
-
|
283
|
-
#### To run the test suite manually
|
284
|
-
1. Start Solr, Fedora, and PostgreSQL with `rake docker:test:daemon` (or `rake docker:test:up` in a separate
|
285
|
-
shell to run them in the foreground)
|
286
|
-
1. Run `rake db:create db:migrate` to initialize the database
|
287
|
-
1. Run the gem's RSpec test suite with `rspec spec` or `rake`
|
288
|
-
1. Run `rake docker:test:down` to stop the server stack
|
289
|
-
* The test stack cleans up after itself on exit.
|
290
|
-
|
291
|
-
### Without Docker
|
292
|
-
|
293
|
-
#### External Requirements
|
294
|
-
* PostgreSQL with the uuid-ossp extension.
|
295
|
-
* Note: Enabling uuid-ossp requires database superuser privileges.
|
296
|
-
* From `psql`: `alter user [username] with superuser;`
|
297
|
-
|
298
|
-
#### To run the test suite
|
299
|
-
1. Start Solr and Fedora servers for testing with `rake server:test`
|
300
|
-
1. Run `rake db:create` (First time only)
|
301
|
-
1. Run `rake db:migrate`
|
255
|
+
For ease of development we use Lando to abstract away some complications of
|
256
|
+
using Docker containers for development.
|
257
|
+
|
258
|
+
### Running Tests
|
259
|
+
|
260
|
+
1. Install the latest released > 3.0 version of Lando from [here](https://github.com/lando/lando/releases).
|
261
|
+
2. `bundle install`
|
262
|
+
3. `bundle exec rake server:start`
|
263
|
+
4. `bundle exec rspec spec`
|
264
|
+
|
265
|
+
### Cleaning Data
|
266
|
+
|
267
|
+
1. `bundle exec rake server:clean`
|
268
|
+
|
269
|
+
### Stopping Servers
|
270
|
+
|
271
|
+
1. `bundle exec rake server:stop`
|
272
|
+
|
273
|
+
You can also run `lando poweroff` from anywhere.
|
302
274
|
|
303
275
|
## Acknowledgments
|
304
276
|
|
data/Rakefile
CHANGED
@@ -6,7 +6,6 @@ require 'config/database_connection'
|
|
6
6
|
require 'active_record'
|
7
7
|
require 'rubocop/rake_task'
|
8
8
|
load 'tasks/dev.rake'
|
9
|
-
load 'tasks/docker.rake'
|
10
9
|
|
11
10
|
RSpec::Core::RakeTask.new(:spec)
|
12
11
|
|
@@ -37,8 +36,12 @@ namespace :db do
|
|
37
36
|
|
38
37
|
desc 'Create the database from db/config.yml for the current DATABASE_ENV'
|
39
38
|
task create: :configure_connection do
|
40
|
-
|
41
|
-
|
39
|
+
begin
|
40
|
+
database = ActiveRecord::Tasks::PostgreSQLDatabaseTasks.new(@config)
|
41
|
+
database.create
|
42
|
+
rescue
|
43
|
+
puts "Database already exists."
|
44
|
+
end
|
42
45
|
puts "Database created"
|
43
46
|
end
|
44
47
|
|
@@ -51,25 +54,23 @@ namespace :db do
|
|
51
54
|
|
52
55
|
desc 'Migrate the database (options: VERSION=x, VERBOSE=false).'
|
53
56
|
task migrate: :configure_connection do
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
scope.blank? || scope == migration.scope
|
67
|
-
end
|
57
|
+
verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
58
|
+
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
|
59
|
+
scope = ENV['SCOPE']
|
60
|
+
verbose_was = ActiveRecord::Migration.verbose
|
61
|
+
ActiveRecord::Migration.verbose = verbose
|
62
|
+
if ActiveRecord::Migrator.respond_to?(:migrate)
|
63
|
+
ActiveRecord::Migrator.migrate(MIGRATIONS_DIR, version) do |migration|
|
64
|
+
scope.blank? || scope == migration.scope
|
65
|
+
end
|
66
|
+
else
|
67
|
+
ActiveRecord::Base.connection.migration_context.migrate(version) do |migration|
|
68
|
+
scope.blank? || scope == migration.scope
|
68
69
|
end
|
69
|
-
ActiveRecord::Base.clear_cache!
|
70
|
-
ensure
|
71
|
-
ActiveRecord::Migration.verbose = verbose_was
|
72
70
|
end
|
71
|
+
ActiveRecord::Base.clear_cache!
|
72
|
+
ensure
|
73
|
+
ActiveRecord::Migration.verbose = verbose_was
|
73
74
|
end
|
74
75
|
|
75
76
|
namespace :schema do
|
data/db/config.yml
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
<% local = File.exist?('/tmp/.s.PGSQL.5432') && File.stat('/tmp/.s.PGSQL.5432').socket? %>
|
2
1
|
default: &default
|
3
2
|
adapter: postgresql
|
4
3
|
encoding: utf8
|
@@ -6,22 +5,16 @@ default: &default
|
|
6
5
|
pool: <%= Integer(ENV.fetch("DB_POOL", 5)) %>
|
7
6
|
reaping_frequency: <%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
|
8
7
|
timeout: 5000
|
9
|
-
<% unless local %>
|
10
8
|
host: localhost
|
11
|
-
username:
|
12
|
-
password:
|
13
|
-
<% end %>
|
9
|
+
username: postgres
|
10
|
+
password:
|
14
11
|
|
15
12
|
development:
|
16
13
|
<<: *default
|
17
14
|
database: Valkyrie_gem_development
|
18
|
-
<% unless local %>
|
19
15
|
port: 5433
|
20
|
-
<% end %>
|
21
16
|
|
22
17
|
test:
|
23
18
|
<<: *default
|
24
19
|
database: Valkyrie_gem_test
|
25
|
-
|
26
|
-
port: 5434
|
27
|
-
<% end %>
|
20
|
+
port: <%= ENV["POSTGRES_PORT"] || 5433 %>
|
data/lib/valkyrie.rb
CHANGED
@@ -119,19 +119,19 @@ module Valkyrie
|
|
119
119
|
|
120
120
|
private
|
121
121
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
122
|
+
def defaults
|
123
|
+
{
|
124
|
+
resource_class_resolver: method(:default_resource_class_resolver)
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
# String constantize is a "by convention" factory. This works, but assumes
|
129
|
+
# the ruby class once used to persist is the model used to now reify.
|
130
|
+
#
|
131
|
+
# @param [String] class_name
|
132
|
+
def default_resource_class_resolver(class_name)
|
133
|
+
class_name.constantize
|
134
|
+
end
|
135
135
|
end
|
136
136
|
|
137
137
|
module_function :config, :logger, :logger=, :config_root_path, :environment, :config_file, :config_hash
|
data/lib/valkyrie/change_set.rb
CHANGED
data/lib/valkyrie/id.rb
CHANGED
@@ -32,22 +32,22 @@ module Valkyrie
|
|
32
32
|
|
33
33
|
protected
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
false
|
35
|
+
def default_equality(other)
|
36
|
+
output = (other.class == self.class && other.state == state)
|
37
|
+
return output if output == true
|
38
|
+
if output == false && string_equality(other) && Valkyrie.config.id_string_equality.nil?
|
39
|
+
warn "[DEPRECATION] Valkyrie::IDs will always be equal to their string counterparts in 3.0.0. " \
|
40
|
+
"To silence this message, please either compare IDs or set Valkyrie.config.id_string_equality = true."
|
43
41
|
end
|
42
|
+
false
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
def string_equality(other)
|
46
|
+
other == to_str
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
def state
|
50
|
+
[@id]
|
51
|
+
end
|
52
52
|
end
|
53
53
|
end
|