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

Remove symbiont runtime dependency #39

Merged
merged 6 commits into from
Sep 5, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2"]
ruby: ["3.0", "3.1", "3.2", "3.3"]

name: ${{ matrix.ruby }}

Expand Down
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ inherit_gem:

AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0

Naming/FileName:
Exclude:
- lib/umbrellio-sequel-plugins.rb

RSpec/SpecFilePathFormat:
Enabled: false
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ gem "rspec"
gem "rubocop-config-umbrellio"
gem "simplecov"
gem "simplecov-lcov"
gem "symbiont-ruby"
128 changes: 75 additions & 53 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,104 +1,124 @@
PATH
remote: .
specs:
umbrellio-sequel-plugins (0.15.0)
umbrellio-sequel-plugins (0.16.0)
sequel
symbiont-ruby

GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.6)
activesupport (7.1.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
ast (2.4.2)
async (1.31.0)
console (~> 1.10)
nio4r (~> 2.3)
timers (~> 4.1)
base64 (0.2.0)
bigdecimal (3.1.8)
coderay (1.1.3)
concurrent-ruby (1.2.2)
console (1.17.2)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
console (1.24.0)
fiber-annotation
fiber-local
diff-lcs (1.5.0)
docile (1.4.0)
json
diff-lcs (1.5.1)
docile (1.4.1)
drb (2.2.1)
fiber-annotation (0.2.0)
fiber-local (1.0.0)
i18n (1.14.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
json (2.6.3)
method_source (1.0.0)
minitest (5.18.1)
money (6.16.0)
json (2.7.2)
language_server-protocol (3.17.0.3)
method_source (1.1.0)
minitest (5.25.1)
money (6.19.0)
i18n (>= 0.6.4, <= 2)
nio4r (2.5.9)
parallel (1.23.0)
parser (3.2.2.3)
mutex_m (0.2.0)
nio4r (2.7.3)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
pg (1.5.3)
pg (1.5.7)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.7.1)
rack (3.0.8)
racc (1.8.1)
rack (3.1.7)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.8.1)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
rake (13.2.1)
regexp_parser (2.9.2)
rexml (3.3.7)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.50.2)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.63.5)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.18.0)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-config-umbrellio (1.50.0.85)
rubocop (~> 1.50.0)
rubocop-performance (~> 1.17.0)
rubocop-rails (~> 2.19.0)
rubocop-config-umbrellio (1.63.0.93)
rubocop (~> 1.63.0)
rubocop-performance (~> 1.21.0)
rubocop-rails (~> 2.24.0)
rubocop-rake (~> 0.6.0)
rubocop-rspec (~> 2.20.0)
rubocop-rspec (~> 2.29.0)
rubocop-sequel (~> 0.3.3)
rubocop-performance (1.17.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.19.1)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.24.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.20.0)
rubocop (~> 1.33)
rubocop-rspec (2.29.2)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.29.1)
rubocop (~> 1.61)
rubocop-sequel (0.3.4)
rubocop (~> 1.0)
ruby-progressbar (1.13.0)
sequel (5.70.0)
sequel (5.84.0)
bigdecimal
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -110,10 +130,11 @@ GEM
timers (4.3.5)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
unicode-display_width (2.5.0)

PLATFORMS
ruby
arm64-darwin-23
x86_64-linux

DEPENDENCIES
async (= 1.31.0)
Expand All @@ -125,7 +146,8 @@ DEPENDENCIES
rubocop-config-umbrellio
simplecov
simplecov-lcov
symbiont-ruby
umbrellio-sequel-plugins!

BUNDLED WITH
2.4.15
2.5.18
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ DB.synchronize_with([:ruby, :forever]) { p "Hey, I'm in transaction!"; sleep 5 }

## Methods in Migrations

Enable: `Sequel.extension(:methods_in_migrations)`
Enable: `Sequel.extension(:methods_in_migrations)`. Also, you will need to add and require `symbiont-ruby` gem.

Support for method definitions and invocations inside `Sequel.migration`.

Expand Down
14 changes: 7 additions & 7 deletions lib/sequel/plugins/attr_encrypted.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@ def attr_encrypted(*attrs, key:)

def define_encrypted_setter(attr, key)
@_attr_encrypted_module.module_eval do
define_method("#{attr}=") do |value|
instance_variable_set("@#{attr}", value)
define_method(:"#{attr}=") do |value|
instance_variable_set(:"@#{attr}", value)

send("encrypted_#{attr}=", SimpleCrypt.encrypt(value.to_json, key))
send(:"encrypted_#{attr}=", SimpleCrypt.encrypt(value.to_json, key))
end
end
end

def define_encrypted_getter(attr, key)
@_attr_encrypted_module.module_eval do
define_method(attr.to_s) do
instance_variable_get("@#{attr}") || begin
decrypted = SimpleCrypt.decrypt(send("encrypted_#{attr}"), key)
instance_variable_get(:"@#{attr}") || begin
decrypted = SimpleCrypt.decrypt(send(:"encrypted_#{attr}"), key)

result = decrypted.nil? ? decrypted : JSON.parse(decrypted)
instance_variable_set("@#{attr}", result)
instance_variable_set(:"@#{attr}", result)
end
end
end
Expand Down Expand Up @@ -91,7 +91,7 @@ def refresh(*)

def _reset_encrypted_attrs_ivars
self.class.instance_variable_get(:@_encrypted_attributes)&.each do |attr|
instance_variable_set("@#{attr}", nil)
instance_variable_set(:"@#{attr}", nil)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/sequel/plugins/money_accessors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def money_getter(amount_column, currency_column)
def money_setter(amount_column, currency_column)
include_accessors_module!
@_money_accessors_module.module_eval do
define_method("#{amount_column}=") do |value|
define_method(:"#{amount_column}=") do |value|
case value
when Money
amount = value.to_d
Expand All @@ -52,7 +52,7 @@ def money_setter(amount_column, currency_column)
end

super(amount)
send("#{currency_column}=", currency)
send(:"#{currency_column}=", currency)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/sequel/plugins/store_accessors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def define_store_getter(column, field)

def define_store_setter(column, field)
@_store_accessors_module.module_eval do
define_method("#{field}=") do |value|
send("#{column}=", send(column).to_h.merge(field.to_s => value))
define_method(:"#{field}=") do |value|
send(:"#{column}=", send(column).to_h.merge(field.to_s => value))
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

require_relative "../utils/database"

Dir["#{__dir__}/../lib/sequel/**/*.rb"].sort.each { |f| require f }
Dir["#{__dir__}/../lib/sequel/**/*.rb"].each { |f| require f }

RSpec.configure do |config|
config.example_status_persistence_file_path = ".rspec_status"
Expand Down
5 changes: 2 additions & 3 deletions umbrellio-sequel-plugins.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |spec|
gem_version = "0.15.0"
gem_version = "0.16.0"

if ENV.fetch("PUBLISH_JOB", nil)
release_version = "#{gem_version}.#{ENV.fetch("GITHUB_RUN_NUMBER")}"
end

spec.name = "umbrellio-sequel-plugins"
spec.version = release_version || gem_version
spec.required_ruby_version = ">= 2.7"
spec.required_ruby_version = ">= 3.0"

spec.authors = ["Team Umbrellio"]
spec.email = ["[email protected]"]
Expand All @@ -25,5 +25,4 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_runtime_dependency "sequel"
spec.add_runtime_dependency "symbiont-ruby"
end
Loading