hanami-db 2.2.1 → 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/lib/hanami/db/testing.rb +7 -68
- data/lib/hanami/db/version.rb +1 -1
- metadata +4 -4
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/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,13 +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
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rom
|
@@ -62,8 +62,8 @@ email:
|
|
62
62
|
executables: []
|
63
63
|
extensions: []
|
64
64
|
extra_rdoc_files:
|
65
|
-
- README.md
|
66
65
|
- LICENSE.md
|
66
|
+
- README.md
|
67
67
|
files:
|
68
68
|
- LICENSE.md
|
69
69
|
- README.md
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
rubygems_version: 3.6.
|
103
|
+
rubygems_version: 3.6.9
|
104
104
|
specification_version: 4
|
105
105
|
summary: The database layer for Hanami apps
|
106
106
|
test_files: []
|