Skip to content

Commit

Permalink
Support Rails 7.1 (#138)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Qualie <[email protected]>
  • Loading branch information
mohammed-io and marcqualie authored May 26, 2024
1 parent 09f2b26 commit eb5c96f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion diffcrypt.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
spec.executables = %w[diffcrypt]
spec.require_paths = ['lib']

spec.add_runtime_dependency 'activesupport', '>= 6.0', '< 7.1'
spec.add_runtime_dependency 'activesupport', '>= 6.0', '< 7.2'
spec.add_runtime_dependency 'thor', '>= 0.20', '< 2'
spec.metadata['rubygems_mfa_required'] = 'true'
end
1 change: 1 addition & 0 deletions lib/diffcrypt/encryptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require 'securerandom'
require 'yaml'

require 'active_support' # NOTE: This is required because of a bug in 7.1 which needs deprecation libs
require 'active_support/message_encryptor'

require_relative './version'
Expand Down
8 changes: 8 additions & 0 deletions lib/diffcrypt/rails/encrypted_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ def key
read_env_key || read_key_file || handle_missing_key
end

# It's required since the commit https://github.com/rails/rails/commit/1740b1f2cb8104435b6041ec6bfaabe58a6d74e6
# Returns truthy if #key is truthy. Returns falsy otherwise. Unlike #key,
# does not raise MissingKeyError when +raise_if_missing_key+ is true.
# @return [Boolean]
def key?
!!(read_env_key || read_key_file)
end

def change(&block)
writing read, &block
end
Expand Down
3 changes: 2 additions & 1 deletion test/rails_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

RAILS_VERSIONS = %w[
6.1.7.7
7.0.8.1
7.0.8.3
7.1.3.3
].freeze

RAILS_FLAGS = %w[
Expand Down

0 comments on commit eb5c96f

Please sign in to comment.