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

EOL Ruby and Rails no longer supported #29

Merged
merged 7 commits into from
Jun 3, 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
18 changes: 8 additions & 10 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ AllCops:
- '**/Rakefile'
- '**/config.ru'
- 'node_modules/**/*'
TargetRubyVersion: 2.5
- 'gemfiles/**/*'
DisabledByDefault: true
TargetRubyVersion: 3.0
DisplayCopNames: true

Performance:
Enabled: false

Bundler:
Enabled: false

Expand All @@ -24,7 +23,7 @@ Metrics/BlockNesting:
Metrics/ClassLength:
Enabled: false

Metrics/LineLength:
Layout/LineLength:
Enabled: false

Metrics/MethodLength:
Expand All @@ -39,10 +38,6 @@ Metrics/ModuleLength:
Style/AsciiComments:
Enabled: false

Style/BlockDelimiters:
Exclude:
- 'spec/**/*'

Style/Documentation:
Enabled: false

Expand All @@ -67,11 +62,14 @@ Style/NumericPredicate:
Style/Lambda:
Enabled: false

Layout/AlignParameters:
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

Lint/AmbiguousRegexpLiteral:
Enabled: false

Lint/MissingSuper:
Enabled: false
22 changes: 4 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,13 @@ language: ruby
services:
- mysql
rvm:
- 2.5.8
- 2.6.6
- 2.7.2
- 3.0.0
- 3.0.6
- 3.1.4
- 3.2.2
before_install: gem install bundler
gemfile:
- gemfiles/5.0_stable.gemfile
- gemfiles/5.1_stable.gemfile
- gemfiles/5.2_stable.gemfile
- gemfiles/6.0_stable.gemfile
- gemfiles/6.1_stable.gemfile
matrix:
exclude:
- rvm: 3.0.0
gemfile: gemfiles/5.0_stable.gemfile
- rvm: 3.0.0
gemfile: gemfiles/5.1_stable.gemfile
- rvm: 3.0.0
gemfile: gemfiles/5.2_stable.gemfile
- rvm: 3.0.0
gemfile: gemfiles/6.0_stable.gemfile
- gemfiles/7.0_stable.gemfile
script:
- bundle exec rspec
- bundle exec rubocop
Expand Down
19 changes: 1 addition & 18 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
# frozen_string_literal: true

appraise '5.0-stable' do
gem 'activerecord', '~> 5.0.0'
gem 'sqlite3', '~> 1.3.0'
end

appraise '5.1-stable' do
gem 'activerecord', '~> 5.1.0'
end

appraise '5.2-stable' do
gem 'activerecord', '~> 5.2.0'
end

appraise '6.0-stable' do
gem 'activerecord', '~> 6.0.0'
end

appraise '6.1-stable' do
gem 'activerecord', '~> 6.1.0'
end

appraise '7.0-stable' do
gem 'activerecord', '7.0.0.alpha2'
gem 'activerecord', '~> 7.0.0'
end
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 0.3.1
## Unreleased

- EOL Ruby and Rails no longer supported #29
- Requires Ruby 3.0.0 or newer.
- Requires Rails 6.1.0 or newer.
- Support rails 7.0.0 #25

## 0.3.0
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ end

```bash
bundle exec appraisal install
bundle exec appraisal 5.0-stable rspec
bundle exec appraisal 5.1-stable rspec
bundle exec appraisal 5.2-stable rspec
bundle exec appraisal 6.1-stable rspec
bundle exec appraisal 7.0-stable rspec
```

## Contributing
Expand Down
3 changes: 2 additions & 1 deletion active_record_encryption.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
spec.license = 'MIT'

spec.require_paths = ['lib']
spec.required_ruby_version = '>= 3.0.0'

spec.files = %w[
CHANGELOG.md
Expand All @@ -24,7 +25,7 @@ Gem::Specification.new do |spec|
LICENSE.txt
] + Dir['lib/**/*.rb']

spec.add_dependency 'activerecord', '>= 5.0'
spec.add_dependency 'activerecord', '>= 6.1'

spec.add_development_dependency 'appraisal'
spec.add_development_dependency 'guard-rspec'
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3'
services:
db:
platform: linux/x86_64
image: mysql:5.7
volumes:
- db:/var/lib/mysql
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
ports:
- 3306:3306
volumes:
db:
8 changes: 0 additions & 8 deletions gemfiles/5.0_stable.gemfile

This file was deleted.

7 changes: 0 additions & 7 deletions gemfiles/5.1_stable.gemfile

This file was deleted.

7 changes: 0 additions & 7 deletions gemfiles/5.2_stable.gemfile

This file was deleted.

7 changes: 0 additions & 7 deletions gemfiles/6.0_stable.gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion gemfiles/7.0_stable.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

source "https://rubygems.org"

gem "activerecord", "7.0.0.alpha2"
gem "activerecord", "~> 7.0.0"

gemspec path: "../"
18 changes: 14 additions & 4 deletions lib/active_record_encryption/quoter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,22 @@ def unquoted_false
'f'
end

if ActiveRecord::VERSION::MAJOR >= 7
# Cast value to string
def type_cast(value)
return value.to_s if value.is_a?(Numeric)
super(value)
end
end

private

# Cast value to string
def _type_cast(value)
return value.to_s if value.is_a?(Numeric)
super(value)
if ActiveRecord::VERSION::MAJOR < 7
# Cast value to string
def _type_cast(value)
return value.to_s if value.is_a?(Numeric)
super(value)
end
end
end
end
43 changes: 0 additions & 43 deletions lib/active_record_encryption/serializer_with_cast.rb

This file was deleted.

4 changes: 0 additions & 4 deletions lib/active_record_encryption/type.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# frozen_string_literal: true

require 'active_record_encryption/serializer_with_cast'

module ActiveRecordEncryption
class Type < ActiveRecord::Type::Value
using(ActiveRecordEncryption::SerializerWithCast)

delegate :type, :cast, to: :subtype
delegate :user_input_in_time_zone, to: :subtype # for ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ def new_cipher
let(:cipher) { 'aes-256-gcm' }

it 'builds aes-256-gcm encryptor' do
expect(new_cipher.name).to eq('id-aes256-GCM')
expected = if RUBY_VERSION >= '3.1.0'
'AES-256-GCM'
else
'id-aes256-GCM'
end

expect(new_cipher.name).to eq(expected)
end
end

Expand Down