pgai 0.1.6 → 0.1.8
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/lib/pgai/cli/main.rb +1 -1
- data/lib/pgai/clone_manager.rb +2 -2
- data/lib/pgai/dblab.rb +12 -3
- data/lib/pgai/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03fa1355e1b4ddb4b4377cc88c8a402085c525693719c36a92cc61b76b0c1738
|
4
|
+
data.tar.gz: fcf92ab74e0a897fd8b0d59ef06cc71963946f648e33462b2f1835f1afd118a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 406edf0028a55c3ee1f86bc4e8702bdac35af844fde8aa6401897ce9f5475296b80255a59f16c4fbf6ceb59d1fdcd0c3c361bb05ed5323bc762e61c94032965d
|
7
|
+
data.tar.gz: 6d4cbaeecbdea0c3354dd83973192450cdca24e4b7ffa4a3b07d699efa2b8c9fd341c0c025eed1b689821c734b2cd85ba0f05f2aa2d40d9f28768afe8a2f2017
|
data/lib/pgai/cli/main.rb
CHANGED
@@ -2,7 +2,7 @@ module Pgai::Cli
|
|
2
2
|
class Main < Base
|
3
3
|
desc "config", "Configure CLI options"
|
4
4
|
method_option :prefix, aliases: "-p", desc: "Specify prefix name to be used for clones", required: true
|
5
|
-
method_option :dbname, aliases: "-n", desc: "Specify database name to connect to by default", required: true
|
5
|
+
method_option :dbname, aliases: "-n", desc: "Specify database name to connect to by default", required: true, default: "postgres"
|
6
6
|
method_option :proxy, aliases: "-x", desc: "Specify proxy host name", required: true
|
7
7
|
method_option :exe, aliases: "-e", desc: "dblab binary path"
|
8
8
|
def config
|
data/lib/pgai/clone_manager.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "securerandom"
|
4
4
|
|
5
5
|
module Pgai
|
6
6
|
class CloneManager
|
@@ -76,7 +76,7 @@ module Pgai
|
|
76
76
|
exec("psql #{clone.connection_string}")
|
77
77
|
end
|
78
78
|
|
79
|
-
Signal.trap("INT") {
|
79
|
+
Signal.trap("INT") {}
|
80
80
|
start_caffeinate(psql_pid)
|
81
81
|
Process.wait(psql_pid)
|
82
82
|
ensure
|
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
|
-
|
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