pgtk 0.9.6 → 0.11.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/actionlint.yml +1 -1
- data/.github/workflows/codecov.yml +6 -5
- data/.github/workflows/copyrights.yml +2 -2
- data/.github/workflows/license.yml +1 -1
- data/.github/workflows/markdown-lint.yml +1 -1
- data/.github/workflows/pdd.yml +1 -1
- data/.github/workflows/rake.yml +9 -8
- data/.github/workflows/xcop.yml +1 -1
- data/.github/workflows/yamllint.yml +1 -1
- data/.rubocop.yml +3 -3
- data/.rultor.yml +7 -1
- data/.yamllint.yml +1 -1
- data/Gemfile +7 -5
- data/Gemfile.lock +104 -76
- data/lib/pgtk/liquibase_task.rb +3 -3
- data/lib/pgtk/pgsql_task.rb +48 -28
- data/lib/pgtk/version.rb +1 -1
- data/pgtk.gemspec +9 -7
- data/resources/pom.xml +2 -2
- data/test/test__helper.rb +6 -0
- data/test/test_pgsql_task.rb +19 -1
- data/test/test_pool.rb +33 -10
- metadata +34 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5dcffe3ba23b17694740ccad32c11d2813f1606b4dfa9b93c63480ebb0e54299
|
|
4
|
+
data.tar.gz: b166a621155d4be6f8e7294d46b7a07ead34a711a17a3119cd34c289313d8f62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 522afdb2e8c28af25cffd7a298f7caa6e1d964f8551408b7c9200650013d4b2e17c59363e6826011b175269744fb0436a351a79d5d85c5eafcf97d38c2bd7a5a
|
|
7
|
+
data.tar.gz: fa0eae28c330618462229826c735b1802e483ae07db63f6a8cc617cfb41f2a70dcf40ddd1ec86ce33b5ea3ec605b47f6b50335f22d456cde919a7bbe8c852663
|
|
@@ -25,7 +25,7 @@ on:
|
|
|
25
25
|
- master
|
|
26
26
|
jobs:
|
|
27
27
|
codecov:
|
|
28
|
-
runs-on: ubuntu-
|
|
28
|
+
runs-on: ubuntu-24.04
|
|
29
29
|
steps:
|
|
30
30
|
- uses: actions/checkout@v4
|
|
31
31
|
- uses: ruby/setup-ruby@v1
|
|
@@ -34,12 +34,13 @@ jobs:
|
|
|
34
34
|
bundler-cache: true
|
|
35
35
|
- run: |
|
|
36
36
|
sudo apt-get update
|
|
37
|
-
sudo apt-get install -y postgresql-
|
|
38
|
-
sudo ln -s /usr/lib/postgresql
|
|
39
|
-
sudo ln -s /usr/lib/postgresql
|
|
37
|
+
sudo apt-get install -y libpq-dev postgresql-client postgresql
|
|
38
|
+
sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/initdb)" /bin/initdb
|
|
39
|
+
sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/postgres)" /bin/postgres
|
|
40
|
+
sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/pg_ctl)" /bin/pg_ctl
|
|
40
41
|
- run: bundle install
|
|
41
42
|
- run: bundle exec rake
|
|
42
|
-
- uses: codecov/codecov-action@
|
|
43
|
+
- uses: codecov/codecov-action@v5
|
|
43
44
|
with:
|
|
44
45
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
45
46
|
file: coverage/.resultset.json
|
data/.github/workflows/pdd.yml
CHANGED
data/.github/workflows/rake.yml
CHANGED
|
@@ -27,23 +27,24 @@ on:
|
|
|
27
27
|
branches:
|
|
28
28
|
- master
|
|
29
29
|
jobs:
|
|
30
|
-
|
|
31
|
-
name:
|
|
30
|
+
rake:
|
|
31
|
+
name: rake
|
|
32
32
|
strategy:
|
|
33
33
|
matrix:
|
|
34
|
-
os: [ubuntu-
|
|
35
|
-
ruby: [3.
|
|
34
|
+
os: [ubuntu-24.04]
|
|
35
|
+
ruby: [3.3]
|
|
36
36
|
runs-on: ${{ matrix.os }}
|
|
37
37
|
steps:
|
|
38
38
|
- uses: actions/checkout@v4
|
|
39
39
|
- run: |
|
|
40
40
|
sudo apt-get update
|
|
41
|
-
sudo apt-get install -y postgresql-
|
|
42
|
-
sudo ln -s /usr/lib/postgresql
|
|
43
|
-
sudo ln -s /usr/lib/postgresql
|
|
41
|
+
sudo apt-get install -y libpq-dev postgresql-client postgresql
|
|
42
|
+
sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/initdb)" /bin/initdb
|
|
43
|
+
sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/postgres)" /bin/postgres
|
|
44
|
+
sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/pg_ctl)" /bin/pg_ctl
|
|
44
45
|
- uses: ruby/setup-ruby@v1
|
|
45
46
|
with:
|
|
46
47
|
ruby-version: ${{ matrix.ruby }}
|
|
47
48
|
bundler-cache: true
|
|
48
|
-
- run: bundle
|
|
49
|
+
- run: bundle update
|
|
49
50
|
- run: bundle exec rake
|
data/.github/workflows/xcop.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -33,15 +33,15 @@ Style/ClassAndModuleChildren:
|
|
|
33
33
|
Layout/EndOfLine:
|
|
34
34
|
EnforcedStyle: lf
|
|
35
35
|
Metrics/BlockLength:
|
|
36
|
-
Max:
|
|
36
|
+
Max: 100
|
|
37
37
|
Layout/EmptyLineAfterGuardClause:
|
|
38
38
|
Enabled: false
|
|
39
39
|
Metrics/AbcSize:
|
|
40
|
-
Max:
|
|
40
|
+
Max: 100
|
|
41
41
|
Metrics/CyclomaticComplexity:
|
|
42
42
|
Max: 15
|
|
43
43
|
Metrics/ClassLength:
|
|
44
|
-
Max:
|
|
44
|
+
Max: 200
|
|
45
45
|
Metrics/MethodLength:
|
|
46
46
|
Max: 100
|
|
47
47
|
Metrics/PerceivedComplexity:
|
data/.rultor.yml
CHANGED
|
@@ -19,10 +19,16 @@
|
|
|
19
19
|
# SOFTWARE.
|
|
20
20
|
---
|
|
21
21
|
docker:
|
|
22
|
-
image: yegor256/rultor-
|
|
22
|
+
image: yegor256/rultor-java
|
|
23
23
|
assets:
|
|
24
24
|
rubygems.yml: yegor256/home#assets/rubygems.yml
|
|
25
25
|
install: |
|
|
26
|
+
sudo hostname docker
|
|
27
|
+
sudo apt-get update
|
|
28
|
+
sudo apt-get install -y libpq-dev postgresql-client postgresql
|
|
29
|
+
sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/initdb)" /bin/initdb
|
|
30
|
+
sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/postgres)" /bin/postgres
|
|
31
|
+
sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/pg_ctl)" /bin/pg_ctl
|
|
26
32
|
pdd -f /dev/null
|
|
27
33
|
bundle install --no-color
|
|
28
34
|
release:
|
data/.yamllint.yml
CHANGED
data/Gemfile
CHANGED
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
source 'https://rubygems.org'
|
|
24
24
|
gemspec
|
|
25
25
|
|
|
26
|
-
gem 'minitest', '5.
|
|
27
|
-
gem '
|
|
26
|
+
gem 'minitest', '5.25.4', require: false
|
|
27
|
+
gem 'minitest-reporters', '~>1.7', require: false
|
|
28
|
+
gem 'rack', '3.1.8', require: false
|
|
28
29
|
gem 'rake', '13.2.1', require: false
|
|
29
|
-
gem 'rspec-rails', '
|
|
30
|
-
gem 'rubocop', '1.
|
|
31
|
-
gem 'rubocop-rspec', '3.0
|
|
30
|
+
gem 'rspec-rails', '7.1.0', require: false
|
|
31
|
+
gem 'rubocop', '1.69.2', require: false
|
|
32
|
+
gem 'rubocop-rspec', '3.3.0', require: false
|
|
32
33
|
gem 'simplecov', '0.22.0', require: false
|
|
34
|
+
gem 'simplecov-cobertura', '~>2.1'
|
|
33
35
|
gem 'xcop', '0.7.1', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -2,180 +2,208 @@ PATH
|
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
4
|
pgtk (0.0.0)
|
|
5
|
-
backtrace (
|
|
6
|
-
loog (
|
|
5
|
+
backtrace (> 0)
|
|
6
|
+
loog (> 0)
|
|
7
7
|
pg (~> 1.1)
|
|
8
|
-
|
|
8
|
+
qbash (> 0)
|
|
9
|
+
random-port (> 0)
|
|
9
10
|
|
|
10
11
|
GEM
|
|
11
12
|
remote: https://rubygems.org/
|
|
12
13
|
specs:
|
|
13
|
-
actionpack (
|
|
14
|
-
actionview (=
|
|
15
|
-
activesupport (=
|
|
14
|
+
actionpack (8.0.1)
|
|
15
|
+
actionview (= 8.0.1)
|
|
16
|
+
activesupport (= 8.0.1)
|
|
16
17
|
nokogiri (>= 1.8.5)
|
|
17
|
-
racc
|
|
18
18
|
rack (>= 2.2.4)
|
|
19
19
|
rack-session (>= 1.0.1)
|
|
20
20
|
rack-test (>= 0.6.3)
|
|
21
21
|
rails-dom-testing (~> 2.2)
|
|
22
22
|
rails-html-sanitizer (~> 1.6)
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
useragent (~> 0.16)
|
|
24
|
+
actionview (8.0.1)
|
|
25
|
+
activesupport (= 8.0.1)
|
|
25
26
|
builder (~> 3.1)
|
|
26
27
|
erubi (~> 1.11)
|
|
27
28
|
rails-dom-testing (~> 2.2)
|
|
28
29
|
rails-html-sanitizer (~> 1.6)
|
|
29
|
-
activesupport (
|
|
30
|
+
activesupport (8.0.1)
|
|
30
31
|
base64
|
|
32
|
+
benchmark (>= 0.3)
|
|
31
33
|
bigdecimal
|
|
32
|
-
concurrent-ruby (~> 1.0, >= 1.
|
|
34
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
33
35
|
connection_pool (>= 2.2.5)
|
|
34
36
|
drb
|
|
35
37
|
i18n (>= 1.6, < 2)
|
|
38
|
+
logger (>= 1.4.2)
|
|
36
39
|
minitest (>= 5.1)
|
|
37
|
-
|
|
38
|
-
tzinfo (~> 2.0)
|
|
40
|
+
securerandom (>= 0.3)
|
|
41
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
42
|
+
uri (>= 0.13.1)
|
|
43
|
+
ansi (1.5.0)
|
|
39
44
|
ast (2.4.2)
|
|
40
45
|
backtrace (0.4.0)
|
|
41
46
|
base64 (0.2.0)
|
|
42
|
-
|
|
47
|
+
benchmark (0.4.0)
|
|
48
|
+
bigdecimal (3.1.9)
|
|
43
49
|
builder (3.3.0)
|
|
44
|
-
concurrent-ruby (1.3.
|
|
50
|
+
concurrent-ruby (1.3.4)
|
|
45
51
|
connection_pool (2.4.1)
|
|
46
52
|
crass (1.0.6)
|
|
53
|
+
date (3.4.1)
|
|
47
54
|
diff-lcs (1.5.1)
|
|
48
55
|
differ (0.1.2)
|
|
49
|
-
docile (1.4.
|
|
56
|
+
docile (1.4.1)
|
|
50
57
|
drb (2.2.1)
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
elapsed (0.0.1)
|
|
59
|
+
loog (> 0)
|
|
60
|
+
tago (> 0)
|
|
61
|
+
erubi (1.13.1)
|
|
62
|
+
i18n (1.14.6)
|
|
53
63
|
concurrent-ruby (~> 1.0)
|
|
54
|
-
io-console (0.
|
|
55
|
-
irb (1.14.
|
|
64
|
+
io-console (0.8.0)
|
|
65
|
+
irb (1.14.3)
|
|
56
66
|
rdoc (>= 4.0.0)
|
|
57
67
|
reline (>= 0.4.2)
|
|
58
|
-
json (2.
|
|
68
|
+
json (2.9.1)
|
|
59
69
|
language_server-protocol (3.17.0.3)
|
|
60
|
-
|
|
70
|
+
logger (1.6.4)
|
|
71
|
+
loofah (2.23.1)
|
|
61
72
|
crass (~> 1.0.2)
|
|
62
73
|
nokogiri (>= 1.12.0)
|
|
63
|
-
loog (0.
|
|
64
|
-
minitest (5.
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
loog (0.6.0)
|
|
75
|
+
minitest (5.25.4)
|
|
76
|
+
minitest-reporters (1.7.1)
|
|
77
|
+
ansi
|
|
78
|
+
builder
|
|
79
|
+
minitest (>= 5.0)
|
|
80
|
+
ruby-progressbar
|
|
81
|
+
nokogiri (1.18.0-arm64-darwin)
|
|
67
82
|
racc (~> 1.4)
|
|
68
|
-
nokogiri (1.
|
|
83
|
+
nokogiri (1.18.0-x86_64-linux-gnu)
|
|
69
84
|
racc (~> 1.4)
|
|
70
|
-
parallel (1.
|
|
71
|
-
parser (3.3.
|
|
85
|
+
parallel (1.26.3)
|
|
86
|
+
parser (3.3.6.0)
|
|
72
87
|
ast (~> 2.4.1)
|
|
73
88
|
racc
|
|
74
|
-
pg (1.5.
|
|
75
|
-
psych (5.
|
|
89
|
+
pg (1.5.9)
|
|
90
|
+
psych (5.2.2)
|
|
91
|
+
date
|
|
76
92
|
stringio
|
|
77
|
-
|
|
78
|
-
|
|
93
|
+
qbash (0.2.2)
|
|
94
|
+
backtrace (> 0)
|
|
95
|
+
elapsed (> 0)
|
|
96
|
+
loog (> 0)
|
|
97
|
+
tago (> 0)
|
|
98
|
+
racc (1.8.1)
|
|
99
|
+
rack (3.1.8)
|
|
79
100
|
rack-session (2.0.0)
|
|
80
101
|
rack (>= 3.0.0)
|
|
81
|
-
rack-test (2.
|
|
102
|
+
rack-test (2.2.0)
|
|
82
103
|
rack (>= 1.3)
|
|
83
|
-
rackup (2.1
|
|
104
|
+
rackup (2.2.1)
|
|
84
105
|
rack (>= 3)
|
|
85
|
-
webrick (~> 1.8)
|
|
86
106
|
rails-dom-testing (2.2.0)
|
|
87
107
|
activesupport (>= 5.0.0)
|
|
88
108
|
minitest
|
|
89
109
|
nokogiri (>= 1.6)
|
|
90
|
-
rails-html-sanitizer (1.6.
|
|
110
|
+
rails-html-sanitizer (1.6.2)
|
|
91
111
|
loofah (~> 2.21)
|
|
92
|
-
nokogiri (
|
|
93
|
-
railties (
|
|
94
|
-
actionpack (=
|
|
95
|
-
activesupport (=
|
|
96
|
-
irb
|
|
112
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
113
|
+
railties (8.0.1)
|
|
114
|
+
actionpack (= 8.0.1)
|
|
115
|
+
activesupport (= 8.0.1)
|
|
116
|
+
irb (~> 1.13)
|
|
97
117
|
rackup (>= 1.0.0)
|
|
98
118
|
rake (>= 12.2)
|
|
99
119
|
thor (~> 1.0, >= 1.2.2)
|
|
100
120
|
zeitwerk (~> 2.6)
|
|
101
121
|
rainbow (3.1.1)
|
|
102
122
|
rake (13.2.1)
|
|
103
|
-
random-port (0.7.
|
|
104
|
-
rdoc (6.
|
|
123
|
+
random-port (0.7.1)
|
|
124
|
+
rdoc (6.10.0)
|
|
105
125
|
psych (>= 4.0.0)
|
|
106
|
-
regexp_parser (2.
|
|
107
|
-
reline (0.
|
|
126
|
+
regexp_parser (2.10.0)
|
|
127
|
+
reline (0.6.0)
|
|
108
128
|
io-console (~> 0.5)
|
|
109
|
-
rexml (3.
|
|
110
|
-
|
|
111
|
-
rspec-core (3.13.0)
|
|
129
|
+
rexml (3.4.0)
|
|
130
|
+
rspec-core (3.13.2)
|
|
112
131
|
rspec-support (~> 3.13.0)
|
|
113
|
-
rspec-expectations (3.13.
|
|
132
|
+
rspec-expectations (3.13.3)
|
|
114
133
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
115
134
|
rspec-support (~> 3.13.0)
|
|
116
|
-
rspec-mocks (3.13.
|
|
135
|
+
rspec-mocks (3.13.2)
|
|
117
136
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
118
137
|
rspec-support (~> 3.13.0)
|
|
119
|
-
rspec-rails (
|
|
120
|
-
actionpack (>=
|
|
121
|
-
activesupport (>=
|
|
122
|
-
railties (>=
|
|
138
|
+
rspec-rails (7.1.0)
|
|
139
|
+
actionpack (>= 7.0)
|
|
140
|
+
activesupport (>= 7.0)
|
|
141
|
+
railties (>= 7.0)
|
|
123
142
|
rspec-core (~> 3.13)
|
|
124
143
|
rspec-expectations (~> 3.13)
|
|
125
144
|
rspec-mocks (~> 3.13)
|
|
126
145
|
rspec-support (~> 3.13)
|
|
127
|
-
rspec-support (3.13.
|
|
128
|
-
rubocop (1.
|
|
146
|
+
rspec-support (3.13.2)
|
|
147
|
+
rubocop (1.69.2)
|
|
129
148
|
json (~> 2.3)
|
|
130
149
|
language_server-protocol (>= 3.17.0)
|
|
131
150
|
parallel (~> 1.10)
|
|
132
151
|
parser (>= 3.3.0.2)
|
|
133
152
|
rainbow (>= 2.2.2, < 4.0)
|
|
134
|
-
regexp_parser (>= 2.
|
|
135
|
-
|
|
136
|
-
rubocop-ast (>= 1.31.1, < 2.0)
|
|
153
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
154
|
+
rubocop-ast (>= 1.36.2, < 2.0)
|
|
137
155
|
ruby-progressbar (~> 1.7)
|
|
138
|
-
unicode-display_width (>= 2.4.0, <
|
|
139
|
-
rubocop-ast (1.
|
|
156
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
157
|
+
rubocop-ast (1.37.0)
|
|
140
158
|
parser (>= 3.3.1.0)
|
|
141
|
-
rubocop-rspec (3.0
|
|
159
|
+
rubocop-rspec (3.3.0)
|
|
142
160
|
rubocop (~> 1.61)
|
|
143
161
|
ruby-progressbar (1.13.0)
|
|
162
|
+
securerandom (0.4.1)
|
|
144
163
|
simplecov (0.22.0)
|
|
145
164
|
docile (~> 1.1)
|
|
146
165
|
simplecov-html (~> 0.11)
|
|
147
166
|
simplecov_json_formatter (~> 0.1)
|
|
148
|
-
simplecov-
|
|
167
|
+
simplecov-cobertura (2.1.0)
|
|
168
|
+
rexml
|
|
169
|
+
simplecov (~> 0.19)
|
|
170
|
+
simplecov-html (0.13.1)
|
|
149
171
|
simplecov_json_formatter (0.1.4)
|
|
150
172
|
slop (4.10.1)
|
|
151
|
-
stringio (3.1.
|
|
152
|
-
|
|
153
|
-
thor (1.3.
|
|
173
|
+
stringio (3.1.2)
|
|
174
|
+
tago (0.0.2)
|
|
175
|
+
thor (1.3.2)
|
|
154
176
|
tzinfo (2.0.6)
|
|
155
177
|
concurrent-ruby (~> 1.0)
|
|
156
|
-
unicode-display_width (
|
|
157
|
-
|
|
178
|
+
unicode-display_width (3.1.2)
|
|
179
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
180
|
+
unicode-emoji (4.0.4)
|
|
181
|
+
uri (1.0.2)
|
|
182
|
+
useragent (0.16.11)
|
|
158
183
|
xcop (0.7.1)
|
|
159
184
|
differ (~> 0.1.2)
|
|
160
185
|
nokogiri (~> 1.10)
|
|
161
186
|
rainbow (~> 3.0)
|
|
162
187
|
slop (~> 4.4)
|
|
163
|
-
zeitwerk (2.
|
|
188
|
+
zeitwerk (2.7.1)
|
|
164
189
|
|
|
165
190
|
PLATFORMS
|
|
166
191
|
arm64-darwin-22
|
|
192
|
+
arm64-darwin-24
|
|
167
193
|
x86_64-linux
|
|
168
194
|
|
|
169
195
|
DEPENDENCIES
|
|
170
|
-
minitest (= 5.
|
|
196
|
+
minitest (= 5.25.4)
|
|
197
|
+
minitest-reporters (~> 1.7)
|
|
171
198
|
pgtk!
|
|
172
|
-
rack (= 3.1.
|
|
199
|
+
rack (= 3.1.8)
|
|
173
200
|
rake (= 13.2.1)
|
|
174
|
-
rspec-rails (=
|
|
175
|
-
rubocop (= 1.
|
|
176
|
-
rubocop-rspec (= 3.0
|
|
201
|
+
rspec-rails (= 7.1.0)
|
|
202
|
+
rubocop (= 1.69.2)
|
|
203
|
+
rubocop-rspec (= 3.3.0)
|
|
177
204
|
simplecov (= 0.22.0)
|
|
205
|
+
simplecov-cobertura (~> 2.1)
|
|
178
206
|
xcop (= 0.7.1)
|
|
179
207
|
|
|
180
208
|
BUNDLED WITH
|
|
181
|
-
2.5.
|
|
209
|
+
2.5.16
|
data/lib/pgtk/liquibase_task.rb
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
# SOFTWARE.
|
|
22
22
|
|
|
23
23
|
require 'English'
|
|
24
|
+
require 'qbash'
|
|
24
25
|
require 'rake'
|
|
25
26
|
require 'rake/tasklib'
|
|
26
27
|
require 'shellwords'
|
|
@@ -79,7 +80,7 @@ class Pgtk::LiquibaseTask < Rake::TaskLib
|
|
|
79
80
|
password = yml['pgsql']['password']
|
|
80
81
|
raise "The 'password' is not set in the config (YAML)" if password.nil?
|
|
81
82
|
Dir.chdir(File.dirname(@master)) do
|
|
82
|
-
|
|
83
|
+
qbash(
|
|
83
84
|
[
|
|
84
85
|
'mvn verify',
|
|
85
86
|
'--errors',
|
|
@@ -101,9 +102,8 @@ class Pgtk::LiquibaseTask < Rake::TaskLib
|
|
|
101
102
|
'--define',
|
|
102
103
|
"liquibase.password=#{Shellwords.escape(password)}",
|
|
103
104
|
'2>&1'
|
|
104
|
-
]
|
|
105
|
+
]
|
|
105
106
|
)
|
|
106
107
|
end
|
|
107
|
-
raise unless $CHILD_STATUS.exitstatus.zero?
|
|
108
108
|
end
|
|
109
109
|
end
|
data/lib/pgtk/pgsql_task.rb
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
require 'cgi'
|
|
24
24
|
require 'English'
|
|
25
|
+
require 'qbash'
|
|
25
26
|
require 'rake'
|
|
26
27
|
require 'rake/tasklib'
|
|
27
28
|
require 'random-port'
|
|
@@ -63,55 +64,74 @@ class Pgtk::PgsqlTask < Rake::TaskLib
|
|
|
63
64
|
home = File.expand_path(@dir)
|
|
64
65
|
FileUtils.rm_rf(home) if @fresh_start
|
|
65
66
|
raise "Directory/file #{home} is present, use fresh_start=true" if File.exist?(home)
|
|
66
|
-
|
|
67
|
+
stdout = @quiet ? nil : $stdout
|
|
67
68
|
Tempfile.open do |pwfile|
|
|
68
69
|
File.write(pwfile.path, @password)
|
|
69
|
-
|
|
70
|
+
qbash(
|
|
70
71
|
[
|
|
71
|
-
'initdb
|
|
72
|
-
|
|
72
|
+
'initdb',
|
|
73
|
+
'--auth=trust',
|
|
74
|
+
'-D',
|
|
75
|
+
Shellwords.escape(home),
|
|
73
76
|
'--username',
|
|
74
77
|
Shellwords.escape(@user),
|
|
75
78
|
'--pwfile',
|
|
76
|
-
Shellwords.escape(pwfile.path)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
Shellwords.escape(pwfile.path)
|
|
80
|
+
],
|
|
81
|
+
log: stdout
|
|
79
82
|
)
|
|
80
83
|
end
|
|
81
|
-
raise unless $CHILD_STATUS.exitstatus.zero?
|
|
82
84
|
port = @port
|
|
83
85
|
if port.nil?
|
|
84
86
|
port = RandomPort::Pool::SINGLETON.acquire
|
|
85
|
-
puts "Random TCP port #{port} is used"
|
|
87
|
+
puts "Random TCP port #{port} is used for PostgreSQL server" unless @quiet
|
|
86
88
|
else
|
|
87
|
-
puts "Required TCP port #{port} is used"
|
|
89
|
+
puts "Required TCP port #{port} is used for PostgreSQL server" unless @quiet
|
|
88
90
|
end
|
|
89
|
-
|
|
91
|
+
cmd = [
|
|
92
|
+
'postgres',
|
|
93
|
+
'-k', Shellwords.escape(home),
|
|
94
|
+
'-D', Shellwords.escape(home),
|
|
95
|
+
'-c', Shellwords.escape("log_directory=#{home}"),
|
|
96
|
+
'-c', 'logging_collector=on',
|
|
97
|
+
'-c', 'log_statement=all',
|
|
98
|
+
'-c', 'log_filename=pgsql.log',
|
|
99
|
+
"--port=#{port}"
|
|
100
|
+
].join(' ')
|
|
101
|
+
pid = Process.spawn(
|
|
102
|
+
cmd,
|
|
103
|
+
$stdout => File.join(home, 'stdout.txt'),
|
|
104
|
+
$stderr => File.join(home, 'stderr.txt')
|
|
105
|
+
)
|
|
90
106
|
File.write(File.join(@dir, 'pid'), pid)
|
|
91
107
|
at_exit do
|
|
92
|
-
|
|
93
|
-
puts "PostgreSQL killed in PID #{pid}"
|
|
108
|
+
qbash("kill -TERM #{pid}", log: stdout)
|
|
109
|
+
puts "PostgreSQL killed in PID #{pid}" unless @quiet
|
|
94
110
|
end
|
|
95
|
-
sleep 1
|
|
96
111
|
attempt = 0
|
|
97
112
|
begin
|
|
98
|
-
|
|
99
|
-
[
|
|
100
|
-
"createdb -h localhost -p #{port}",
|
|
101
|
-
'--username',
|
|
102
|
-
Shellwords.escape(@user),
|
|
103
|
-
Shellwords.escape(@dbname),
|
|
104
|
-
out
|
|
105
|
-
].join(' ')
|
|
106
|
-
)
|
|
107
|
-
raise unless $CHILD_STATUS.exitstatus.zero?
|
|
113
|
+
TCPSocket.new('localhost', port)
|
|
108
114
|
rescue StandardError => e
|
|
109
|
-
|
|
110
|
-
sleep(5)
|
|
115
|
+
sleep(0.1)
|
|
111
116
|
attempt += 1
|
|
112
|
-
|
|
117
|
+
if attempt > 50
|
|
118
|
+
puts "+ #{cmd}"
|
|
119
|
+
puts "stdout:\n#{File.read(File.join(home, 'stdout.txt'))}"
|
|
120
|
+
puts "stderr:\n#{File.read(File.join(home, 'stderr.txt'))}"
|
|
121
|
+
raise "Failed to start PostgreSQL database server on port #{port}: #{e.message}"
|
|
122
|
+
end
|
|
113
123
|
retry
|
|
114
124
|
end
|
|
125
|
+
qbash(
|
|
126
|
+
[
|
|
127
|
+
'createdb',
|
|
128
|
+
'--host', 'localhost',
|
|
129
|
+
'--port', Shellwords.escape(port),
|
|
130
|
+
'--username', Shellwords.escape(@user),
|
|
131
|
+
Shellwords.escape(@dbname)
|
|
132
|
+
],
|
|
133
|
+
log: stdout
|
|
134
|
+
)
|
|
115
135
|
File.write(
|
|
116
136
|
@yaml,
|
|
117
137
|
{
|
|
@@ -128,6 +148,6 @@ class Pgtk::PgsqlTask < Rake::TaskLib
|
|
|
128
148
|
}
|
|
129
149
|
}.to_yaml
|
|
130
150
|
)
|
|
131
|
-
puts "PostgreSQL has been started in process ##{pid}, port #{port}"
|
|
151
|
+
puts "PostgreSQL has been started in process ##{pid}, port #{port}" unless @quiet
|
|
132
152
|
end
|
|
133
153
|
end
|
data/lib/pgtk/version.rb
CHANGED
data/pgtk.gemspec
CHANGED
|
@@ -32,9 +32,10 @@ Gem::Specification.new do |s|
|
|
|
32
32
|
s.version = Pgtk::VERSION
|
|
33
33
|
s.license = 'MIT'
|
|
34
34
|
s.summary = 'PostgreSQL ToolKit for Ruby apps'
|
|
35
|
-
s.description =
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
s.description =
|
|
36
|
+
'This small Ruby gem helps you integrate PostgreSQL ' \
|
|
37
|
+
'with your Ruby web app, through Liquibase. It also adds a simple ' \
|
|
38
|
+
'connection pool and query processor, to make SQL manipulation simpler.'
|
|
38
39
|
s.authors = ['Yegor Bugayenko']
|
|
39
40
|
s.email = 'yegor256@gmail.com'
|
|
40
41
|
s.homepage = 'http://github.com/yegor256/pgtk'
|
|
@@ -42,9 +43,10 @@ connection pool and query processor, to make SQL manipulation simpler.'
|
|
|
42
43
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
43
44
|
s.rdoc_options = ['--charset=UTF-8']
|
|
44
45
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
|
45
|
-
s.add_dependency 'backtrace', '
|
|
46
|
-
s.add_dependency 'loog', '
|
|
47
|
-
s.add_dependency 'pg', '~>
|
|
48
|
-
s.add_dependency '
|
|
46
|
+
s.add_dependency 'backtrace', '>0'
|
|
47
|
+
s.add_dependency 'loog', '>0'
|
|
48
|
+
s.add_dependency 'pg', '~>1.1'
|
|
49
|
+
s.add_dependency 'qbash', '>0'
|
|
50
|
+
s.add_dependency 'random-port', '>0'
|
|
49
51
|
s.metadata['rubygems_mfa_required'] = 'true'
|
|
50
52
|
end
|
data/resources/pom.xml
CHANGED
|
@@ -29,8 +29,8 @@ SOFTWARE.
|
|
|
29
29
|
<version>0.0.0</version>
|
|
30
30
|
<packaging>pom</packaging>
|
|
31
31
|
<properties>
|
|
32
|
-
<postgresql.version>42.7.
|
|
33
|
-
<liquibase.version>4.
|
|
32
|
+
<postgresql.version>42.7.4</postgresql.version>
|
|
33
|
+
<liquibase.version>4.30.0</liquibase.version>
|
|
34
34
|
</properties>
|
|
35
35
|
<dependencies>
|
|
36
36
|
<dependency>
|
data/test/test__helper.rb
CHANGED
|
@@ -25,5 +25,11 @@ $stdout.sync = true
|
|
|
25
25
|
require 'simplecov'
|
|
26
26
|
SimpleCov.start
|
|
27
27
|
|
|
28
|
+
require 'simplecov-cobertura'
|
|
29
|
+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
|
30
|
+
|
|
31
|
+
require 'minitest/reporters'
|
|
32
|
+
Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
|
|
33
|
+
|
|
28
34
|
require 'minitest/autorun'
|
|
29
35
|
require_relative '../lib/pgtk'
|
data/test/test_pgsql_task.rb
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
# SOFTWARE.
|
|
22
22
|
|
|
23
23
|
require 'minitest/autorun'
|
|
24
|
-
require 'tmpdir'
|
|
25
24
|
require 'rake'
|
|
25
|
+
require 'tmpdir'
|
|
26
26
|
require 'yaml'
|
|
27
27
|
require_relative '../lib/pgtk/pgsql_task'
|
|
28
28
|
|
|
@@ -44,6 +44,24 @@ class TestPgsqlTask < Minitest::Test
|
|
|
44
44
|
Rake::Task['p2'].invoke
|
|
45
45
|
yaml = YAML.load_file(File.join(dir, 'cfg.yml'))
|
|
46
46
|
assert(yaml['pgsql']['url'].start_with?('jdbc:postgresql://localhost'))
|
|
47
|
+
assert(File.exist?(File.join(dir, 'pgsql/pgsql.log')))
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_not_quiet
|
|
52
|
+
Dir.mktmpdir 'test' do |dir|
|
|
53
|
+
Pgtk::PgsqlTask.new(:p3) do |t|
|
|
54
|
+
t.dir = File.join(dir, 'pgsql')
|
|
55
|
+
t.user = 'hello'
|
|
56
|
+
t.password = 'the password'
|
|
57
|
+
t.dbname = 'test'
|
|
58
|
+
t.yaml = File.join(dir, 'cfg.yml')
|
|
59
|
+
t.quiet = false
|
|
60
|
+
end
|
|
61
|
+
Rake::Task['p3'].invoke
|
|
62
|
+
yaml = YAML.load_file(File.join(dir, 'cfg.yml'))
|
|
63
|
+
assert(yaml['pgsql']['url'].start_with?('jdbc:postgresql://localhost'))
|
|
64
|
+
assert(File.exist?(File.join(dir, 'pgsql/pgsql.log')))
|
|
47
65
|
end
|
|
48
66
|
end
|
|
49
67
|
end
|
data/test/test_pool.rb
CHANGED
|
@@ -20,14 +20,15 @@
|
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
# SOFTWARE.
|
|
22
22
|
|
|
23
|
+
require 'loog'
|
|
23
24
|
require 'minitest/autorun'
|
|
24
|
-
require 'tmpdir'
|
|
25
25
|
require 'pg'
|
|
26
|
+
require 'qbash'
|
|
26
27
|
require 'rake'
|
|
28
|
+
require 'tmpdir'
|
|
27
29
|
require 'yaml'
|
|
28
|
-
require 'loog'
|
|
29
|
-
require_relative '../lib/pgtk/pgsql_task'
|
|
30
30
|
require_relative '../lib/pgtk/liquibase_task'
|
|
31
|
+
require_relative '../lib/pgtk/pgsql_task'
|
|
31
32
|
require_relative '../lib/pgtk/pool'
|
|
32
33
|
|
|
33
34
|
# Pool test.
|
|
@@ -127,7 +128,7 @@ class TestPool < Minitest::Test
|
|
|
127
128
|
t.password = 'A B C привет ! & | !'
|
|
128
129
|
t.dbname = 'test'
|
|
129
130
|
t.yaml = File.join(dir, 'cfg.yml')
|
|
130
|
-
t.quiet =
|
|
131
|
+
t.quiet = false
|
|
131
132
|
t.fresh_start = true
|
|
132
133
|
t.port = port
|
|
133
134
|
end
|
|
@@ -139,15 +140,37 @@ class TestPool < Minitest::Test
|
|
|
139
140
|
)
|
|
140
141
|
pool.start(1)
|
|
141
142
|
pool.exec('SELECT * FROM pg_catalog.pg_tables')
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
qbash("pg_ctl -D #{Shellwords.escape(File.join(dir, 'pgsql'))} stop", log: $stdout)
|
|
144
|
+
cycle = 0
|
|
145
|
+
loop do
|
|
146
|
+
begin
|
|
147
|
+
TCPSocket.new('localhost', port)
|
|
148
|
+
sleep(0.1)
|
|
149
|
+
cycle += 1
|
|
150
|
+
if cycle > 50
|
|
151
|
+
qbash('ps -ax | grep postgres')
|
|
152
|
+
raise "Can't stop running postgres at port #{port}, for some reason"
|
|
153
|
+
end
|
|
154
|
+
rescue StandardError => e
|
|
155
|
+
puts e.message
|
|
156
|
+
break
|
|
157
|
+
end
|
|
158
|
+
end
|
|
147
159
|
assert_raises(PG::UnableToSend, PG::ConnectionBad) do
|
|
148
160
|
pool.exec('SELECT * FROM pg_catalog.pg_tables')
|
|
149
161
|
end
|
|
150
|
-
|
|
162
|
+
task.reenable
|
|
163
|
+
task.invoke
|
|
164
|
+
loop do
|
|
165
|
+
begin
|
|
166
|
+
pool.exec('SELECT * FROM pg_catalog.pg_tables')
|
|
167
|
+
break
|
|
168
|
+
rescue StandardError => e
|
|
169
|
+
puts e.message
|
|
170
|
+
sleep(0.1)
|
|
171
|
+
retry
|
|
172
|
+
end
|
|
173
|
+
end
|
|
151
174
|
end
|
|
152
175
|
end
|
|
153
176
|
|
metadata
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pgtk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-12-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: backtrace
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0
|
|
19
|
+
version: '0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - ">"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0
|
|
26
|
+
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: loog
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - ">"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0
|
|
33
|
+
version: '0'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - "
|
|
38
|
+
- - ">"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0
|
|
40
|
+
version: '0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: pg
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,24 +52,37 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '1.1'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: qbash
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: random-port
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
58
72
|
requirements:
|
|
59
|
-
- - "
|
|
73
|
+
- - ">"
|
|
60
74
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0
|
|
75
|
+
version: '0'
|
|
62
76
|
type: :runtime
|
|
63
77
|
prerelease: false
|
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
79
|
requirements:
|
|
66
|
-
- - "
|
|
80
|
+
- - ">"
|
|
67
81
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0
|
|
69
|
-
description:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
connection pool and query processor, to make SQL manipulation simpler.
|
|
82
|
+
version: '0'
|
|
83
|
+
description: This small Ruby gem helps you integrate PostgreSQL with your Ruby web
|
|
84
|
+
app, through Liquibase. It also adds a simple connection pool and query processor,
|
|
85
|
+
to make SQL manipulation simpler.
|
|
73
86
|
email: yegor256@gmail.com
|
|
74
87
|
executables: []
|
|
75
88
|
extensions: []
|
|
@@ -120,7 +133,7 @@ licenses:
|
|
|
120
133
|
- MIT
|
|
121
134
|
metadata:
|
|
122
135
|
rubygems_mfa_required: 'true'
|
|
123
|
-
post_install_message:
|
|
136
|
+
post_install_message:
|
|
124
137
|
rdoc_options:
|
|
125
138
|
- "--charset=UTF-8"
|
|
126
139
|
require_paths:
|
|
@@ -137,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
137
150
|
version: '0'
|
|
138
151
|
requirements: []
|
|
139
152
|
rubygems_version: 3.4.10
|
|
140
|
-
signing_key:
|
|
153
|
+
signing_key:
|
|
141
154
|
specification_version: 4
|
|
142
155
|
summary: PostgreSQL ToolKit for Ruby apps
|
|
143
156
|
test_files: []
|