umbrellio-sequel-plugins 0.14.0.192 → 0.16.0.211
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.rubocop.yml +4 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +75 -53
- data/README.md +1 -1
- data/lib/sequel/plugins/attr_encrypted.rb +7 -7
- data/lib/sequel/plugins/money_accessors.rb +2 -2
- data/lib/sequel/plugins/store_accessors.rb +2 -2
- data/lib/umbrellio_sequel_plugins/rails_db_command.rb +65 -24
- data/umbrellio-sequel-plugins.gemspec +2 -3
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8437b559acd9c459729c79bc592d63ffc84d044d4447197957f946372eef5419
|
4
|
+
data.tar.gz: 0da24c3ebe5272fab1563c702fd827cb366d285362f375c69f912825f21c5b02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f1389f354a0b0952534154a1e206f0698c5e3d365270cb87fca37de7cfe1886fa363ecdb8942c62b6fba9d28b79e0d6377d85d8c1982acc3ce5754d46a00d95
|
7
|
+
data.tar.gz: 9d9d419fcf3b5e67c76b7e57614d79528deb3613c9df3ea9fe9941c20024ba05a40f563fc4cacbbbcc44ec21a09979004255ed48eb8726bfe348f75635800e1d
|
data/.github/workflows/ci.yml
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,104 +1,124 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
umbrellio-sequel-plugins (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.
|
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.
|
23
|
-
|
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
|
-
|
27
|
-
|
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.
|
39
|
+
i18n (1.14.5)
|
31
40
|
concurrent-ruby (~> 1.0)
|
32
|
-
json (2.
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
38
|
-
|
39
|
-
|
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.
|
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.
|
47
|
-
rack (3.
|
57
|
+
racc (1.8.1)
|
58
|
+
rack (3.1.7)
|
48
59
|
rainbow (3.1.1)
|
49
|
-
rake (13.
|
50
|
-
regexp_parser (2.
|
51
|
-
rexml (3.
|
52
|
-
rspec (3.
|
53
|
-
rspec-core (~> 3.
|
54
|
-
rspec-expectations (~> 3.
|
55
|
-
rspec-mocks (~> 3.
|
56
|
-
rspec-core (3.
|
57
|
-
rspec-support (~> 3.
|
58
|
-
rspec-expectations (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.
|
61
|
-
rspec-mocks (3.
|
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.
|
64
|
-
rspec-support (3.
|
65
|
-
rubocop (1.
|
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.
|
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.
|
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.
|
76
|
-
parser (>= 3.
|
77
|
-
rubocop-capybara (2.
|
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.
|
80
|
-
rubocop (~> 1.
|
81
|
-
rubocop-performance (~> 1.
|
82
|
-
rubocop-rails (~> 2.
|
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.
|
96
|
+
rubocop-rspec (~> 2.29.0)
|
85
97
|
rubocop-sequel (~> 0.3.3)
|
86
|
-
rubocop-
|
87
|
-
rubocop (
|
88
|
-
|
89
|
-
|
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.
|
96
|
-
rubocop (~> 1.
|
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.
|
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.
|
133
|
+
unicode-display_width (2.5.0)
|
114
134
|
|
115
135
|
PLATFORMS
|
116
|
-
|
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.
|
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
|
-
|
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
|
-
|
22
|
-
|
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
|
26
|
-
|
41
|
+
def pg_config
|
42
|
+
@pg_config ||= begin
|
43
|
+
rails_db_config = Rails.application.config.database_configuration
|
27
44
|
|
28
|
-
|
45
|
+
sequel_configuration = SequelRails::Configuration.new
|
46
|
+
SequelRails.configuration = sequel_configuration.merge!(raw: rails_db_config)
|
29
47
|
|
30
|
-
|
31
|
-
|
48
|
+
storage = SequelRails::Storage.adapter_for(Rails.env)
|
49
|
+
config = storage.config.with_indifferent_access
|
32
50
|
|
33
|
-
|
34
|
-
|
51
|
+
if @options[:server]
|
52
|
+
server_config = config.fetch(:servers).fetch(@options[:server])
|
53
|
+
config.merge!(server_config)
|
54
|
+
end
|
35
55
|
|
36
|
-
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
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.
|
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 = ">=
|
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.
|
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:
|
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: '
|
87
|
+
version: '3.0'
|
102
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
89
|
requirements:
|
104
90
|
- - ">="
|