umbrellio-sequel-plugins 0.14.0.192 → 0.16.0.211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62df42e1d4a608c7a2f6f4d3b33956b0e8d7c962de1f4ba970b5ddb3e858c9df
4
- data.tar.gz: cc6dadf3aaea66e8af9e694996144daee03ca8af13893d8e930fb8b28f20b254
3
+ metadata.gz: 8437b559acd9c459729c79bc592d63ffc84d044d4447197957f946372eef5419
4
+ data.tar.gz: 0da24c3ebe5272fab1563c702fd827cb366d285362f375c69f912825f21c5b02
5
5
  SHA512:
6
- metadata.gz: '0961d5fce4dd8f7d0aaba3152577c22e097bff92b66cf7b7a716c39693272b020fcfc0fb91f4bca530617559e7cfa4c2ed97cbd7c7807084c0eae458910a6a77'
7
- data.tar.gz: e31c2fc3285cb90b2780d2718f6e854fd8bee2c7d54a9e988df766348ecd3838cb92243c1de210f9b5fc4ff2ef4d3acc53edc5271d8cd66cc65cf5d91547c681
6
+ metadata.gz: 0f1389f354a0b0952534154a1e206f0698c5e3d365270cb87fca37de7cfe1886fa363ecdb8942c62b6fba9d28b79e0d6377d85d8c1982acc3ce5754d46a00d95
7
+ data.tar.gz: 9d9d419fcf3b5e67c76b7e57614d79528deb3613c9df3ea9fe9941c20024ba05a40f563fc4cacbbbcc44ec21a09979004255ed48eb8726bfe348f75635800e1d
@@ -30,7 +30,7 @@ jobs:
30
30
  strategy:
31
31
  fail-fast: false
32
32
  matrix:
33
- ruby: ["2.7", "3.0", "3.1", "3.2"]
33
+ ruby: ["3.0", "3.1", "3.2", "3.3"]
34
34
 
35
35
  name: ${{ matrix.ruby }}
36
36
 
data/.rubocop.yml CHANGED
@@ -3,8 +3,11 @@ inherit_gem:
3
3
 
4
4
  AllCops:
5
5
  DisplayCopNames: true
6
- TargetRubyVersion: 2.7
6
+ TargetRubyVersion: 3.0
7
7
 
8
8
  Naming/FileName:
9
9
  Exclude:
10
10
  - lib/umbrellio-sequel-plugins.rb
11
+
12
+ RSpec/SpecFilePathFormat:
13
+ Enabled: false
data/Gemfile CHANGED
@@ -13,3 +13,4 @@ gem "rspec"
13
13
  gem "rubocop-config-umbrellio"
14
14
  gem "simplecov"
15
15
  gem "simplecov-lcov"
16
+ gem "symbiont-ruby"
data/Gemfile.lock CHANGED
@@ -1,104 +1,124 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- umbrellio-sequel-plugins (0.14.0)
4
+ umbrellio-sequel-plugins (0.16.0)
5
5
  sequel
6
- symbiont-ruby
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
10
9
  specs:
11
- activesupport (7.0.6)
10
+ activesupport (7.1.4)
11
+ base64
12
+ bigdecimal
12
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ connection_pool (>= 2.2.5)
15
+ drb
13
16
  i18n (>= 1.6, < 2)
14
17
  minitest (>= 5.1)
18
+ mutex_m
15
19
  tzinfo (~> 2.0)
16
20
  ast (2.4.2)
17
21
  async (1.31.0)
18
22
  console (~> 1.10)
19
23
  nio4r (~> 2.3)
20
24
  timers (~> 4.1)
25
+ base64 (0.2.0)
26
+ bigdecimal (3.1.8)
21
27
  coderay (1.1.3)
22
- concurrent-ruby (1.2.2)
23
- console (1.17.2)
28
+ concurrent-ruby (1.3.4)
29
+ connection_pool (2.4.1)
30
+ console (1.24.0)
24
31
  fiber-annotation
25
32
  fiber-local
26
- diff-lcs (1.5.0)
27
- docile (1.4.0)
33
+ json
34
+ diff-lcs (1.5.1)
35
+ docile (1.4.1)
36
+ drb (2.2.1)
28
37
  fiber-annotation (0.2.0)
29
38
  fiber-local (1.0.0)
30
- i18n (1.14.1)
39
+ i18n (1.14.5)
31
40
  concurrent-ruby (~> 1.0)
32
- json (2.6.3)
33
- method_source (1.0.0)
34
- minitest (5.18.1)
35
- money (6.16.0)
41
+ json (2.7.2)
42
+ language_server-protocol (3.17.0.3)
43
+ method_source (1.1.0)
44
+ minitest (5.25.1)
45
+ money (6.19.0)
36
46
  i18n (>= 0.6.4, <= 2)
37
- nio4r (2.5.9)
38
- parallel (1.23.0)
39
- parser (3.2.2.3)
47
+ mutex_m (0.2.0)
48
+ nio4r (2.7.3)
49
+ parallel (1.26.3)
50
+ parser (3.3.5.0)
40
51
  ast (~> 2.4.1)
41
52
  racc
42
- pg (1.5.3)
53
+ pg (1.5.7)
43
54
  pry (0.14.2)
44
55
  coderay (~> 1.1)
45
56
  method_source (~> 1.0)
46
- racc (1.7.1)
47
- rack (3.0.8)
57
+ racc (1.8.1)
58
+ rack (3.1.7)
48
59
  rainbow (3.1.1)
49
- rake (13.0.6)
50
- regexp_parser (2.8.1)
51
- rexml (3.2.5)
52
- rspec (3.12.0)
53
- rspec-core (~> 3.12.0)
54
- rspec-expectations (~> 3.12.0)
55
- rspec-mocks (~> 3.12.0)
56
- rspec-core (3.12.2)
57
- rspec-support (~> 3.12.0)
58
- rspec-expectations (3.12.3)
60
+ rake (13.2.1)
61
+ regexp_parser (2.9.2)
62
+ rexml (3.3.7)
63
+ rspec (3.13.0)
64
+ rspec-core (~> 3.13.0)
65
+ rspec-expectations (~> 3.13.0)
66
+ rspec-mocks (~> 3.13.0)
67
+ rspec-core (3.13.1)
68
+ rspec-support (~> 3.13.0)
69
+ rspec-expectations (3.13.2)
59
70
  diff-lcs (>= 1.2.0, < 2.0)
60
- rspec-support (~> 3.12.0)
61
- rspec-mocks (3.12.6)
71
+ rspec-support (~> 3.13.0)
72
+ rspec-mocks (3.13.1)
62
73
  diff-lcs (>= 1.2.0, < 2.0)
63
- rspec-support (~> 3.12.0)
64
- rspec-support (3.12.1)
65
- rubocop (1.50.2)
74
+ rspec-support (~> 3.13.0)
75
+ rspec-support (3.13.1)
76
+ rubocop (1.63.5)
66
77
  json (~> 2.3)
78
+ language_server-protocol (>= 3.17.0)
67
79
  parallel (~> 1.10)
68
- parser (>= 3.2.0.0)
80
+ parser (>= 3.3.0.2)
69
81
  rainbow (>= 2.2.2, < 4.0)
70
82
  regexp_parser (>= 1.8, < 3.0)
71
83
  rexml (>= 3.2.5, < 4.0)
72
- rubocop-ast (>= 1.28.0, < 2.0)
84
+ rubocop-ast (>= 1.31.1, < 2.0)
73
85
  ruby-progressbar (~> 1.7)
74
86
  unicode-display_width (>= 2.4.0, < 3.0)
75
- rubocop-ast (1.29.0)
76
- parser (>= 3.2.1.0)
77
- rubocop-capybara (2.18.0)
87
+ rubocop-ast (1.32.3)
88
+ parser (>= 3.3.1.0)
89
+ rubocop-capybara (2.21.0)
78
90
  rubocop (~> 1.41)
79
- rubocop-config-umbrellio (1.50.0.85)
80
- rubocop (~> 1.50.0)
81
- rubocop-performance (~> 1.17.0)
82
- rubocop-rails (~> 2.19.0)
91
+ rubocop-config-umbrellio (1.63.0.93)
92
+ rubocop (~> 1.63.0)
93
+ rubocop-performance (~> 1.21.0)
94
+ rubocop-rails (~> 2.24.0)
83
95
  rubocop-rake (~> 0.6.0)
84
- rubocop-rspec (~> 2.20.0)
96
+ rubocop-rspec (~> 2.29.0)
85
97
  rubocop-sequel (~> 0.3.3)
86
- rubocop-performance (1.17.1)
87
- rubocop (>= 1.7.0, < 2.0)
88
- rubocop-ast (>= 0.4.0)
89
- rubocop-rails (2.19.1)
98
+ rubocop-factory_bot (2.26.1)
99
+ rubocop (~> 1.61)
100
+ rubocop-performance (1.21.1)
101
+ rubocop (>= 1.48.1, < 2.0)
102
+ rubocop-ast (>= 1.31.1, < 2.0)
103
+ rubocop-rails (2.24.1)
90
104
  activesupport (>= 4.2.0)
91
105
  rack (>= 1.1)
92
106
  rubocop (>= 1.33.0, < 2.0)
107
+ rubocop-ast (>= 1.31.1, < 2.0)
93
108
  rubocop-rake (0.6.0)
94
109
  rubocop (~> 1.0)
95
- rubocop-rspec (2.20.0)
96
- rubocop (~> 1.33)
110
+ rubocop-rspec (2.29.2)
111
+ rubocop (~> 1.40)
97
112
  rubocop-capybara (~> 2.17)
113
+ rubocop-factory_bot (~> 2.22)
114
+ rubocop-rspec_rails (~> 2.28)
115
+ rubocop-rspec_rails (2.29.1)
116
+ rubocop (~> 1.61)
98
117
  rubocop-sequel (0.3.4)
99
118
  rubocop (~> 1.0)
100
119
  ruby-progressbar (1.13.0)
101
- sequel (5.70.0)
120
+ sequel (5.84.0)
121
+ bigdecimal
102
122
  simplecov (0.22.0)
103
123
  docile (~> 1.1)
104
124
  simplecov-html (~> 0.11)
@@ -110,10 +130,11 @@ GEM
110
130
  timers (4.3.5)
111
131
  tzinfo (2.0.6)
112
132
  concurrent-ruby (~> 1.0)
113
- unicode-display_width (2.4.2)
133
+ unicode-display_width (2.5.0)
114
134
 
115
135
  PLATFORMS
116
- ruby
136
+ arm64-darwin-23
137
+ x86_64-linux
117
138
 
118
139
  DEPENDENCIES
119
140
  async (= 1.31.0)
@@ -125,7 +146,8 @@ DEPENDENCIES
125
146
  rubocop-config-umbrellio
126
147
  simplecov
127
148
  simplecov-lcov
149
+ symbiont-ruby
128
150
  umbrellio-sequel-plugins!
129
151
 
130
152
  BUNDLED WITH
131
- 2.4.15
153
+ 2.5.18
data/README.md CHANGED
@@ -131,7 +131,7 @@ DB.synchronize_with([:ruby, :forever]) { p "Hey, I'm in transaction!"; sleep 5 }
131
131
 
132
132
  ## Methods in Migrations
133
133
 
134
- Enable: `Sequel.extension(:methods_in_migrations)`
134
+ Enable: `Sequel.extension(:methods_in_migrations)`. Also, you will need to add and require `symbiont-ruby` gem.
135
135
 
136
136
  Support for method definitions and invocations inside `Sequel.migration`.
137
137
 
@@ -48,10 +48,10 @@ module Sequel::Plugins::AttrEncrypted
48
48
 
49
49
  def define_encrypted_setter(attr, key)
50
50
  @_attr_encrypted_module.module_eval do
51
- define_method("#{attr}=") do |value|
52
- instance_variable_set("@#{attr}", value)
51
+ define_method(:"#{attr}=") do |value|
52
+ instance_variable_set(:"@#{attr}", value)
53
53
 
54
- send("encrypted_#{attr}=", SimpleCrypt.encrypt(value.to_json, key))
54
+ send(:"encrypted_#{attr}=", SimpleCrypt.encrypt(value.to_json, key))
55
55
  end
56
56
  end
57
57
  end
@@ -59,11 +59,11 @@ module Sequel::Plugins::AttrEncrypted
59
59
  def define_encrypted_getter(attr, key)
60
60
  @_attr_encrypted_module.module_eval do
61
61
  define_method(attr.to_s) do
62
- instance_variable_get("@#{attr}") || begin
63
- decrypted = SimpleCrypt.decrypt(send("encrypted_#{attr}"), key)
62
+ instance_variable_get(:"@#{attr}") || begin
63
+ decrypted = SimpleCrypt.decrypt(send(:"encrypted_#{attr}"), key)
64
64
 
65
65
  result = decrypted.nil? ? decrypted : JSON.parse(decrypted)
66
- instance_variable_set("@#{attr}", result)
66
+ instance_variable_set(:"@#{attr}", result)
67
67
  end
68
68
  end
69
69
  end
@@ -91,7 +91,7 @@ module Sequel::Plugins::AttrEncrypted
91
91
 
92
92
  def _reset_encrypted_attrs_ivars
93
93
  self.class.instance_variable_get(:@_encrypted_attributes)&.each do |attr|
94
- instance_variable_set("@#{attr}", nil)
94
+ instance_variable_set(:"@#{attr}", nil)
95
95
  end
96
96
  end
97
97
  end
@@ -40,7 +40,7 @@ module Sequel::Plugins::MoneyAccessors
40
40
  def money_setter(amount_column, currency_column)
41
41
  include_accessors_module!
42
42
  @_money_accessors_module.module_eval do
43
- define_method("#{amount_column}=") do |value|
43
+ define_method(:"#{amount_column}=") do |value|
44
44
  case value
45
45
  when Money
46
46
  amount = value.to_d
@@ -52,7 +52,7 @@ module Sequel::Plugins::MoneyAccessors
52
52
  end
53
53
 
54
54
  super(amount)
55
- send("#{currency_column}=", currency)
55
+ send(:"#{currency_column}=", currency)
56
56
  end
57
57
  end
58
58
  end
@@ -52,8 +52,8 @@ module Sequel::Plugins::StoreAccessors
52
52
 
53
53
  def define_store_setter(column, field)
54
54
  @_store_accessors_module.module_eval do
55
- define_method("#{field}=") do |value|
56
- send("#{column}=", send(column).to_h.merge(field.to_s => value))
55
+ define_method(:"#{field}=") do |value|
56
+ send(:"#{column}=", send(column).to_h.merge(field.to_s => value))
57
57
  end
58
58
  end
59
59
  end
@@ -9,45 +9,86 @@ class Rails::Command::DbconsoleCommand < Rails::Command::Base
9
9
  def perform
10
10
  require "rake"
11
11
  Rake.with_application(&:load_rakefile) # Needed to initialize Rails.application
12
- Rails::DBConsole.start(options)
12
+ start!
13
13
  end
14
- end
15
-
16
- class Rails::DBConsole
17
- DBConfig = Struct.new(:configuration_hash, :adapter, :database)
18
14
 
19
15
  private
20
16
 
21
- def db_config
22
- @db_config ||= DBConfig.new(configuration_hash, adapter, database)
17
+ # See ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.dbconsole
18
+ def start!
19
+ ENV["PGUSER"] = pg_config[:username] if pg_config[:username]
20
+ ENV["PGHOST"] = pg_config[:host] if pg_config[:host]
21
+ ENV["PGPORT"] = pg_config[:port].to_s if pg_config[:port]
22
+
23
+ if pg_config[:password] && options[:include_password]
24
+ ENV["PGPASSWORD"] = pg_config[:password].to_s
25
+ end
26
+
27
+ ENV["PGSSLMODE"] = pg_config[:sslmode].to_s if pg_config[:sslmode]
28
+ ENV["PGSSLCERT"] = pg_config[:sslcert].to_s if pg_config[:sslcert]
29
+ ENV["PGSSLKEY"] = pg_config[:sslkey].to_s if pg_config[:sslkey]
30
+ ENV["PGSSLROOTCERT"] = pg_config[:sslrootcert].to_s if pg_config[:sslrootcert]
31
+
32
+ if pg_config[:variables]
33
+ ENV["PGOPTIONS"] = pg_config[:variables].filter_map do |name, value|
34
+ "-c #{name}=#{value.to_s.gsub(/[ \\]/, '\\\\\0')}" unless value.in?([":default", :default])
35
+ end.join(" ")
36
+ end
37
+
38
+ find_cmd_and_exec("psql", database)
23
39
  end
24
40
 
25
- def configuration_hash
26
- return @configuration_hash if defined?(@configuration_hash)
41
+ def pg_config
42
+ @pg_config ||= begin
43
+ rails_db_config = Rails.application.config.database_configuration
27
44
 
28
- rails_db_config = Rails.application.config.database_configuration
45
+ sequel_configuration = SequelRails::Configuration.new
46
+ SequelRails.configuration = sequel_configuration.merge!(raw: rails_db_config)
29
47
 
30
- sequel_configuration = SequelRails::Configuration.new
31
- SequelRails.configuration = sequel_configuration.merge!(raw: rails_db_config)
48
+ storage = SequelRails::Storage.adapter_for(Rails.env)
49
+ config = storage.config.with_indifferent_access
32
50
 
33
- storage = SequelRails::Storage.adapter_for(Rails.env)
34
- config = storage.config.with_indifferent_access
51
+ if @options[:server]
52
+ server_config = config.fetch(:servers).fetch(@options[:server])
53
+ config.merge!(server_config)
54
+ end
35
55
 
36
- if @options[:server]
37
- server_config = config.fetch(:servers).fetch(@options[:server])
38
- config.merge!(server_config)
56
+ config
39
57
  end
40
-
41
- @configuration_hash = config
42
58
  end
43
59
 
44
- def adapter
45
- mapping = SequelRails::DbConfig::ADAPTER_MAPPING.invert
46
- value = configuration_hash.fetch(:adapter)
47
- mapping[value] || value
60
+ # See ActiveRecord::ConnectionAdapters::AbstractAdapter.find_cmd_and_exec
61
+ def find_cmd_and_exec(commands, *args) # rubocop:disable Metrics/MethodLength
62
+ commands = Array(commands)
63
+
64
+ dirs_on_path = ENV["PATH"].to_s.split(File::PATH_SEPARATOR)
65
+ unless (ext = RbConfig::CONFIG["EXEEXT"]).empty?
66
+ commands = commands.map { |cmd| "#{cmd}#{ext}" }
67
+ end
68
+
69
+ full_path_command = nil
70
+ found = commands.detect do |cmd|
71
+ dirs_on_path.detect do |path|
72
+ full_path_command = File.join(path, cmd)
73
+ begin
74
+ stat = File.stat(full_path_command)
75
+ rescue SystemCallError
76
+ else
77
+ stat.file? && stat.executable?
78
+ end
79
+ end
80
+ end
81
+
82
+ if found
83
+ exec(*[full_path_command, *args].compact)
84
+ else
85
+ abort(
86
+ "Couldn't find database client: #{commands.join(', ')}. Check your $PATH and try again.",
87
+ )
88
+ end
48
89
  end
49
90
 
50
91
  def database
51
- @options[:database] || configuration_hash.fetch(:database)
92
+ options[:database] || pg_config.fetch(:database)
52
93
  end
53
94
  end
@@ -4,7 +4,7 @@ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- gem_version = "0.14.0"
7
+ gem_version = "0.16.0"
8
8
 
9
9
  if ENV.fetch("PUBLISH_JOB", nil)
10
10
  release_version = "#{gem_version}.#{ENV.fetch("GITHUB_RUN_NUMBER")}"
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.name = "umbrellio-sequel-plugins"
14
14
  spec.version = release_version || gem_version
15
- spec.required_ruby_version = ">= 2.7"
15
+ spec.required_ruby_version = ">= 3.0"
16
16
 
17
17
  spec.authors = ["Team Umbrellio"]
18
18
  spec.email = ["oss@umbrellio.biz"]
@@ -25,5 +25,4 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ["lib"]
26
26
 
27
27
  spec.add_runtime_dependency "sequel"
28
- spec.add_runtime_dependency "symbiont-ruby"
29
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umbrellio-sequel-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0.192
4
+ version: 0.16.0.211
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Umbrellio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-15 00:00:00.000000000 Z
11
+ date: 2024-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: symbiont-ruby
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  description: A colletion of sequel plugins by Umbrellio
42
28
  email:
43
29
  - oss@umbrellio.biz
@@ -98,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
84
  requirements:
99
85
  - - ">="
100
86
  - !ruby/object:Gem::Version
101
- version: '2.7'
87
+ version: '3.0'
102
88
  required_rubygems_version: !ruby/object:Gem::Requirement
103
89
  requirements:
104
90
  - - ">="