bleib 0.0.15 → 0.0.17
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/lib/bleib/configuration.rb +17 -3
- data/lib/bleib/migrations.rb +5 -2
- data/lib/bleib/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5eadef287256311c458eb843251ee4198b0ced4054b8c7e1f2dfc111d0f8b17b
|
|
4
|
+
data.tar.gz: 1296fda907d66a50ef540c1ddba9a025b391868ce8c08dd65f76ea75030afda5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fd6af65972ed0ea6579bc53983fc1663905876f01d4b5c5ae4a6021abd91912b305a306375c15b7c275c548955472327f89cfc4925d3642036608d486d2dd54a
|
|
7
|
+
data.tar.gz: c5a157210fdb232ce1ce026f1644e20f58ddcba2857a2823bc83090ec1985dbe5921f3c57c613afa94d8b22536b6dfd6909e9237a93bac02185f7c166e615a13
|
data/lib/bleib/configuration.rb
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'active_record/database_configurations'
|
|
4
|
+
|
|
1
5
|
module Bleib
|
|
2
6
|
class Configuration
|
|
3
7
|
class UnsupportedAdapterException < Exception; end
|
|
@@ -11,6 +15,8 @@ module Bleib
|
|
|
11
15
|
|
|
12
16
|
SUPPORTED_ADAPTERS = %w(postgresql postgis mysql2)
|
|
13
17
|
|
|
18
|
+
POOL_KEYS = %w(pool max_connections min_connections).freeze
|
|
19
|
+
|
|
14
20
|
def self.from_environment
|
|
15
21
|
check_database_interval = interval_or_default(
|
|
16
22
|
ENV['BLEIB_CHECK_DATABASE_INTERVAL'],
|
|
@@ -39,9 +45,9 @@ module Bleib
|
|
|
39
45
|
check_migrations_interval: DEFAULT_CHECK_MIGRATIONS_INTERVAL)
|
|
40
46
|
# To be 100% sure which connection the
|
|
41
47
|
# active record pool creates, returns or removes.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
@database = database_configuration
|
|
49
|
+
.reject { |key, _| POOL_KEYS.include?(key.to_s) }
|
|
50
|
+
.merge(single_connection_key => 1)
|
|
45
51
|
|
|
46
52
|
@check_database_interval = check_database_interval
|
|
47
53
|
@check_migrations_interval = check_migrations_interval
|
|
@@ -63,6 +69,14 @@ module Bleib
|
|
|
63
69
|
|
|
64
70
|
private
|
|
65
71
|
|
|
72
|
+
def single_connection_key
|
|
73
|
+
# Rails >= 8.1 renamed `pool` to `max_connections` and aborts when both are set.
|
|
74
|
+
hash_config = ActiveRecord::DatabaseConfigurations::HashConfig
|
|
75
|
+
return 'max_connections' if hash_config.method_defined?(:min_connections)
|
|
76
|
+
|
|
77
|
+
'pool'
|
|
78
|
+
end
|
|
79
|
+
|
|
66
80
|
def self.interval_or_default(string, default)
|
|
67
81
|
given = string.to_i
|
|
68
82
|
given <= 0 ? default : given
|
data/lib/bleib/migrations.rb
CHANGED
|
@@ -67,8 +67,11 @@ module Bleib
|
|
|
67
67
|
|
|
68
68
|
def check_wagon_migrations!
|
|
69
69
|
paths = Wagons.all.flat_map(&:migrations_paths)
|
|
70
|
-
context =
|
|
71
|
-
|
|
70
|
+
context = if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('7.1.0')
|
|
71
|
+
ActiveRecord::MigrationContext.new(paths, ActiveRecord::SchemaMigration)
|
|
72
|
+
else
|
|
73
|
+
ActiveRecord::MigrationContext.new(paths)
|
|
74
|
+
end
|
|
72
75
|
# we do not need the correct output, just the right exception
|
|
73
76
|
# in this case, the output only considers the main-app migration, not the ones in wagons
|
|
74
77
|
raise ActiveRecord::PendingMigrationError if context.needs_migration?
|
data/lib/bleib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bleib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Puzzle ITC
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2026-09-28 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bundler
|
|
@@ -43,7 +42,6 @@ licenses:
|
|
|
43
42
|
- MIT
|
|
44
43
|
metadata:
|
|
45
44
|
source_code_uri: https://github.com/puzzle/bleib
|
|
46
|
-
post_install_message:
|
|
47
45
|
rdoc_options: []
|
|
48
46
|
require_paths:
|
|
49
47
|
- lib
|
|
@@ -58,8 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
58
56
|
- !ruby/object:Gem::Version
|
|
59
57
|
version: '0'
|
|
60
58
|
requirements: []
|
|
61
|
-
rubygems_version: 3.
|
|
62
|
-
signing_key:
|
|
59
|
+
rubygems_version: 3.7.2
|
|
63
60
|
specification_version: 4
|
|
64
61
|
summary: Use a rake task to wait on database and migrations.
|
|
65
62
|
test_files: []
|