pgtk 0.29.2 → 0.29.3

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: 88629ebcfef471a523b2b9cbec16eab60a49cc8c08a3a277c293db1b49babb3c
4
- data.tar.gz: 3a6b0a8a313fac7d034f6714b3a6c2b5d5801788e21794a2bd3e642eb85968ee
3
+ metadata.gz: ed1f139f521063e30992649b32a67bc125d5cd2ae549e56da21c0e88b600455b
4
+ data.tar.gz: 3994612c8c3856d246e6a28a5656e23033aa4cfe8433ca6d8d75dfaaa7d5d41b
5
5
  SHA512:
6
- metadata.gz: 874afd6bc48dc18a48ec686c396f73f7dbd999802ec9f67236e11576808451642bdcb36a0d9a2938eb9cee35e8c00140e3cd75193d75b8301c0eae36cb7e9408
7
- data.tar.gz: 97e5c27aacbc29a04805b24304766a2bc329829ecff64f0032dc84287d0b47656582ecb4f3c63dfc4870796fd2664d9df9057b7d09b08d84c75a1d6fb9c6ac52
6
+ metadata.gz: a5957d0bb3e4921d457726aaae131ee0356f5aac2cfe8dcd0d2df658742822026fd84f098c6da3d62078d27bf70bc3096b98d7a9c625f5464f1d5efb51ce3874
7
+ data.tar.gz: 9294d02de72588841dac47a066b7833e25bd0532d5c3a92a3f7ac7d1f59acd1b51277f1f127c897cae023b57dceea6e4a210bc2dcedcab416db8518397bd0709
@@ -91,9 +91,14 @@ class Pgtk::PgsqlTask < Rake::TaskLib
91
91
  private
92
92
 
93
93
  def run
94
- local = qbash('postgres -V; initdb -V', accept: nil, both: true)[1].zero?
95
- docker = qbash('docker -v', accept: nil, both: true)[1].zero?
96
- raise 'You must have PostgreSQL or Docker installed locally' unless local && docker
94
+ pg_out = qbash('postgres -V; initdb -V', accept: nil, both: true)
95
+ local = pg_out[1].zero?
96
+ docker_out = qbash('docker -v', accept: nil, both: true)
97
+ docker = docker_out[1].zero?
98
+ unless local || docker
99
+ raise \
100
+ "Failed to find either PostgreSQL or Docker:\n#{pg_out.first}\n#{docker_out.first}"
101
+ end
97
102
  raise 'You cannot force Docker to run, because it is not installed locally' if @force_docker && !docker
98
103
  raise "Option 'dir' is mandatory" unless @dir
99
104
  raise "Option 'yaml' is mandatory" unless @yaml
@@ -143,7 +148,6 @@ class Pgtk::PgsqlTask < Rake::TaskLib
143
148
  [
144
149
  'docker',
145
150
  'run',
146
- '--name pgtk',
147
151
  "--publish #{port}:5432",
148
152
  "-e POSTGRES_USER=#{Shellwords.escape(@user)}",
149
153
  "-e POSTGRES_PASSWORD=#{Shellwords.escape(@password)}",
@@ -158,8 +162,10 @@ class Pgtk::PgsqlTask < Rake::TaskLib
158
162
  container = out.scan(/[a-f0-9]+\Z/).first
159
163
  File.write(File.join(home, 'docker-container'), container)
160
164
  at_exit do
161
- qbash("docker stop #{container}")
162
- puts "PostgreSQL docker container #{container.inspect} was stopped" unless @quiet
165
+ if qbash("docker ps --format '{{.ID}}' --no-trunc | grep '#{container}'", both: true, accept: nil)[1].zero?
166
+ qbash("docker stop #{container}")
167
+ puts "PostgreSQL docker container #{container.inspect} was stopped" unless @quiet
168
+ end
163
169
  end
164
170
  begin
165
171
  WaitUtil.wait_for_service('PG in Docker', 'localhost', port, timeout_sec: 10, delay_sec: 0.1)
data/lib/pgtk/version.rb CHANGED
@@ -11,5 +11,5 @@ require_relative '../pgtk'
11
11
  # License:: MIT
12
12
  module Pgtk
13
13
  # Current version of the library.
14
- VERSION = '0.29.2'
14
+ VERSION = '0.29.3'
15
15
  end
data/lib/pgtk/wire.rb CHANGED
@@ -70,11 +70,11 @@ class Pgtk::Wire::Env
70
70
  raise "The environment variable #{@var.inspect} is not set" if v.nil?
71
71
  uri = URI(v)
72
72
  Pgtk::Wire::Direct.new(
73
- host: uri.host,
73
+ host: CGI.unescape(uri.host),
74
74
  port: uri.port,
75
- dbname: uri.path[1..],
76
- user: uri.userinfo.split(':')[0],
77
- password: uri.userinfo.split(':')[1]
75
+ dbname: CGI.unescape(uri.path[1..]),
76
+ user: CGI.unescape(uri.userinfo.split(':')[0]),
77
+ password: CGI.unescape(uri.userinfo.split(':')[1])
78
78
  ).connection
79
79
  end
80
80
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.2
4
+ version: 0.29.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko