umbrellio-sequel-plugins 0.14.0.192 → 0.15.0.198
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/umbrellio_sequel_plugins/rails_db_command.rb +65 -24
- data/umbrellio-sequel-plugins.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b159522b1cb01dea723411ba97da921347c22c98999f23da63df0c1a0a205154
|
4
|
+
data.tar.gz: 7bd434016e9d2e5aa93a271e7540f88cee8b2943575739b79a8491a653bcb0c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e37d16419fd9356d677ee852013947061f3749b3e117fcd7c897b62f2b8dcbd65d0dc4517bde5c87bb781d34780556f899199eaa6dd618d4a2ebc93e1ff56155
|
7
|
+
data.tar.gz: 610c27188c8fe14536e143b181455d8a558acd48c7e3b99b6699c61ef26601ea0d264493d50aa75ffc7e38991c225f4e2181eac91c0300b71f56357f4852acb5
|
data/Gemfile.lock
CHANGED
@@ -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.15.0"
|
8
8
|
|
9
9
|
if ENV.fetch("PUBLISH_JOB", nil)
|
10
10
|
release_version = "#{gem_version}.#{ENV.fetch("GITHUB_RUN_NUMBER")}"
|
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.15.0.198
|
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-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|