hanami-db 2.2.0 → 2.3.0.beta1
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/hanami-db.gemspec +2 -2
- data/lib/hanami/db/repo.rb +1 -1
- data/lib/hanami/db/testing.rb +7 -68
- data/lib/hanami/db/version.rb +1 -1
- metadata +14 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57395184c9b8e8bb62e8a262b43619ebb65926cf54f330bd6cb86790ac3e2fa3
|
4
|
+
data.tar.gz: 87faa8ebb6804f1aa2327a755a454dacb7d57f82421ee346e722fdf2254219cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91b1d1a95030972f7a4270aac875553a4dc106a41da20fd95d022d424d4cfdf163f559818c6b5e34968ff1554413993a8af221c4a764e16c9fc7033a775ef79b
|
7
|
+
data.tar.gz: ec39b351eadd7511952b2ef169deba334c985477e9791b6e3367ed543b7457786bc14ed1f26013503a2085d465f6d4b361e54074f7aa6e58504c07d88d43554a
|
data/hanami-db.gemspec
CHANGED
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
}
|
22
22
|
|
23
23
|
spec.required_ruby_version = ">= 3.1"
|
24
|
-
spec.add_dependency "rom", "~> 5.
|
25
|
-
spec.add_dependency "rom-sql", "~> 3.
|
24
|
+
spec.add_dependency "rom", "~> 5.4", ">= 5.4.1"
|
25
|
+
spec.add_dependency "rom-sql", "~> 3.7"
|
26
26
|
spec.add_dependency "zeitwerk", "~> 2.6"
|
27
27
|
|
28
28
|
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
data/lib/hanami/db/repo.rb
CHANGED
@@ -40,7 +40,7 @@ module Hanami
|
|
40
40
|
# means _every_ repo ends up with an inferred root, many of which will not exist as
|
41
41
|
# relations. To avoid errors from fetching these non-existent relations, check first before
|
42
42
|
# setting the root.
|
43
|
-
@root =
|
43
|
+
@root = prepare_relation(self.class.root) if set_relation?(self.class.root)
|
44
44
|
end
|
45
45
|
|
46
46
|
private
|
data/lib/hanami/db/testing.rb
CHANGED
@@ -21,87 +21,26 @@ module Hanami
|
|
21
21
|
# @api private
|
22
22
|
# @since 2.2.0
|
23
23
|
def database_url(url)
|
24
|
-
|
24
|
+
# URI#dup does not duplicate internal instance
|
25
|
+
# variables, making mutation dangerous.
|
26
|
+
url = URI(url.to_s)
|
25
27
|
|
26
28
|
case deconstruct_url(url)
|
27
|
-
in {
|
29
|
+
in {scheme: "sqlite", opaque: nil, path:} unless path.nil?
|
28
30
|
url.path = database_filename(path)
|
29
|
-
in {
|
31
|
+
in {path: String => path} if path =~ DATABASE_NAME_MATCHER
|
30
32
|
url.path = path.sub(DATABASE_NAME_MATCHER, DATABASE_NAME_SUFFIX)
|
31
|
-
in {
|
33
|
+
in {path: String => path} unless path.end_with?(DATABASE_NAME_SUFFIX)
|
32
34
|
url.path << DATABASE_NAME_SUFFIX
|
33
35
|
else
|
34
36
|
# do nothing
|
35
37
|
end
|
36
38
|
|
37
|
-
|
39
|
+
url.to_s
|
38
40
|
end
|
39
41
|
|
40
42
|
private
|
41
43
|
|
42
|
-
# @api private
|
43
|
-
# @since 2.2.0
|
44
|
-
def parse_url(url)
|
45
|
-
if url.is_a?(URI::Generic)
|
46
|
-
# URI#dup does not duplicate internal instance
|
47
|
-
# variables, making mutation dangerous.
|
48
|
-
URI(stringify_url(url))
|
49
|
-
else
|
50
|
-
URI(url.to_s)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
|
55
|
-
|
56
|
-
# Work around a bug in Ruby 3.0.x that erroneously omits
|
57
|
-
# the '//' prefix from hierarchical URLs.
|
58
|
-
#
|
59
|
-
# @api private
|
60
|
-
# @since 2.2.0
|
61
|
-
def stringify_url(url)
|
62
|
-
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1.0")
|
63
|
-
return url.to_s
|
64
|
-
end
|
65
|
-
|
66
|
-
require "stringio"
|
67
|
-
|
68
|
-
buf = StringIO.new
|
69
|
-
buf << url.scheme
|
70
|
-
buf << ":"
|
71
|
-
buf << (url.opaque || "//")
|
72
|
-
|
73
|
-
if url.user || url.password
|
74
|
-
buf << "#{url.user}:#{url.password}@"
|
75
|
-
end
|
76
|
-
|
77
|
-
if url.host
|
78
|
-
buf << url.host
|
79
|
-
end
|
80
|
-
|
81
|
-
if url.port
|
82
|
-
buf << ":"
|
83
|
-
buf << url.port
|
84
|
-
end
|
85
|
-
|
86
|
-
if url.path
|
87
|
-
buf << url.path
|
88
|
-
end
|
89
|
-
|
90
|
-
if url.query
|
91
|
-
buf << "?"
|
92
|
-
buf << url.query
|
93
|
-
end
|
94
|
-
|
95
|
-
if url.fragment
|
96
|
-
buf << "#"
|
97
|
-
buf << url.fragment
|
98
|
-
end
|
99
|
-
|
100
|
-
buf.string
|
101
|
-
end
|
102
|
-
|
103
|
-
# rubocop:enable Metrics/AbcSize, Metrics/PerceivedComplexity
|
104
|
-
|
105
44
|
# Deconstructs a URI::Generic for pattern-matching.
|
106
45
|
#
|
107
46
|
# @param url [URI] Database URL parsed as URI::Generic
|
data/lib/hanami/db/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hanami team
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rom
|
@@ -16,34 +15,34 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
18
|
+
version: '5.4'
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 5.4.1
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
23
25
|
requirements:
|
24
26
|
- - "~>"
|
25
27
|
- !ruby/object:Gem::Version
|
26
|
-
version: '5.
|
28
|
+
version: '5.4'
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 5.4.1
|
27
32
|
- !ruby/object:Gem::Dependency
|
28
33
|
name: rom-sql
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
30
35
|
requirements:
|
31
36
|
- - "~>"
|
32
37
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3.
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 3.6.4
|
38
|
+
version: '3.7'
|
37
39
|
type: :runtime
|
38
40
|
prerelease: false
|
39
41
|
version_requirements: !ruby/object:Gem::Requirement
|
40
42
|
requirements:
|
41
43
|
- - "~>"
|
42
44
|
- !ruby/object:Gem::Version
|
43
|
-
version: '3.
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 3.6.4
|
45
|
+
version: '3.7'
|
47
46
|
- !ruby/object:Gem::Dependency
|
48
47
|
name: zeitwerk
|
49
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +57,13 @@ dependencies:
|
|
58
57
|
- - "~>"
|
59
58
|
- !ruby/object:Gem::Version
|
60
59
|
version: '2.6'
|
61
|
-
description:
|
62
60
|
email:
|
63
61
|
- admin@hanamirb.org
|
64
62
|
executables: []
|
65
63
|
extensions: []
|
66
64
|
extra_rdoc_files:
|
67
|
-
- README.md
|
68
65
|
- LICENSE.md
|
66
|
+
- README.md
|
69
67
|
files:
|
70
68
|
- LICENSE.md
|
71
69
|
- README.md
|
@@ -88,7 +86,6 @@ metadata:
|
|
88
86
|
funding_uri: https://github.com/sponsors/hanami
|
89
87
|
source_code_uri: https://github.com/hanami/db
|
90
88
|
rubygems_mfa_required: 'true'
|
91
|
-
post_install_message:
|
92
89
|
rdoc_options: []
|
93
90
|
require_paths:
|
94
91
|
- lib
|
@@ -103,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
100
|
- !ruby/object:Gem::Version
|
104
101
|
version: '0'
|
105
102
|
requirements: []
|
106
|
-
rubygems_version: 3.
|
107
|
-
signing_key:
|
103
|
+
rubygems_version: 3.6.9
|
108
104
|
specification_version: 4
|
109
105
|
summary: The database layer for Hanami apps
|
110
106
|
test_files: []
|