Skip to content
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
16 changes: 13 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,24 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
gemfile: ['7.0_stable', '7.1_stable', '7.2_stable', '8.0_stable']
ruby-version: ['3.1', '3.2', '3.3']
gemfile:
- '7.2_stable'
- '8.0_stable'
- '8.1_stable'
ruby-version:
- '3.1'
- '3.2'
- '3.3'
- '3.4'
- '4.0'
exclude:
- ruby-version: '3.1'
gemfile: '8.0_stable'
- ruby-version: '3.1'
gemfile: '8.1_stable'
services:
mysql:
image: mysql:5.7
image: mysql:8.4
ports:
- 3306:3306
env:
Expand Down
14 changes: 4 additions & 10 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
# frozen_string_literal: true

appraise '7.0-stable' do
gem 'activerecord', '~> 7.0.0'
gem 'sqlite3', '~> 1.7.0'
end

appraise '7.1-stable' do
gem 'activerecord', '~> 7.1.0'
gem 'sqlite3', '~> 1.7.0'
end

appraise '7.2-stable' do
gem 'activerecord', '~> 7.2.0'
end

appraise '8.0-stable' do
gem 'activerecord', '~> 8.0.0'
end

appraise '8.1-stable' do
gem 'activerecord', '~> 8.1.0'
end
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Unreleased

- Drop Rails 6.1 support #36
- Updated the CI environment by removing deprecated dependencies and adding support for Ruby 4.0, Rails 8.1, and MySQL 8.4. #38

## 1.0.0

Expand Down
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in activerecord_encryption.gemspec
gemspec

gem 'appraisal'
gem 'minitest'
gem 'mysql2'
gem 'rake'
gem 'rspec'
gem 'rubocop'
gem 'sqlite3'
51 changes: 0 additions & 51 deletions Guardfile

This file was deleted.

13 changes: 1 addition & 12 deletions active_record_encryption.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,5 @@ Gem::Specification.new do |spec|
LICENSE.txt
] + Dir['lib/**/*.rb']

spec.add_dependency 'activerecord', '>= 7.0'

spec.add_development_dependency 'appraisal'
spec.add_development_dependency 'guard-rspec'
spec.add_development_dependency 'guard-rubocop'
spec.add_development_dependency 'minitest'
spec.add_development_dependency 'mysql2'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'sqlite3'
spec.add_dependency 'activerecord', '>= 7.2'
end
6 changes: 2 additions & 4 deletions docker-compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
version: '3'
services:
db:
platform: linux/x86_64
image: mysql:5.7
image: mysql:8.4
volumes:
- db:/var/lib/mysql
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
volumes:
Expand Down
8 changes: 0 additions & 8 deletions gemfiles/7.0_stable.gemfile

This file was deleted.

8 changes: 0 additions & 8 deletions gemfiles/7.1_stable.gemfile

This file was deleted.

7 changes: 7 additions & 0 deletions gemfiles/7.2_stable.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

source "https://rubygems.org"

gem "appraisal"
gem "minitest"
gem "mysql2"
gem "rake"
gem "rspec"
gem "rubocop"
gem "sqlite3"
gem "activerecord", "~> 7.2.0"

gemspec path: "../"
7 changes: 7 additions & 0 deletions gemfiles/8.0_stable.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

source "https://rubygems.org"

gem "appraisal"
gem "minitest"
gem "mysql2"
gem "rake"
gem "rspec"
gem "rubocop"
gem "sqlite3"
gem "activerecord", "~> 8.0.0"

gemspec path: "../"
14 changes: 14 additions & 0 deletions gemfiles/8.1_stable.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "minitest"
gem "mysql2"
gem "rake"
gem "rspec"
gem "rubocop"
gem "sqlite3"
gem "activerecord", "~> 8.1.0"

gemspec path: "../"
20 changes: 4 additions & 16 deletions lib/active_record_encryption/quoter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,15 @@ 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
# Cast value to string
def type_cast(value)
return value.to_s if value.is_a?(Numeric)
super(value)
end

# @return [Symbol]
def default_timezone
ActiveRecord::Base.connection.default_timezone
end

private

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
2 changes: 0 additions & 2 deletions lib/active_record_encryption/type/binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module ActiveRecordEncryption
class Type
class Binary < ActiveModel::Type::Binary
def cast(value)
return super if ActiveRecord::VERSION::STRING < '7.0.0'

if value.is_a?(Data)
value.to_s
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ def new_cipher
let(:cipher) { 'aes-256-gcm' }

it 'builds aes-256-gcm encryptor' do
expected = if RUBY_VERSION >= '3.1.0'
'AES-256-GCM'
else
'id-aes256-GCM'
end

expect(new_cipher.name).to eq(expected)
expect(new_cipher.name).to eq('AES-256-GCM')
end
end

Expand Down
6 changes: 1 addition & 5 deletions spec/active_record_encryption/quoter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
subject { described_class.instance.type_cast(value) }

def to_s(value, *args)
if ActiveRecord::VERSION::MAJOR >= 7
value.to_fs(*args)
else
value.to_s(*args)
end
value.to_fs(*args)
end

context 'given string' do
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'bundler/setup'
require 'pry'
require 'active_record_encryption'
require 'active_record'
require 'minitest'
Expand Down
2 changes: 1 addition & 1 deletion spec/support/activerecord.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Mysql2Adapter < ActiveRecord::Base
adapter: 'mysql2',
database: ENV.fetch('ACTIVERECORD_ENCRYPTION_DBNAME', 'active_record_encryption'),
username: ENV.fetch('ACTIVERECORD_ENCRYPTION_USERNAME', 'root'),
password: ENV.fetch('ACTIVERECORD_ENCRYPTION_PASSWORD', ''),
password: ENV.fetch('ACTIVERECORD_ENCRYPTION_PASSWORD', 'password'),
host: ENV.fetch('ACTIVERECORD_ENCRYPTION_HOST', '127.0.0.1'),
}.freeze

Expand Down