pgai 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pgai/create_clone_service.rb +12 -10
- data/lib/pgai/resources/attributes.rb +0 -1
- data/lib/pgai/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 123bfba393d6bed50c493b3acd2d934b497c506a09c5680293bc2d68eb942394
|
4
|
+
data.tar.gz: cc04c9ab11322ba25526b3fef520c72c172e9672d52e04aded6b23e37a28490b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d746ae9b949706ad27f5aeb8089ff928475188a2e43ab996b8ece041feae63b740d70a3ed165f0af3f022309066cec0bcb6200fca8b1c7c1da4a1e7dec7932e1
|
7
|
+
data.tar.gz: 43b5d7e409bca1d28cb75c6fff9a3259c34348bc7365035134acff02639e5e8a7753401f83ef3d3dcbbab2fa6089060e91bf4bfb1406dd27b19e102d63b23a9f
|
@@ -6,6 +6,7 @@ module Pgai
|
|
6
6
|
class CreateCloneService
|
7
7
|
HOSTNAME = "127.0.0.1"
|
8
8
|
CLONE_REFRESH_INTERVAL = 0.2
|
9
|
+
PROGRESS_BAR_WIDTH = 80
|
9
10
|
|
10
11
|
attr_reader :id, :env, :logger
|
11
12
|
|
@@ -16,11 +17,15 @@ module Pgai
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def execute
|
20
|
+
logger.info("Preparing clone ...")
|
21
|
+
logger.debug { "Expected cloning time: #{env.expected_cloning_time}" }
|
22
|
+
progress_bar.start
|
23
|
+
|
19
24
|
create_clone_resource
|
20
|
-
|
21
|
-
|
25
|
+
|
26
|
+
logger.debug { clone_resource.status_message }
|
22
27
|
wait_for_clone_to_be_ready
|
23
|
-
logger.debug
|
28
|
+
logger.debug { clone_resource.status_message }
|
24
29
|
|
25
30
|
Resources::Local::Clone.new(cached_clone_attributes).tap(&:save)
|
26
31
|
end
|
@@ -53,8 +58,8 @@ module Pgai
|
|
53
58
|
|
54
59
|
def wait_for_clone_to_be_ready
|
55
60
|
loop do
|
61
|
+
progress_bar.advance(steps)
|
56
62
|
clone_resource.refresh
|
57
|
-
progress_bar.advance
|
58
63
|
break if clone_resource.ready?
|
59
64
|
sleep(CLONE_REFRESH_INTERVAL)
|
60
65
|
end
|
@@ -62,14 +67,11 @@ module Pgai
|
|
62
67
|
end
|
63
68
|
|
64
69
|
def progress_bar
|
65
|
-
@progress_bar ||= TTY::ProgressBar.new(
|
66
|
-
"Preparing clone ... [:bar]",
|
67
|
-
total: progress_bar_steps
|
68
|
-
)
|
70
|
+
@progress_bar ||= TTY::ProgressBar.new("[:bar]", total: PROGRESS_BAR_WIDTH)
|
69
71
|
end
|
70
72
|
|
71
|
-
def
|
72
|
-
(env.expected_cloning_time
|
73
|
+
def steps
|
74
|
+
@steps ||= (PROGRESS_BAR_WIDTH / env.expected_cloning_time).ceil
|
73
75
|
end
|
74
76
|
end
|
75
77
|
end
|
data/lib/pgai/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marius Bobin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -284,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
284
|
- !ruby/object:Gem::Version
|
285
285
|
version: '0'
|
286
286
|
requirements: []
|
287
|
-
rubygems_version: 3.4.
|
287
|
+
rubygems_version: 3.4.19
|
288
288
|
signing_key:
|
289
289
|
specification_version: 4
|
290
290
|
summary: CLI wrapper for postgres.ai thin clones
|