heroku_cli 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/heroku_cli/pg/database.rb +10 -1
- data/lib/heroku_cli/pg.rb +25 -1
- data/lib/heroku_cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df54b89c9776044b620970072d2ee99d4fe8e818cb4e231f3925bc4da441f13c
|
4
|
+
data.tar.gz: 339942b3f0e5a4aab5878f3ff8dc1c1306dd124d2d7b3ea5f7a5cfb9a8dfc0af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59bfd46c5fcb8fdab91b687498c69fd4938b01f8f06adea53d5a079db97f4a66c9272095c242a30ab46d89b59958468854617babc89edf6434718ae2bed4ec1a
|
7
|
+
data.tar.gz: cb7f45f26a1560cb3fb183322d1c533410390fc389936eca011df6207d25e4c5e7c2dec5877c6275525b7798f132f7e42cd1650d36a11d97c5d1466cdf8a4624
|
@@ -11,7 +11,7 @@ module HerokuCLI
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def reload
|
14
|
-
parse_info(pg.heroku("pg:info #{url_name}")) if
|
14
|
+
parse_info(pg.heroku("pg:info #{url_name}")) if forks && !forks.empty?
|
15
15
|
end
|
16
16
|
|
17
17
|
def url_name
|
@@ -38,6 +38,11 @@ module HerokuCLI
|
|
38
38
|
info['Data Size']
|
39
39
|
end
|
40
40
|
|
41
|
+
def created
|
42
|
+
info['Created']
|
43
|
+
end
|
44
|
+
|
45
|
+
|
41
46
|
def status
|
42
47
|
info['Status']
|
43
48
|
end
|
@@ -78,6 +83,10 @@ module HerokuCLI
|
|
78
83
|
info.key?('Following')
|
79
84
|
end
|
80
85
|
|
86
|
+
def available?
|
87
|
+
status == 'Available'
|
88
|
+
end
|
89
|
+
|
81
90
|
def behind?
|
82
91
|
behind_by.positive?
|
83
92
|
end
|
data/lib/heroku_cli/pg.rb
CHANGED
@@ -19,6 +19,12 @@ module HerokuCLI
|
|
19
19
|
@info = nil
|
20
20
|
end
|
21
21
|
|
22
|
+
# Create a fork database
|
23
|
+
def create_fork(database, options = {})
|
24
|
+
plan = options.delete(:plan) || database.plan
|
25
|
+
heroku "addons:create heroku-postgresql:#{plan}", "--fork #{database.resource_name}"
|
26
|
+
end
|
27
|
+
|
22
28
|
# create a follower database
|
23
29
|
def create_follower(database, options = {})
|
24
30
|
plan = options.delete(:plan) || database.plan
|
@@ -41,9 +47,15 @@ module HerokuCLI
|
|
41
47
|
heroku "pg:promote #{database.resource_name}"
|
42
48
|
end
|
43
49
|
|
50
|
+
# Get a remote connection url for a database
|
51
|
+
def connection_url(database)
|
52
|
+
url_name = database.url_name
|
53
|
+
(heroku "config:get #{url_name}").strip
|
54
|
+
end
|
55
|
+
|
44
56
|
def destroy(database)
|
45
57
|
raise "Cannot destroy #{application.name} main database" if database.main?
|
46
|
-
heroku "addons:destroy #{database.url_name}
|
58
|
+
heroku "addons:destroy #{database.url_name} -c #{application.name}"
|
47
59
|
end
|
48
60
|
|
49
61
|
# Return the main database
|
@@ -66,6 +78,18 @@ module HerokuCLI
|
|
66
78
|
heroku 'pg:wait'
|
67
79
|
end
|
68
80
|
|
81
|
+
# blocks until database is available but waits until pg:info actually says it is ready
|
82
|
+
def wait_for(database, wait_time = 10)
|
83
|
+
until database.available?
|
84
|
+
puts "...wait #{wait_time} seconds for DB to change status to available"
|
85
|
+
sleep wait_time
|
86
|
+
database.reload
|
87
|
+
puts database
|
88
|
+
end
|
89
|
+
|
90
|
+
puts 'Database available!'
|
91
|
+
end
|
92
|
+
|
69
93
|
def wait_for_follow_fork_transformation(database)
|
70
94
|
while database.follower? do
|
71
95
|
puts "...wait 10 seconds for DB to change from follower to fork"
|
data/lib/heroku_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rasmus Bergholdt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|