pgtk 0.9.3 → 0.9.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d578c53a29f6742eab6b147fa8f07297a8e0c21e811626dc119d5d4b857894db
4
- data.tar.gz: b0c0136d3f3b450e4335915440cbf845ed0e546ff9dde85dd5e5d7c8bf1030b2
3
+ metadata.gz: ba1f564ca75057059d4841d186429184eee90fd082807e40f7a055fd7e3c8cc8
4
+ data.tar.gz: e432222b259fcc4e3eb7a21da2c66e10b17dbbaa45584dc7a837a6dab2040b66
5
5
  SHA512:
6
- metadata.gz: 5d749193d88fbad98e34923f113fe134fd94d645c8f879ede517d90d3cdec2c173d69b2edd6566169d82caa76cb6392a58204367c900ad877df744bcde2bdf78
7
- data.tar.gz: 71ea0f4ebb992b5e828fdb7133602f42069baeb7fb9a9b2b76691393480d237bf89a754a8a79d389475edbf1001478171339b3ba8d8e56a5cfd472cd4a74dbbf
6
+ metadata.gz: 0d16b146d433c8b2ee61e0baf25fb545c7983c277f4681f132e0d16d5aaf955806f6c0eafa7cdbc6f0eef8a0d45da063c9c025219c5068aa360b6fbe14e71cc5
7
+ data.tar.gz: bdac310f79c175c21401c5ad93372897fd955fab7449a49c3f9ae7dfac5ea7767d7a79d84a2d018ad397d0a9b980e4374c83d85b783a4c59a1cb144dbdab2cfb
data/.rubocop.yml CHANGED
@@ -41,7 +41,7 @@ Metrics/AbcSize:
41
41
  Metrics/CyclomaticComplexity:
42
42
  Max: 15
43
43
  Metrics/ClassLength:
44
- Max: 120
44
+ Max: 150
45
45
  Metrics/MethodLength:
46
46
  Max: 100
47
47
  Metrics/PerceivedComplexity:
data/Gemfile CHANGED
@@ -23,11 +23,11 @@
23
23
  source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
- gem 'minitest', '5.23.1', require: false
27
- gem 'rack', '3.0.11', require: false
26
+ gem 'minitest', '5.24.1', require: false
27
+ gem 'rack', '3.1.7', require: false
28
28
  gem 'rake', '13.2.1', require: false
29
- gem 'rspec-rails', '6.1.2', require: false
30
- gem 'rubocop', '1.64.0', require: false
31
- gem 'rubocop-rspec', '2.29.2', require: false
29
+ gem 'rspec-rails', '6.1.3', require: false
30
+ gem 'rubocop', '1.65.0', require: false
31
+ gem 'rubocop-rspec', '3.0.2', require: false
32
32
  gem 'simplecov', '0.22.0', require: false
33
33
  gem 'xcop', '0.7.1', require: false
data/Gemfile.lock CHANGED
@@ -10,9 +10,9 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actionpack (7.1.3.3)
14
- actionview (= 7.1.3.3)
15
- activesupport (= 7.1.3.3)
13
+ actionpack (7.1.3.4)
14
+ actionview (= 7.1.3.4)
15
+ activesupport (= 7.1.3.4)
16
16
  nokogiri (>= 1.8.5)
17
17
  racc
18
18
  rack (>= 2.2.4)
@@ -20,13 +20,13 @@ GEM
20
20
  rack-test (>= 0.6.3)
21
21
  rails-dom-testing (~> 2.2)
22
22
  rails-html-sanitizer (~> 1.6)
23
- actionview (7.1.3.3)
24
- activesupport (= 7.1.3.3)
23
+ actionview (7.1.3.4)
24
+ activesupport (= 7.1.3.4)
25
25
  builder (~> 3.1)
26
26
  erubi (~> 1.11)
27
27
  rails-dom-testing (~> 2.2)
28
28
  rails-html-sanitizer (~> 1.6)
29
- activesupport (7.1.3.3)
29
+ activesupport (7.1.3.4)
30
30
  base64
31
31
  bigdecimal
32
32
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -40,19 +40,19 @@ GEM
40
40
  backtrace (0.4.0)
41
41
  base64 (0.2.0)
42
42
  bigdecimal (3.1.8)
43
- builder (3.2.4)
44
- concurrent-ruby (1.2.3)
43
+ builder (3.3.0)
44
+ concurrent-ruby (1.3.3)
45
45
  connection_pool (2.4.1)
46
46
  crass (1.0.6)
47
47
  diff-lcs (1.5.1)
48
48
  differ (0.1.2)
49
49
  docile (1.4.0)
50
50
  drb (2.2.1)
51
- erubi (1.12.0)
51
+ erubi (1.13.0)
52
52
  i18n (1.14.5)
53
53
  concurrent-ruby (~> 1.0)
54
54
  io-console (0.7.2)
55
- irb (1.13.1)
55
+ irb (1.14.0)
56
56
  rdoc (>= 4.0.0)
57
57
  reline (>= 0.4.2)
58
58
  json (2.7.2)
@@ -60,22 +60,22 @@ GEM
60
60
  loofah (2.22.0)
61
61
  crass (~> 1.0.2)
62
62
  nokogiri (>= 1.12.0)
63
- loog (0.5.1)
64
- minitest (5.23.1)
63
+ loog (0.5.2)
64
+ minitest (5.24.1)
65
65
  mutex_m (0.2.0)
66
- nokogiri (1.16.5-arm64-darwin)
66
+ nokogiri (1.16.6-arm64-darwin)
67
67
  racc (~> 1.4)
68
- nokogiri (1.16.5-x86_64-linux)
68
+ nokogiri (1.16.6-x86_64-linux)
69
69
  racc (~> 1.4)
70
- parallel (1.24.0)
71
- parser (3.3.1.0)
70
+ parallel (1.25.1)
71
+ parser (3.3.4.0)
72
72
  ast (~> 2.4.1)
73
73
  racc
74
74
  pg (1.5.6)
75
75
  psych (5.1.2)
76
76
  stringio
77
77
  racc (1.8.0)
78
- rack (3.0.11)
78
+ rack (3.1.7)
79
79
  rack-session (2.0.0)
80
80
  rack (>= 3.0.0)
81
81
  rack-test (2.1.0)
@@ -90,9 +90,9 @@ GEM
90
90
  rails-html-sanitizer (1.6.0)
91
91
  loofah (~> 2.21)
92
92
  nokogiri (~> 1.14)
93
- railties (7.1.3.3)
94
- actionpack (= 7.1.3.3)
95
- activesupport (= 7.1.3.3)
93
+ railties (7.1.3.4)
94
+ actionpack (= 7.1.3.4)
95
+ activesupport (= 7.1.3.4)
96
96
  irb
97
97
  rackup (>= 1.0.0)
98
98
  rake (>= 12.2)
@@ -100,23 +100,23 @@ GEM
100
100
  zeitwerk (~> 2.6)
101
101
  rainbow (3.1.1)
102
102
  rake (13.2.1)
103
- random-port (0.6.0)
103
+ random-port (0.7.0)
104
104
  rdoc (6.7.0)
105
105
  psych (>= 4.0.0)
106
106
  regexp_parser (2.9.2)
107
- reline (0.5.7)
107
+ reline (0.5.9)
108
108
  io-console (~> 0.5)
109
- rexml (3.2.8)
110
- strscan (>= 3.0.9)
109
+ rexml (3.3.1)
110
+ strscan
111
111
  rspec-core (3.13.0)
112
112
  rspec-support (~> 3.13.0)
113
- rspec-expectations (3.13.0)
113
+ rspec-expectations (3.13.1)
114
114
  diff-lcs (>= 1.2.0, < 2.0)
115
115
  rspec-support (~> 3.13.0)
116
116
  rspec-mocks (3.13.1)
117
117
  diff-lcs (>= 1.2.0, < 2.0)
118
118
  rspec-support (~> 3.13.0)
119
- rspec-rails (6.1.2)
119
+ rspec-rails (6.1.3)
120
120
  actionpack (>= 6.1)
121
121
  activesupport (>= 6.1)
122
122
  railties (>= 6.1)
@@ -125,30 +125,21 @@ GEM
125
125
  rspec-mocks (~> 3.13)
126
126
  rspec-support (~> 3.13)
127
127
  rspec-support (3.13.1)
128
- rubocop (1.64.0)
128
+ rubocop (1.65.0)
129
129
  json (~> 2.3)
130
130
  language_server-protocol (>= 3.17.0)
131
131
  parallel (~> 1.10)
132
132
  parser (>= 3.3.0.2)
133
133
  rainbow (>= 2.2.2, < 4.0)
134
- regexp_parser (>= 1.8, < 3.0)
134
+ regexp_parser (>= 2.4, < 3.0)
135
135
  rexml (>= 3.2.5, < 4.0)
136
136
  rubocop-ast (>= 1.31.1, < 2.0)
137
137
  ruby-progressbar (~> 1.7)
138
138
  unicode-display_width (>= 2.4.0, < 3.0)
139
139
  rubocop-ast (1.31.3)
140
140
  parser (>= 3.3.1.0)
141
- rubocop-capybara (2.20.0)
142
- rubocop (~> 1.41)
143
- rubocop-factory_bot (2.25.1)
144
- rubocop (~> 1.41)
145
- rubocop-rspec (2.29.2)
146
- rubocop (~> 1.40)
147
- rubocop-capybara (~> 2.17)
148
- rubocop-factory_bot (~> 2.22)
149
- rubocop-rspec_rails (~> 2.28)
150
- rubocop-rspec_rails (2.28.3)
151
- rubocop (~> 1.40)
141
+ rubocop-rspec (3.0.2)
142
+ rubocop (~> 1.61)
152
143
  ruby-progressbar (1.13.0)
153
144
  simplecov (0.22.0)
154
145
  docile (~> 1.1)
@@ -157,7 +148,7 @@ GEM
157
148
  simplecov-html (0.12.3)
158
149
  simplecov_json_formatter (0.1.4)
159
150
  slop (4.10.1)
160
- stringio (3.1.0)
151
+ stringio (3.1.1)
161
152
  strscan (3.1.0)
162
153
  thor (1.3.1)
163
154
  tzinfo (2.0.6)
@@ -169,20 +160,20 @@ GEM
169
160
  nokogiri (~> 1.10)
170
161
  rainbow (~> 3.0)
171
162
  slop (~> 4.4)
172
- zeitwerk (2.6.14)
163
+ zeitwerk (2.6.16)
173
164
 
174
165
  PLATFORMS
175
166
  arm64-darwin-22
176
167
  x86_64-linux
177
168
 
178
169
  DEPENDENCIES
179
- minitest (= 5.23.1)
170
+ minitest (= 5.24.1)
180
171
  pgtk!
181
- rack (= 3.0.11)
172
+ rack (= 3.1.7)
182
173
  rake (= 13.2.1)
183
- rspec-rails (= 6.1.2)
184
- rubocop (= 1.64.0)
185
- rubocop-rspec (= 2.29.2)
174
+ rspec-rails (= 6.1.3)
175
+ rubocop (= 1.65.0)
176
+ rubocop-rspec (= 3.0.2)
186
177
  simplecov (= 0.22.0)
187
178
  xcop (= 0.7.1)
188
179
 
data/lib/pgtk/pool.rb CHANGED
@@ -123,7 +123,10 @@ class Pgtk::Pool
123
123
  def transaction
124
124
  connect do |c|
125
125
  t = Txn.new(c, @log)
126
- yield t
126
+ t.exec('START TRANSACTION')
127
+ r = yield t
128
+ t.exec('COMMIT')
129
+ r
127
130
  end
128
131
  end
129
132
 
data/lib/pgtk/version.rb CHANGED
@@ -28,5 +28,5 @@ require_relative '../pgtk'
28
28
  # License:: MIT
29
29
  module Pgtk
30
30
  # Current version of the library.
31
- VERSION = '0.9.3'
31
+ VERSION = '0.9.4'
32
32
  end
data/pgtk.gemspec CHANGED
@@ -42,9 +42,9 @@ connection pool and query processor, to make SQL manipulation simpler.'
42
42
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
43
43
  s.rdoc_options = ['--charset=UTF-8']
44
44
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
45
- s.add_runtime_dependency 'backtrace', '~> 0.3'
46
- s.add_runtime_dependency 'loog', '~> 0.2'
47
- s.add_runtime_dependency 'pg', '~> 1.1'
48
- s.add_runtime_dependency 'random-port', '~> 0.3'
45
+ s.add_dependency 'backtrace', '~> 0.3'
46
+ s.add_dependency 'loog', '~> 0.2'
47
+ s.add_dependency 'pg', '~> 1.1'
48
+ s.add_dependency 'random-port', '~> 0.3'
49
49
  s.metadata['rubygems_mfa_required'] = 'true'
50
50
  end
data/test/test_pool.rb CHANGED
@@ -90,6 +90,20 @@ class TestPool < Minitest::Test
90
90
  end
91
91
  end
92
92
 
93
+ def test_transaction_with_error
94
+ bootstrap do |pool|
95
+ pool.exec('DELETE FROM book')
96
+ assert(pool.exec('SELECT * FROM book').empty?)
97
+ assert_raises do
98
+ pool.transaction do |t|
99
+ t.exec('INSERT INTO book (title) VALUES ($1)', ['hey'])
100
+ t.exec('INSERT INTO book (error_here) VALUES ($1)', ['hey'])
101
+ end
102
+ end
103
+ assert(pool.exec('SELECT * FROM book').empty?)
104
+ end
105
+ end
106
+
93
107
  def test_reconnects_on_pg_error
94
108
  bootstrap do |pool|
95
109
  assert_raises PG::UndefinedTable do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-24 00:00:00.000000000 Z
11
+ date: 2024-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace