pgtk 0.8.0 → 0.9.0
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/.github/workflows/codecov.yml +4 -3
- data/.github/workflows/pdd.yml +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/.github/workflows/xcop.yml +2 -2
- data/.rultor.yml +3 -2
- data/.simplecov +1 -1
- data/Gemfile +1 -1
- data/LICENSE.txt +1 -1
- data/Rakefile +3 -3
- data/lib/pgtk/liquibase_task.rb +10 -3
- data/lib/pgtk/pgsql_task.rb +2 -2
- data/lib/pgtk/pool.rb +14 -9
- data/lib/pgtk/version.rb +3 -3
- data/lib/pgtk/wire.rb +5 -5
- data/lib/pgtk.rb +2 -2
- data/pgtk.gemspec +1 -1
- data/resources/pom.xml +8 -4
- data/test/test__helper.rb +1 -1
- data/test/test_liquibase_task.rb +3 -1
- data/test/test_pgsql_task.rb +1 -1
- data/test/test_pool.rb +24 -3
- data/test-resources/2019/01-test.xml +1 -1
- data/test-resources/master.xml +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62a786eefdf5750efb4fc874c1d56cabf81925652323df45cf305f7e7cd6db5f
|
|
4
|
+
data.tar.gz: 9d03860055718f2793aa0805307679240d4bd7765e9ae3310dae849511327134
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4bea1c503932c6a77edb73272aaaaa015abc36d82fb6d96d06e9576237f42430f6871d22bdb096feccb0f91eebc01fa41ff5cf64b025bbd8b23ec254914b6fab
|
|
7
|
+
data.tar.gz: 347c2d8171c8ce34390cad9b66c6753f4f40ff1a6f597cfece1284a690d9063951d6fbf9763307a880296161eeac75c3dcadeb54686711424bd87447747e617e
|
|
@@ -6,10 +6,10 @@ on:
|
|
|
6
6
|
- master
|
|
7
7
|
jobs:
|
|
8
8
|
codecov:
|
|
9
|
-
runs-on: ubuntu-
|
|
9
|
+
runs-on: ubuntu-22.04
|
|
10
10
|
steps:
|
|
11
|
-
- uses: actions/checkout@
|
|
12
|
-
- uses:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: ruby/setup-ruby@v1
|
|
13
13
|
with:
|
|
14
14
|
ruby-version: 2.7
|
|
15
15
|
- run: |
|
|
@@ -21,5 +21,6 @@ jobs:
|
|
|
21
21
|
- run: bundle exec rake
|
|
22
22
|
- uses: codecov/codecov-action@v3
|
|
23
23
|
with:
|
|
24
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
24
25
|
file: coverage/.resultset.json
|
|
25
26
|
fail_ci_if_error: true
|
data/.github/workflows/pdd.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pdd
|
|
3
|
-
|
|
3
|
+
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- master
|
|
@@ -9,7 +9,7 @@ name: pdd
|
|
|
9
9
|
- master
|
|
10
10
|
jobs:
|
|
11
11
|
pdd:
|
|
12
|
-
runs-on: ubuntu-
|
|
12
|
+
runs-on: ubuntu-22.04
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
15
|
-
- uses:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: volodya-lombrozo/pdd-action@master
|
data/.github/workflows/rake.yml
CHANGED
data/.github/workflows/xcop.yml
CHANGED
data/.rultor.yml
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
docker:
|
|
2
|
-
image: yegor256/rultor-image:1.
|
|
2
|
+
image: yegor256/rultor-image:1.22.0
|
|
3
3
|
assets:
|
|
4
4
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
|
5
5
|
install: |
|
|
6
|
+
sudo chown -R "$(whoami)" /usr/local/rvm
|
|
6
7
|
pdd -f /dev/null
|
|
7
|
-
|
|
8
|
+
bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
|
8
9
|
release:
|
|
9
10
|
script: |-
|
|
10
11
|
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
|
data/.simplecov
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/Gemfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/LICENSE.txt
CHANGED
data/Rakefile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -54,7 +54,7 @@ Rake::RDocTask.new do |rdoc|
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
require 'rubocop/rake_task'
|
|
57
|
-
desc 'Run
|
|
57
|
+
desc 'Run Rubocop on all directories'
|
|
58
58
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
|
59
59
|
task.fail_on_error = true
|
|
60
60
|
task.requires << 'rubocop-rspec'
|
|
@@ -69,7 +69,7 @@ Xcop::RakeTask.new :xcop do |task|
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
task :copyright do
|
|
72
|
-
sh "grep -q -r '
|
|
72
|
+
sh "grep -q -r '2019-#{Date.today.strftime('%Y')}' \
|
|
73
73
|
--include '*.rb' \
|
|
74
74
|
--include '*.txt' \
|
|
75
75
|
--include 'Rakefile' \
|
data/lib/pgtk/liquibase_task.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -29,15 +29,17 @@ require_relative '../pgtk'
|
|
|
29
29
|
|
|
30
30
|
# Liquibase rake task.
|
|
31
31
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
32
|
-
# Copyright:: Copyright (c) 2019-
|
|
32
|
+
# Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
|
|
33
33
|
# License:: MIT
|
|
34
34
|
class Pgtk::LiquibaseTask < Rake::TaskLib
|
|
35
|
-
attr_accessor :name, :master, :yaml, :quiet
|
|
35
|
+
attr_accessor :name, :master, :yaml, :quiet, :liquibase_version, :postgresql_version
|
|
36
36
|
|
|
37
37
|
def initialize(*args, &task_block)
|
|
38
38
|
super()
|
|
39
39
|
@name = args.shift || :liquibase
|
|
40
40
|
@quite = false
|
|
41
|
+
@liquibase_version = '3.2.2'
|
|
42
|
+
@postgresql_version = '42.7.0'
|
|
41
43
|
desc 'Deploy Liquibase changes to the running PostgreSQL server' unless ::Rake.application.last_description
|
|
42
44
|
task(name, *args) do |_, task_args|
|
|
43
45
|
RakeFileUtils.send(:verbose, true) do
|
|
@@ -69,10 +71,15 @@ class Pgtk::LiquibaseTask < Rake::TaskLib
|
|
|
69
71
|
'mvn verify',
|
|
70
72
|
'--errors',
|
|
71
73
|
'--batch-mode',
|
|
74
|
+
'--fail-fast',
|
|
72
75
|
@quiet ? '--quiet' : '',
|
|
73
76
|
'--file',
|
|
74
77
|
Shellwords.escape(pom),
|
|
75
78
|
'--define',
|
|
79
|
+
"liquibase.version=#{@liquibase_version}",
|
|
80
|
+
'--define',
|
|
81
|
+
"postgresql.version=#{@postgresql_version}",
|
|
82
|
+
'--define',
|
|
76
83
|
"liquibase.changeLogFile=#{@master}",
|
|
77
84
|
'--define',
|
|
78
85
|
"liquibase.url=#{Shellwords.escape(yml['pgsql']['url'])}",
|
data/lib/pgtk/pgsql_task.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -32,7 +32,7 @@ require_relative '../pgtk'
|
|
|
32
32
|
|
|
33
33
|
# Pgsql rake task.
|
|
34
34
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
35
|
-
# Copyright:: Copyright (c) 2019-
|
|
35
|
+
# Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
|
|
36
36
|
# License:: MIT
|
|
37
37
|
class Pgtk::PgsqlTask < Rake::TaskLib
|
|
38
38
|
attr_accessor :name, :dir, :fresh_start, :user, :password, :dbname, :yaml, :quiet, :port
|
data/lib/pgtk/pool.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -27,7 +27,7 @@ require_relative 'wire'
|
|
|
27
27
|
|
|
28
28
|
# Pool.
|
|
29
29
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
30
|
-
# Copyright:: Copyright (c) 2019-
|
|
30
|
+
# Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
|
|
31
31
|
# License:: MIT
|
|
32
32
|
class Pgtk::Pool
|
|
33
33
|
# Constructor.
|
|
@@ -137,14 +137,19 @@ class Pgtk::Pool
|
|
|
137
137
|
def exec(query, args = [], result = 0)
|
|
138
138
|
start = Time.now
|
|
139
139
|
sql = query.is_a?(Array) ? query.join(' ') : query
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
begin
|
|
141
|
+
out = @conn.exec_params(sql, args, result) do |res|
|
|
142
|
+
if block_given?
|
|
143
|
+
yield res
|
|
144
|
+
else
|
|
145
|
+
rows = []
|
|
146
|
+
res.each { |r| rows << r }
|
|
147
|
+
rows
|
|
148
|
+
end
|
|
147
149
|
end
|
|
150
|
+
rescue StandardError => e
|
|
151
|
+
@log.error("#{sql}: #{e.message}")
|
|
152
|
+
raise e
|
|
148
153
|
end
|
|
149
154
|
lag = Time.now - start
|
|
150
155
|
if lag < 1
|
data/lib/pgtk/version.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -24,9 +24,9 @@ require_relative '../pgtk'
|
|
|
24
24
|
|
|
25
25
|
# Pgtk version.
|
|
26
26
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
27
|
-
# Copyright:: Copyright (c) 2019-
|
|
27
|
+
# Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
|
|
28
28
|
# License:: MIT
|
|
29
29
|
module Pgtk
|
|
30
30
|
# Current version of the library.
|
|
31
|
-
VERSION = '0.
|
|
31
|
+
VERSION = '0.9.0'
|
|
32
32
|
end
|
data/lib/pgtk/wire.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -27,14 +27,14 @@ require_relative '../pgtk'
|
|
|
27
27
|
|
|
28
28
|
# Wires.
|
|
29
29
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
30
|
-
# Copyright:: Copyright (c) 2019-
|
|
30
|
+
# Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
|
|
31
31
|
# License:: MIT
|
|
32
32
|
module Pgtk::Wire
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
# Simple wire with details.
|
|
36
36
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
37
|
-
# Copyright:: Copyright (c) 2019-
|
|
37
|
+
# Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
|
|
38
38
|
# License:: MIT
|
|
39
39
|
class Pgtk::Wire::Direct
|
|
40
40
|
# Constructor.
|
|
@@ -59,7 +59,7 @@ end
|
|
|
59
59
|
|
|
60
60
|
# Using ENV variable.
|
|
61
61
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
62
|
-
# Copyright:: Copyright (c) 2019-
|
|
62
|
+
# Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
|
|
63
63
|
# License:: MIT
|
|
64
64
|
class Pgtk::Wire::Env
|
|
65
65
|
# Constructor.
|
|
@@ -85,7 +85,7 @@ end
|
|
|
85
85
|
|
|
86
86
|
# Using configuration from YAML file.
|
|
87
87
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
88
|
-
# Copyright:: Copyright (c) 2019-
|
|
88
|
+
# Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
|
|
89
89
|
# License:: MIT
|
|
90
90
|
class Pgtk::Wire::Yaml
|
|
91
91
|
# Constructor.
|
data/lib/pgtk.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
# Pgtk main module.
|
|
24
24
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
25
|
-
# Copyright:: Copyright (c) 2019-
|
|
25
|
+
# Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
|
|
26
26
|
# License:: MIT
|
|
27
27
|
module Pgtk
|
|
28
28
|
# Nothing here.
|
data/pgtk.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/resources/pom.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!--
|
|
3
3
|
(The MIT License)
|
|
4
4
|
|
|
5
|
-
Copyright (c) 2019-
|
|
5
|
+
Copyright (c) 2019-2024 Yegor Bugayenko
|
|
6
6
|
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
8
|
of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -26,13 +26,17 @@ SOFTWARE.
|
|
|
26
26
|
<modelVersion>4.0.0</modelVersion>
|
|
27
27
|
<groupId>pgtk</groupId>
|
|
28
28
|
<artifactId>pgtk</artifactId>
|
|
29
|
-
<version>
|
|
29
|
+
<version>0.0.0</version>
|
|
30
30
|
<packaging>pom</packaging>
|
|
31
|
+
<properties>
|
|
32
|
+
<postgresql.version>42.7.1</postgresql.version>
|
|
33
|
+
<liquibase.version>4.25.1</liquibase.version>
|
|
34
|
+
</properties>
|
|
31
35
|
<dependencies>
|
|
32
36
|
<dependency>
|
|
33
37
|
<groupId>org.postgresql</groupId>
|
|
34
38
|
<artifactId>postgresql</artifactId>
|
|
35
|
-
<version
|
|
39
|
+
<version>${postgresql.version}</version>
|
|
36
40
|
<scope>runtime</scope>
|
|
37
41
|
</dependency>
|
|
38
42
|
</dependencies>
|
|
@@ -41,7 +45,7 @@ SOFTWARE.
|
|
|
41
45
|
<plugin>
|
|
42
46
|
<groupId>org.liquibase</groupId>
|
|
43
47
|
<artifactId>liquibase-maven-plugin</artifactId>
|
|
44
|
-
<version
|
|
48
|
+
<version>${liquibase.version}</version>
|
|
45
49
|
<configuration>
|
|
46
50
|
<driver>org.postgresql.Driver</driver>
|
|
47
51
|
<logging>info</logging>
|
data/test/test__helper.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/test/test_liquibase_task.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -47,6 +47,8 @@ class TestLiquibaseTask < Minitest::Test
|
|
|
47
47
|
t.master = File.join(__dir__, '../test-resources/master.xml')
|
|
48
48
|
t.yaml = ['file-is-absent', File.join(dir, 'cfg.yml'), 'another']
|
|
49
49
|
t.quiet = true
|
|
50
|
+
t.postgresql_version = '42.7.0'
|
|
51
|
+
t.liquibase_version = '3.2.2'
|
|
50
52
|
end
|
|
51
53
|
Rake::Task['liquibase2'].invoke
|
|
52
54
|
end
|
data/test/test_pgsql_task.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/test/test_pool.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
3
|
+
# Copyright (c) 2019-2024 Yegor Bugayenko
|
|
4
4
|
#
|
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
|
@@ -53,6 +53,27 @@ class TestPool < Minitest::Test
|
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
def test_logs_sql
|
|
57
|
+
log = Loog::Buffer.new
|
|
58
|
+
bootstrap(log: log) do |pool|
|
|
59
|
+
pool.exec(
|
|
60
|
+
'INSERT INTO book (title) VALUES ($1)',
|
|
61
|
+
['Object Thinking']
|
|
62
|
+
)
|
|
63
|
+
assert(log.to_s.include?('INSERT INTO book (title) VALUES ($1)'))
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def test_logs_errors
|
|
68
|
+
log = Loog::Buffer.new
|
|
69
|
+
bootstrap(log: log) do |pool|
|
|
70
|
+
assert_raises PG::UndefinedTable do
|
|
71
|
+
pool.exec('INSERT INTO tableDoesNotExist (a) VALUES (42)')
|
|
72
|
+
end
|
|
73
|
+
assert(log.to_s.include?('INSERT INTO tableDoesNotExist'))
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
56
77
|
def test_transaction
|
|
57
78
|
bootstrap do |pool|
|
|
58
79
|
id = pool.transaction do |t|
|
|
@@ -116,7 +137,7 @@ class TestPool < Minitest::Test
|
|
|
116
137
|
|
|
117
138
|
private
|
|
118
139
|
|
|
119
|
-
def bootstrap
|
|
140
|
+
def bootstrap(log: Loog::VERBOSE)
|
|
120
141
|
Dir.mktmpdir 'test' do |dir|
|
|
121
142
|
id = rand(100..999)
|
|
122
143
|
Pgtk::PgsqlTask.new("pgsql#{id}") do |t|
|
|
@@ -136,7 +157,7 @@ class TestPool < Minitest::Test
|
|
|
136
157
|
Rake::Task["liquibase#{id}"].invoke
|
|
137
158
|
pool = Pgtk::Pool.new(
|
|
138
159
|
Pgtk::Wire::Yaml.new(File.join(dir, 'cfg.yml')),
|
|
139
|
-
log:
|
|
160
|
+
log: log
|
|
140
161
|
)
|
|
141
162
|
pool.start(1)
|
|
142
163
|
yield pool
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!--
|
|
3
3
|
(The MIT License)
|
|
4
4
|
|
|
5
|
-
Copyright (c) 2019-
|
|
5
|
+
Copyright (c) 2019-2024 Yegor Bugayenko
|
|
6
6
|
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
8
|
of this software and associated documentation files (the 'Software'), to deal
|
data/test-resources/master.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!--
|
|
3
3
|
(The MIT License)
|
|
4
4
|
|
|
5
|
-
Copyright (c) 2019-
|
|
5
|
+
Copyright (c) 2019-2024 Yegor Bugayenko
|
|
6
6
|
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
8
|
of this software and associated documentation files (the 'Software'), to deal
|
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.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-01-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: backtrace
|
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
243
243
|
- !ruby/object:Gem::Version
|
|
244
244
|
version: '0'
|
|
245
245
|
requirements: []
|
|
246
|
-
rubygems_version: 3.
|
|
246
|
+
rubygems_version: 3.4.10
|
|
247
247
|
signing_key:
|
|
248
248
|
specification_version: 4
|
|
249
249
|
summary: PostgreSQL ToolKit for Ruby apps
|