Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby3 Support #1489

Merged
merged 13 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 102 additions & 50 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,45 +47,71 @@ jobs:
workflows:
ci:
jobs:
# Ruby 3.2 releases
- bundle_lint_test:
name: ruby3-2_rails7-0
ruby_version: 3.2.0
rails_version: 7.0.4.1
- bundle_lint_test:
name: ruby3-2_rails6-1
ruby_version: 3.2.0
rails_version: 6.1.7.1
- bundle_lint_test:
name: ruby3-2_rails6-0
ruby_version: 3.2.0
rails_version: 6.0.6.1
# Ruby 3.1 releases
- bundle_lint_test:
name: ruby3-1_rails7-0
ruby_version: 3.1.3
rails_version: 7.0.4.1
- bundle_lint_test:
name: ruby3-1_rails6-1
ruby_version: 3.1.3
rails_version: 6.1.7.1
- bundle_lint_test:
name: ruby3-1_rails6-0
ruby_version: 3.1.3
rails_version: 6.0.6.1
# Ruby 3.0 releases
- bundle_lint_test:
name: ruby3-0_rails7-0
ruby_version: 3.0.5
rails_version: 7.0.4.1
- bundle_lint_test:
name: ruby3-0_rails6-1
ruby_version: 3.0.5
rails_version: 6.1.7.1
- bundle_lint_test:
name: ruby3-0_rails6-0
ruby_version: 3.0.5
rails_version: 6.0.6.1
# Ruby 2.7 releases
- bundle_lint_test:
name: ruby2-7_rails7-0
ruby_version: 2.7.5
rails_version: 7.0.3.1
ruby_version: 2.7.7
rails_version: 7.0.4.1
- bundle_lint_test:
name: ruby2-7_rails6-1
ruby_version: 2.7.5
rails_version: 6.1.6.1
ruby_version: 2.7.7
rails_version: 6.1.7.1
- bundle_lint_test:
name: ruby2-7_rails6-0
ruby_version: 2.7.5
rails_version: 6.0.4.7
ruby_version: 2.7.7
rails_version: 6.0.6.1
- bundle_lint_test:
name: ruby2-7_rails5-2
ruby_version: 2.7.5
rails_version: 5.2.4
ruby_version: 2.7.7
rails_version: 5.2.8.1
# Ruby 2.6 releases
- bundle_lint_test:
name: ruby2-6_rails6-1
ruby_version: 2.6.9
rails_version: 6.1.6.1
- bundle_lint_test:
name: ruby2-6_rails6-0
ruby_version: 2.6.9
rails_version: 6.0.4.7
ruby_version: 2.6.10
rails_version: 6.0.6.1
- bundle_lint_test:
name: ruby2-6_rails5-2
ruby_version: 2.6.9
rails_version: 5.2.4
# Ruby 2.5 releases
- bundle_lint_test:
name: ruby2-5_rails6.0
ruby_version: 2.5.9
rails_version: 6.0.4.7
- bundle_lint_test:
name: ruby2-5_rails5-2
ruby_version: 2.5.9
rails_version: 5.2.4
ruby_version: 2.6.10
rails_version: 5.2.8.1

nightly:
triggers:
Expand All @@ -96,42 +122,68 @@ workflows:
only:
- main
jobs:
# Ruby 3.2 releases
- bundle_lint_test:
name: ruby3-2_rails7-0
ruby_version: 3.2.0
rails_version: 7.0.4.1
- bundle_lint_test:
name: ruby3-2_rails6-1
ruby_version: 3.2.0
rails_version: 6.1.7.1
- bundle_lint_test:
name: ruby3-2_rails6-0
ruby_version: 3.2.0
rails_version: 6.0.6.1
# Ruby 3.1 releases
- bundle_lint_test:
name: ruby3-1_rails7-0
ruby_version: 3.1.3
rails_version: 7.0.4.1
- bundle_lint_test:
name: ruby3-1_rails6-1
ruby_version: 3.1.3
rails_version: 6.1.7.1
- bundle_lint_test:
name: ruby3-1_rails6-0
ruby_version: 3.1.3
rails_version: 6.0.6.1
# Ruby 3.0 releases
- bundle_lint_test:
name: ruby3-0_rails7-0
ruby_version: 3.0.5
rails_version: 7.0.4.1
- bundle_lint_test:
name: ruby3-0_rails6-1
ruby_version: 3.0.5
rails_version: 6.1.7.1
- bundle_lint_test:
name: ruby3-0_rails6-0
ruby_version: 3.0.5
rails_version: 6.0.6.1
# Ruby 2.7 releases
- bundle_lint_test:
name: ruby2-7_rails7-0
ruby_version: 2.7.5
rails_version: 7.0.3.1
ruby_version: 2.7.7
rails_version: 7.0.4.1
- bundle_lint_test:
name: ruby2-7_rails6-1
ruby_version: 2.7.5
rails_version: 6.1.6.1
ruby_version: 2.7.7
rails_version: 6.1.7.1
- bundle_lint_test:
name: ruby2-7_rails6-0
ruby_version: 2.7.5
rails_version: 6.0.4.7
ruby_version: 2.7.7
rails_version: 6.0.6.1
- bundle_lint_test:
name: ruby2-7_rails5-2
ruby_version: 2.7.5
rails_version: 5.2.4
ruby_version: 2.7.7
rails_version: 5.2.8.1
# Ruby 2.6 releases
- bundle_lint_test:
name: ruby2-6_rails6-1
ruby_version: 2.6.9
rails_version: 6.1.6.1
- bundle_lint_test:
name: ruby2-6_rails6-0
ruby_version: 2.6.9
rails_version: 6.0.4.7
ruby_version: 2.6.10
rails_version: 6.0.6.1
- bundle_lint_test:
name: ruby2-6_rails5-2
ruby_version: 2.6.9
rails_version: 5.2.4
# Ruby 2.5 releases
- bundle_lint_test:
name: ruby2-5_rails6.0
ruby_version: 2.5.9
rails_version: 6.0.4.7
- bundle_lint_test:
name: ruby2-5_rails5-2
ruby_version: 2.5.9
rails_version: 5.2.4
ruby_version: 2.6.10
rails_version: 5.2.8.1
38 changes: 26 additions & 12 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
require: rubocop-rspec
inherit_gem:
bixby: bixby_default.yml

inherit_from:
- .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.2
DisplayCopNames: true
Include:
- '**/Rakefile'
Exclude:
- 'script/**/*'
- 'vendor/**/*'
Style/FrozenStringLiteralComment:
Enabled: false

Lint/HandleExceptions:
Lint/SuppressedException:
Exclude:
- 'spec/unit/**/*'
- 'spec/integration/**/*'
Expand All @@ -22,12 +17,19 @@ Lint/HandleExceptions:
Lint/AssignmentInCondition:
Enabled: false

Metrics/LineLength:
Layout/LineLength:
Enabled: false

Metrics/AbcSize:
Enabled: false

Metrics/BlockLength:
Exclude:
- 'lib/active_fedora.rb'
- 'lib/active_fedora/nested_attributes.rb'
- 'lib/active_fedora/rspec_matchers/**/*'
- 'lib/tasks/**/*'

Metrics/BlockNesting:
Exclude:
- 'lib/active_fedora/autosave_association.rb'
Expand Down Expand Up @@ -173,7 +175,7 @@ Style/Lambda:
- 'spec/**/*'

Layout/IndentationConsistency:
EnforcedStyle: rails
EnforcedStyle: indented_internal_methods

Style/CollectionMethods:
PreferredMethods:
Expand Down Expand Up @@ -240,6 +242,15 @@ Rails/Date:
Rails/TimeZone:
Enabled: false

Rails/FilePath:
Enabled: false

Rails/ActiveRecordAliases:
Enabled: false

Rails/SkipsModelValidations:
Enabled: false

RSpec/AnyInstance:
Enabled: false

Expand Down Expand Up @@ -271,3 +282,6 @@ RSpec/NotToNot:

RSpec/MessageSpies:
Enabled: false

Security/MarshalLoad:
Enabled: false
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Style/PercentLiteralDelimiters:
# Offense count: 1
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Layout/LineLength:
Max: 82
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ else
end

group :test do
gem 'simplecov', require: false
gem 'coveralls', require: false
gem 'rspec_junit_formatter'
gem 'simplecov', require: false
end

gem 'jruby-openssl', platform: :jruby
17 changes: 8 additions & 9 deletions active-fedora.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "active_fedora/version"

Gem::Specification.new do |s|
Expand All @@ -8,11 +9,11 @@ Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.authors = ["Matt Zumwalt", "McClain Looney", "Justin Coyne"]
s.email = ["samvera-tech@googlegroups.com"]
s.homepage = %q{https://github.com/samvera/active_fedora}
s.summary = %q{A convenience libary for manipulating documents in the Fedora Repository.}
s.description = %q{ActiveFedora provides for creating and managing objects in the Fedora Repository Architecture.}
s.homepage = 'https://github.com/samvera/active_fedora'
s.summary = 'A convenience libary for manipulating documents in the Fedora Repository.'
s.description = 'ActiveFedora provides for creating and managing objects in the Fedora Repository Architecture.'
s.license = "Apache-2.0"
s.required_ruby_version = '>= 2.4'
s.required_ruby_version = '>= 2.6'
cjcolvar marked this conversation as resolved.
Show resolved Hide resolved
dlpierce marked this conversation as resolved.
Show resolved Hide resolved

s.add_dependency "activemodel", '>= 5.1'
s.add_dependency "activesupport", '>= 5.1'
Expand All @@ -24,23 +25,21 @@ Gem::Specification.new do |s|
s.add_dependency 'rsolr', '>= 1.1.2', '< 3'
s.add_dependency "ruby-progressbar", '~> 1.0'

s.add_development_dependency "bixby"
s.add_development_dependency "equivalent-xml"
s.add_development_dependency 'fcrepo_wrapper', '~> 0.2'
s.add_development_dependency "github_changelog_generator"
s.add_development_dependency "rdoc"
s.add_development_dependency "psych", "< 4" # Restricted because 4.0+ do not work with rubocop 0.56.x
s.add_development_dependency "rails"
s.add_development_dependency "rake"
s.add_development_dependency "rspec", "~> 3.5"
s.add_development_dependency "rspec-its"
s.add_development_dependency "rubocop", '~> 0.56.0'
s.add_development_dependency "rubocop-rspec", '~> 1.12.0'
s.add_development_dependency "simplecov", '~> 0.8'
s.add_development_dependency "solr_wrapper", "~> 4.0"
s.add_development_dependency "yard"

s.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR).select { |f| File.dirname(f) !~ %r{\A"?spec\/?} }
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.extra_rdoc_files = [
"LICENSE",
"README.md"
Expand Down
12 changes: 5 additions & 7 deletions lib/active_fedora.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def to_s
@string ||= begin
# Show nanoseconds but remove trailing zeros
nano = @object.strftime('%N').sub(/0+\Z/, EMPTY)
nano = DOT + nano unless nano.blank?
nano = DOT + nano if nano.present?
@object.strftime(ALTERNATIVE_FORMAT) + nano + @object.strftime(TIMEZONE_FORMAT)
end
end
end
end
end

module ActiveFedora #:nodoc:
module ActiveFedora # :nodoc:
extend ActiveSupport::Autoload

eager_autoload do
Expand Down Expand Up @@ -156,7 +156,7 @@ module Scoping
end

class << self
attr_reader :fedora_config, :solr_config, :config_options
attr_reader :solr_config, :config_options
attr_accessor :configurator

def fedora_config
Expand All @@ -174,9 +174,7 @@ def init(options = {})
options = {} if options.nil?
# For backwards compatibility, handle cases where config_path (a String) is passed in as the argument rather than a config_options hash
# In all other cases, set config_path to config_options[:config_path], which is ok if it's nil
if options.is_a? String
raise ArgumentError, "Calling ActiveFedora.init with a path as an argument has been removed. Use ActiveFedora.init(:fedora_config_path=>#{options})"
end
raise ArgumentError, "Calling ActiveFedora.init with a path as an argument has been removed. Use ActiveFedora.init(:fedora_config_path=>#{options})" if options.is_a? String
@fedora_config = nil
SolrService.reset!
configurator.init(options)
Expand All @@ -199,7 +197,7 @@ def config
def environment
if config_options.fetch(:environment, nil)
config_options[:environment]
elsif defined?(Rails.env) && !Rails.env.nil?
elsif defined?(Rails.env) && !Rails.env.nil? # rubocop:disable Rails/UnknownEnv
Rails.env.to_s
elsif defined?(ENV['environment']) && !ENV['environment'].nil?
ENV['environment']
Expand Down
Loading