pgsync 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2005fe5d8c3aa978ebb5f85d2076e81ee1022564382a6401437c5c683a4968a2
4
- data.tar.gz: 333ac51419e6e6ee8091a14ee78e4e8d1aa7559bdbd13384a27352f35641e9e9
3
+ metadata.gz: b57c0423d780695d7379788efa869966318b23e3d8b9d92c8218ffb4cdee8609
4
+ data.tar.gz: 8e07cdad5a540c72df19ebdcbcc0e1c0e9930b6c4b1eb46f0bf318cada503bdc
5
5
  SHA512:
6
- metadata.gz: 0a90323a6a4d2829c0e62c2d3d78245e9978a1c051da7c0913ce1f9a91a4f01bd0a6d80d14d2dbc49b63a0943c492e71d0191a458d3a2e16f0480c59078b7ee4
7
- data.tar.gz: 8d9fa803daf091baa26afc26eba40bdc720b5836651c101bd53ce0e24f9fa9179f49577b61426e1a3315a5bb7fd90c815bfab54a40fb90376756c10392cccef4
6
+ metadata.gz: b91a30483535b049852ef679fe5944f065db7c56825a147775a904290c4a1e6221bfde512d7509cd475d97e5c8586c1107870cea4f19407782cd2f7caba88fc7
7
+ data.tar.gz: fbd6e09e5231a89824098c193d58f2debd90005df01fa432aff546e72ffc0b7ec6b951a237fb65f09ce640f28f6c660b29c77bc231744378055fe8b53e643b34
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.7.3 (2022-11-09)
2
+
3
+ - Fixed issue with pg 1.4.4
4
+ - Fixed output when `pg_restore` not found
5
+
1
6
  ## 0.7.2 (2022-09-19)
2
7
 
3
8
  - Improved error message when a primary key is required
data/README.md CHANGED
@@ -19,7 +19,13 @@ pgsync is a command line tool. To install, run:
19
19
  gem install pgsync
20
20
  ```
21
21
 
22
- This will give you the `pgsync` command. You can also install it with [Homebrew](#homebrew) or [Docker](#docker). If installation fails, you may need to install [dependencies](#dependencies).
22
+ This will give you the `pgsync` command. If installation fails, you may need to install [dependencies](#dependencies).
23
+
24
+ You can also install it with Homebrew:
25
+
26
+ ```sh
27
+ brew install pgsync
28
+ ```
23
29
 
24
30
  ## Setup
25
31
 
@@ -347,23 +353,13 @@ Bundler.with_unbundled_env do
347
353
  end
348
354
  ```
349
355
 
350
- ## Additional Installation Methods
351
-
352
- ### Homebrew
353
-
354
- With Homebrew, you can use:
355
-
356
- ```sh
357
- brew install ankane/brew/pgsync
358
- ```
359
-
360
- ### Docker
356
+ ## Docker
361
357
 
362
358
  Get the [Docker image](https://hub.docker.com/r/ankane/pgsync) with:
363
359
 
364
360
  ```sh
365
361
  docker pull ankane/pgsync
366
- alias pgsync="docker run --rm ankane/pgsync"
362
+ alias pgsync="docker run -ti ankane/pgsync"
367
363
  ```
368
364
 
369
365
  This will give you the `pgsync` command.
@@ -399,6 +395,18 @@ gem install specific_install
399
395
  gem specific_install https://github.com/ankane/pgsync.git
400
396
  ```
401
397
 
398
+ With Homebrew, run:
399
+
400
+ ```sh
401
+ brew upgrade pgsync
402
+ ```
403
+
404
+ With Docker, run:
405
+
406
+ ```sh
407
+ docker pull ankane/pgsync
408
+ ```
409
+
402
410
  ## Related Projects
403
411
 
404
412
  Also check out:
@@ -19,11 +19,11 @@ module PgSync
19
19
  end
20
20
 
21
21
  def host
22
- @host ||= conninfo[:host]
22
+ @host ||= dedup_localhost(conninfo[:host])
23
23
  end
24
24
 
25
25
  def port
26
- @port ||= conninfo[:port]
26
+ @port ||= dedup_localhost(conninfo[:port])
27
27
  end
28
28
 
29
29
  def dbname
@@ -189,5 +189,15 @@ module PgSync
189
189
  conn.conninfo_hash
190
190
  end
191
191
  end
192
+
193
+ # for pg 1.4.4
194
+ # https://github.com/ged/ruby-pg/issues/490
195
+ def dedup_localhost(value)
196
+ if conninfo[:host] == "localhost,localhost" && conninfo[:port].to_s.split(",").uniq.size == 1
197
+ value.split(",")[0]
198
+ else
199
+ value
200
+ end
201
+ end
192
202
  end
193
203
  end
@@ -17,6 +17,11 @@ module PgSync
17
17
  raise Error, "Cannot use --preserve with --schema-first or --schema-only"
18
18
  end
19
19
 
20
+ # generate commands before starting spinner
21
+ # for better error output if pg_restore not found
22
+ dump_command = dump_command()
23
+ restore_command = restore_command()
24
+
20
25
  show_spinner = output.tty? && !opts[:debug]
21
26
 
22
27
  if show_spinner
@@ -29,7 +34,7 @@ module PgSync
29
34
  # if spinner, capture lines to show on error
30
35
  lines = []
31
36
  success =
32
- run_command do |line|
37
+ run_command(dump_command, restore_command) do |line|
33
38
  if show_spinner
34
39
  lines << line
35
40
  else
@@ -51,7 +56,7 @@ module PgSync
51
56
 
52
57
  private
53
58
 
54
- def run_command
59
+ def run_command(dump_command, restore_command)
55
60
  err_r, err_w = IO.pipe
56
61
  Open3.pipeline_start(dump_command, restore_command, err: err_w) do |wait_thrs|
57
62
  err_w.close
@@ -1,3 +1,3 @@
1
1
  module PgSync
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-19 00:00:00.000000000 Z
11
+ date: 2022-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel