pgai 0.1.5 → 0.1.7

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: a31b2fc8c0e25d189cd3f3191a8e1833de2cbe8f21dfe5e4322793fea1aa4efd
4
- data.tar.gz: 6061e6095d92912eb7d5a2f64fe95740314494ff23aefab32afe4e9b15d77d3b
3
+ metadata.gz: '028a01e72ff3ca2ffa39e2cf32e400b2e375d79da46f65c51f746d5667dc0719'
4
+ data.tar.gz: 8f2ea632ff8d19a4382af4b5647a322ef9489da49ccdfa4f462779eb9d184456
5
5
  SHA512:
6
- metadata.gz: ee38e79b9be45e6a848659a830550ce0cf7ad3cf272fc2c6d6e9ddb95214595ae9fd506a4726d3fffe36719e56a4d4bf439ff8543099ee457feed13e5a6ebbc6
7
- data.tar.gz: b3d34902baa84fc445e10d1874455b3168fe3896c78fd83d41b84c24d78ee1bdc9ccf02282b984d848cdf2984bc8f4ca136b43ff367c9a0857857d164b554358
6
+ metadata.gz: 9b561b90c9a9d9fd230534eb08e0c2c713302f8789a16a4536639a941355f1d6234240d93b2baf55f4845e23ad3377b62f1b075d03a2b9ff1ca26b17cdca4b88
7
+ data.tar.gz: e46cb2fa48461f6986ee5e41d00aa6d7022d91906f14abf78e0620b85c83ae77c3a6ed4f60392de922b91f79e2c569792efbedf058edc5017d203d38bbfcde31
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "securerandom"
4
+
3
5
  module Pgai
4
6
  class CloneManager
5
7
  HOSTNAME = "127.0.0.1"
@@ -71,9 +73,11 @@ module Pgai
71
73
  port_forward.start(clone.port)
72
74
 
73
75
  psql_pid = fork do
74
- start_caffeinate(Process.pid)
75
76
  exec("psql #{clone.connection_string}")
76
77
  end
78
+
79
+ Signal.trap("INT") {}
80
+ start_caffeinate(psql_pid)
77
81
  Process.wait(psql_pid)
78
82
  ensure
79
83
  port_forward.conditionally_stop(clone.port, [psql_pid])
data/lib/pgai/dblab.rb CHANGED
@@ -18,7 +18,7 @@ module Pgai
18
18
  end
19
19
 
20
20
  def configure_env(port:, token:, id:)
21
- dblab("init", "--url", "http://#{hostname}:#{port}", "--token", token, "--environment-id", id, silence: true)
21
+ dblab("init", "--url", "http://#{hostname}:#{port}", "--token", token, "--environment-id", id, silence: true, raw: true)
22
22
  dblab("config", "switch", id, raw: true)
23
23
  end
24
24
 
@@ -62,8 +62,7 @@ module Pgai
62
62
  end
63
63
 
64
64
  def download_dblab_to(location)
65
- platform = Gem::Platform.local
66
- uri = URI(DBLAB_BINARY_URL % {os: platform.os, cpu: platform.cpu})
65
+ uri = URI(DBLAB_BINARY_URL % {os: platform.os, cpu: cpu_platform})
67
66
 
68
67
  Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
69
68
  http.request Net::HTTP::Get.new(uri) do |response|
@@ -74,5 +73,15 @@ module Pgai
74
73
  end
75
74
  end
76
75
  end
76
+
77
+ def platform
78
+ Gem::Platform.local
79
+ end
80
+
81
+ def cpu_platform
82
+ cpu = platform.cpu
83
+ return "arm64" if cpu == "aarch64"
84
+ cpu
85
+ end
77
86
  end
78
87
  end
data/lib/pgai/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pgai
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marius Bobin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-25 00:00:00.000000000 Z
11
+ date: 2023-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor