active-fedora 13.2.4 → 13.3.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
  SHA256:
3
- metadata.gz: 85c4c145c52dd7a76031180b40c4a9d8d2cca56073178db2d7543264ff76afea
4
- data.tar.gz: 5e89813a2fb65dcd80487a1203bec8ca869cc3c611924440903cb22830133dcb
3
+ metadata.gz: 5833c4a96e372ae86f5727ec33d965f054ba21567c177c0b4340ecc2d6e7bb84
4
+ data.tar.gz: 86204eff86f88f343876d0974ac446b60d087945bb856a7ec4854d0f91f3adfa
5
5
  SHA512:
6
- metadata.gz: 8e97b32bca2819b43732657cd70b3cbb6f932b144bf00c10f390a0caee675b59a6f480637ff0fe93ad0f1b8bcfa791d1298a8dedf580b59699ff74ad8dd31240
7
- data.tar.gz: 4ca64c09d2b36a4378303ccd5cb257d0012207c44793bf93cac44be0dda1a230e87066ff19664f91d36ac42367b2539484b512012b5cdee071ae728fe399e811
6
+ metadata.gz: 70c86acbc2effa48e03911fc3a985918e5ce7004b7e02898ea841e95172db330a5c44a6cd3438513b76312d98b2dbe5b2116b4fdecfd978d15bf5715dbced3e4
7
+ data.tar.gz: e473abc4f550bae98d519fd6e1617d6336e1427926702bc4d904e59cd9f49638b820b982350c174bd2f7f6f778ef3d53a196d46667e5c4bd1b3f285c99e7eaba
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- samvera: samvera/circleci-orb@0
3
+ samvera: samvera/circleci-orb@1.0
4
4
  jobs:
5
5
  bundle_lint_test:
6
6
  parameters:
@@ -8,7 +8,7 @@ jobs:
8
8
  type: string
9
9
  bundler_version:
10
10
  type: string
11
- default: 2.0.1
11
+ default: 2.3.11
12
12
  rails_version:
13
13
  type: string
14
14
  solr_config_path:
@@ -21,6 +21,16 @@ jobs:
21
21
  RAILS_VERSION: << parameters.rails_version >>
22
22
  steps:
23
23
  - samvera/cached_checkout
24
+ - checkout
25
+ - run:
26
+ name: Check for 'master' branch
27
+ command: |
28
+ git fetch --all --quiet --prune --prune-tags
29
+ if [[ -n "$(git branch --all --list master */master)" ]]; then
30
+ echo "A branch named 'master' was found. Please remove it."
31
+ echo "$(git branch --all --list master */master)"
32
+ fi
33
+ [[ -z "$(git branch --all --list master */master)" ]]
24
34
 
25
35
  - samvera/bundle_for_gem:
26
36
  ruby_version: << parameters.ruby_version >>
@@ -37,31 +47,83 @@ jobs:
37
47
  workflows:
38
48
  ci:
39
49
  jobs:
50
+ # Ruby 2.7 releases
51
+ - bundle_lint_test:
52
+ name: ruby2-7_rails6-1
53
+ ruby_version: 2.7.5
54
+ rails_version: 6.1.6.1
55
+ - bundle_lint_test:
56
+ name: ruby2-7_rails6-0
57
+ ruby_version: 2.7.5
58
+ rails_version: 6.0.4.7
40
59
  - bundle_lint_test:
41
60
  name: ruby2-7_rails5-2
42
- ruby_version: 2.7.0
61
+ ruby_version: 2.7.5
43
62
  rails_version: 5.2.4
63
+ # Ruby 2.6 releases
64
+ - bundle_lint_test:
65
+ name: ruby2-6_rails6-1
66
+ ruby_version: 2.6.9
67
+ rails_version: 6.1.6.1
68
+ - bundle_lint_test:
69
+ name: ruby2-6_rails6-0
70
+ ruby_version: 2.6.9
71
+ rails_version: 6.0.4.7
44
72
  - bundle_lint_test:
45
73
  name: ruby2-6_rails5-2
46
- ruby_version: 2.6.5
74
+ ruby_version: 2.6.9
47
75
  rails_version: 5.2.4
76
+ # Ruby 2.5 releases
77
+ - bundle_lint_test:
78
+ name: ruby2-5_rails6.0
79
+ ruby_version: 2.5.9
80
+ rails_version: 6.0.4.7
48
81
  - bundle_lint_test:
49
82
  name: ruby2-5_rails5-2
50
- ruby_version: 2.5.7
83
+ ruby_version: 2.5.9
51
84
  rails_version: 5.2.4
85
+
86
+ nightly:
87
+ triggers:
88
+ - schedule:
89
+ cron: "0 0 * * *"
90
+ filters:
91
+ branches:
92
+ only:
93
+ - main
94
+ jobs:
95
+ # Ruby 2.7 releases
52
96
  - bundle_lint_test:
53
- name: ruby2-4_rails5-2
54
- ruby_version: 2.4.9
55
- rails_version: 5.2.4
97
+ name: ruby2-7_rails6-1
98
+ ruby_version: 2.7.5
99
+ rails_version: 6.1.6.1
56
100
  - bundle_lint_test:
57
101
  name: ruby2-7_rails6-0
58
- ruby_version: 2.7.0
59
- rails_version: 6.0.2
102
+ ruby_version: 2.7.5
103
+ rails_version: 6.0.4.7
104
+ - bundle_lint_test:
105
+ name: ruby2-7_rails5-2
106
+ ruby_version: 2.7.5
107
+ rails_version: 5.2.4
108
+ # Ruby 2.6 releases
109
+ - bundle_lint_test:
110
+ name: ruby2-6_rails6-1
111
+ ruby_version: 2.6.9
112
+ rails_version: 6.1.6.1
60
113
  - bundle_lint_test:
61
114
  name: ruby2-6_rails6-0
62
- ruby_version: 2.6.5
63
- rails_version: 6.0.2
115
+ ruby_version: 2.6.9
116
+ rails_version: 6.0.4.7
117
+ - bundle_lint_test:
118
+ name: ruby2-6_rails5-2
119
+ ruby_version: 2.6.9
120
+ rails_version: 5.2.4
121
+ # Ruby 2.5 releases
64
122
  - bundle_lint_test:
65
123
  name: ruby2-5_rails6.0
66
- ruby_version: 2.5.7
67
- rails_version: 6.0.2
124
+ ruby_version: 2.5.9
125
+ rails_version: 6.0.4.7
126
+ - bundle_lint_test:
127
+ name: ruby2-5_rails5-2
128
+ ruby_version: 2.5.9
129
+ rails_version: 5.2.4
data/CONTRIBUTING.md CHANGED
@@ -44,6 +44,10 @@ prevalence of racist language in discussions of predatory
44
44
  publishing](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6148600/) for
45
45
  further details.
46
46
 
47
+ If you're working on PR for this project, create a feature branch off of `main`.
48
+
49
+ Please ***do not*** create a branch called `master` for this repository or as part of your pull request; the branch will either need to be removed or renamed before it can be considered for inclusion in the code base and history of our repositories.
50
+
47
51
  ## Contribution Tasks
48
52
 
49
53
  * Reporting Issues
@@ -67,10 +71,10 @@ further details.
67
71
 
68
72
  * Fork the repository on GitHub
69
73
  * Create a topic branch from where you want to base your work.
70
- * This is usually the master branch.
71
- * To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
72
- * Then checkout the new branch with `git checkout fix/master/my_contribution`.
73
- * Please avoid working directly on the `master` branch.
74
+ * This is usually the main branch.
75
+ * To quickly create a topic branch based on main; `git branch fix/main/my_contribution main`
76
+ * Then checkout the new branch with `git checkout fix/main/my_contribution`.
77
+ * Please avoid working directly on the `main` branch.
74
78
  * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
75
79
  * Make sure you have added sufficient tests and documentation for your changes.
76
80
  * Test functionality with RSpec; Test features / UI with Capybara.
@@ -131,15 +135,15 @@ further details.
131
135
  ### Submitting Changes
132
136
 
133
137
  * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
134
- * Make sure your branch is up to date with its parent branch (i.e. master)
135
- * `git checkout master`
138
+ * Make sure your branch is up to date with its parent branch (i.e. main)
139
+ * `git checkout main`
136
140
  * `git pull --rebase`
137
141
  * `git checkout <your-branch>`
138
- * `git rebase master`
142
+ * `git rebase main`
139
143
  * It is a good idea to run your tests again.
140
144
  * If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
141
145
  * [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
142
- * `git rebase --interactive master` ([See Github help](https://help.github.com/articles/interactive-rebase))
146
+ * `git rebase --interactive main` ([See Github help](https://help.github.com/articles/interactive-rebase))
143
147
  * Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
144
148
  * Push your changes to a topic branch in your fork of the repository.
145
149
  * Submit a pull request from your fork to the project.
data/Gemfile CHANGED
@@ -7,7 +7,13 @@ gemspec path: File.expand_path('..', __FILE__)
7
7
  gem 'byebug' unless ENV['TRAVIS']
8
8
  gem 'pry-byebug' unless ENV['CI']
9
9
 
10
- gem 'activemodel', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
10
+ if ENV['RAILS_VERSION']
11
+ gem 'activemodel', ENV['RAILS_VERSION']
12
+ gem 'rails', ENV['RAILS_VERSION']
13
+ else
14
+ gem 'activemodel', '~> 6.0.4', '< 7'
15
+ gem 'rails', '~> 6.0.4', '< 7'
16
+ end
11
17
 
12
18
  group :test do
13
19
  gem 'simplecov', require: false
data/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # ActiveFedora
2
2
 
3
- Code: [![Version](https://badge.fury.io/rb/active-fedora.png)](http://badge.fury.io/rb/active-fedora)
3
+ Code: [![Samvera Core Component](https://img.shields.io/badge/samvera-core--component-brightgreen)](https://github.com/samvera/maintenance#samvera-core-components)
4
4
  [![Build Status](https://circleci.com/gh/samvera/active_fedora.svg?style=svg)](https://circleci.com/gh/samvera/active_fedora)
5
- [![Coverage Status](https://coveralls.io/repos/github/samvera/active_fedora/badge.svg?branch=master)](https://coveralls.io/github/samvera/active_fedora?branch=master)
5
+ [![Coverage Status](https://coveralls.io/repos/github/samvera/active_fedora/badge.svg?branch=main)](https://coveralls.io/github/samvera/active_fedora?branch=main)
6
+ [![Version](https://img.shields.io/gem/v/active-fedora)](https://rubygems.org/gems/active-fedora)
6
7
 
7
8
  Docs: [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
8
9
  [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
9
10
 
10
- Jump in: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samvera.org/)
11
+ Community Support: [![Samvera Community Slack](https://img.shields.io/badge/samvera-slack-blueviolet)](http://slack.samvera.org/)
11
12
 
12
13
  # What is ActiveFedora?
13
14
 
@@ -101,6 +102,12 @@ is installed, run:
101
102
  rake spec
102
103
  ```
103
104
 
105
+ ## Contributing
106
+
107
+ If you're working on PR for this project, create a feature branch off of `main`.
108
+
109
+ This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct) and [language recommendations](https://github.com/samvera/maintenance/blob/master/templates/CONTRIBUTING.md#language). Please ***do not*** create a branch called `master` for this repository or as part of your pull request; the branch will either need to be removed or renamed before it can be considered for inclusion in the code base and history of this repository.
110
+
104
111
  # Release Process
105
112
 
106
113
  The [release process](https://github.com/samvera/active_fedora/wiki/Release-management-process) is documented on the wiki.
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency 'fcrepo_wrapper', '~> 0.2'
29
29
  s.add_development_dependency "github_changelog_generator"
30
30
  s.add_development_dependency "rdoc"
31
+ s.add_development_dependency "psych", "< 4" # Restricted because 4.0+ do not work with rubocop 0.56.x
31
32
  s.add_development_dependency "rails"
32
33
  s.add_development_dependency "rake"
33
34
  s.add_development_dependency "rspec", "~> 3.5"
@@ -4,7 +4,7 @@ module ActiveFedora
4
4
  module ClassMethods
5
5
  protected
6
6
 
7
- def define_method_attribute(name)
7
+ def define_method_attribute(name, owner: nil)
8
8
  name = name.to_s
9
9
  safe_name = name.unpack('h*'.freeze).first
10
10
  temp_method = "__temp__#{safe_name}"
@@ -4,7 +4,7 @@ module ActiveFedora
4
4
  module ClassMethods
5
5
  protected
6
6
 
7
- def define_method_attribute=(name)
7
+ def define_method_attribute=(name, owner: nil)
8
8
  name = name.to_s
9
9
  safe_name = name.unpack('h*'.freeze).first
10
10
  ActiveFedora::AttributeMethods::AttrNames.set_name_cache safe_name, name
@@ -2,7 +2,7 @@ module ActiveFedora::Core
2
2
  class FedoraIdTranslator
3
3
  SLASH = '/'.freeze
4
4
  def self.call(id)
5
- id = URI.escape(id, '[]'.freeze)
5
+ id = URI::DEFAULT_PARSER.escape(id, '[]'.freeze)
6
6
  id = "/#{id}" unless id.start_with? SLASH
7
7
  unless ActiveFedora.fedora.base_path == SLASH || id.start_with?("#{ActiveFedora.fedora.base_path}/")
8
8
  id = ActiveFedora.fedora.base_path + id
@@ -174,7 +174,7 @@ module ActiveFedora
174
174
 
175
175
  def ldp_headers
176
176
  headers = { 'Content-Type'.freeze => mime_type, 'Content-Length'.freeze => content.size.to_s }
177
- headers['Content-Disposition'.freeze] = "attachment; filename=\"#{URI.encode(@original_name)}\"" if @original_name
177
+ headers['Content-Disposition'.freeze] = "attachment; filename=\"#{URI::DEFAULT_PARSER.escape(@original_name)}\"" if @original_name
178
178
  headers
179
179
  end
180
180
 
@@ -9,7 +9,8 @@ module ActiveFedora
9
9
  end
10
10
 
11
11
  def default_sort_params
12
- [indexer.create_time_solr_name + ' asc']
12
+ [ActiveFedora.index_field_mapper.solr_name('system_create', :stored_sortable, type: :date) +
13
+ ' asc']
13
14
  end
14
15
  end
15
16
  end
@@ -8,7 +8,7 @@ module ActiveFedora
8
8
  MAX_ROWS = 10_000
9
9
 
10
10
  def initialize(options = {})
11
- @options = { read_timeout: 120, open_timeout: 120, url: 'http://localhost:8080/solr' }.merge(options)
11
+ @options = { timeout: 120, open_timeout: 120, url: 'http://localhost:8080/solr' }.merge(options)
12
12
  end
13
13
 
14
14
  def conn
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveFedora
4
- VERSION = '13.2.4'
4
+ VERSION = '13.3.0'
5
5
  end
@@ -21,6 +21,6 @@ module ActiveFedora::WithMetadata
21
21
  property :date_modified, predicate: ::RDF::Vocab::EBUCore.dateModified
22
22
  property :byte_order, predicate: SweetJPLTerms.byteOrder
23
23
  # This is a server-managed predicate which means Fedora does not let us change it.
24
- property :file_hash, predicate: ::RDF::Vocab::PREMIS.hasMessageDigest
24
+ property :file_hash, predicate: ::RDF::Vocab::PREMIS.hasMessageDigest, server_managed: true
25
25
  end
26
26
  end
@@ -1,6 +1,6 @@
1
1
  module ActiveFedora::WithMetadata
2
2
  class DefaultStrategy < ActiveTriples::ExtensionStrategy
3
- # override apply method to check if property already exists or reciever already has predicate defined.
3
+ # override apply method to check if property already exists or receiver already has predicate defined.
4
4
  # Do not add property if the rdf_resource already responds to the property name
5
5
  # Do not add property if the rdf_resource already has a property with the same predicate.
6
6
  def self.apply(resource, property)
@@ -33,7 +33,7 @@ module ActiveFedora
33
33
 
34
34
  def set_value(*args)
35
35
  super
36
- attribute_will_change! args.first
36
+ attribute_will_change! args.first unless server_managed_properties.include?(args.first)
37
37
  end
38
38
 
39
39
  def ldp_source
@@ -70,6 +70,10 @@ module ActiveFedora
70
70
  ChangeSet.new(self, self, changed_attributes.keys).changes
71
71
  end
72
72
 
73
+ def server_managed_properties
74
+ @server_managed_properties ||= properties.select { |k,v| v[:server_managed] }.keys.map(&:to_sym)
75
+ end
76
+
73
77
  class << self
74
78
  attr_writer :parent_class
75
79
 
data/lib/active_fedora.rb CHANGED
@@ -11,9 +11,11 @@ require 'active_triples'
11
11
  # Monkey patching RDF::Literal::DateTime to support fractional seconds.
12
12
  # See https://github.com/samvera/active_fedora/issues/497
13
13
  # Also monkey patches in a fix for timezones to be stored properly.
14
+ # This is needed in both RDF <= 3.2.4 and RDF >= 3.2.5
15
+ # TODO: Figure out how to contribute something upstream to avoid monkey-patching
14
16
  module RDF
15
17
  class Literal
16
- class DateTime < Literal
18
+ class DateTime
17
19
  ALTERNATIVE_FORMAT = '%Y-%m-%dT%H:%M:%S'.freeze
18
20
  DOT = '.'.freeze
19
21
  EMPTY = ''.freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.2.4
4
+ version: 13.3.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: 2021-05-17 00:00:00.000000000 Z
13
+ date: 2022-07-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
@@ -212,6 +212,20 @@ dependencies:
212
212
  - - ">="
213
213
  - !ruby/object:Gem::Version
214
214
  version: '0'
215
+ - !ruby/object:Gem::Dependency
216
+ name: psych
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - "<"
220
+ - !ruby/object:Gem::Version
221
+ version: '4'
222
+ type: :development
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - "<"
227
+ - !ruby/object:Gem::Version
228
+ version: '4'
215
229
  - !ruby/object:Gem::Dependency
216
230
  name: rails
217
231
  requirement: !ruby/object:Gem::Requirement
@@ -604,7 +618,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
604
618
  - !ruby/object:Gem::Version
605
619
  version: '0'
606
620
  requirements: []
607
- rubygems_version: 3.1.4
621
+ rubygems_version: 3.0.3
608
622
  signing_key:
609
623
  specification_version: 4
610
624
  summary: A convenience libary for manipulating documents in the Fedora Repository.