heroku_cli 0.2.2 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce49cba89645e3c259f5f883956e267344f32c94e4d6a3fba942ac32b761a7be
4
- data.tar.gz: 57fcb8b29e0b2bb3e53a83be4b3e0be3a1f854124a29cd1d8f57c2210afb0014
3
+ metadata.gz: df54b89c9776044b620970072d2ee99d4fe8e818cb4e231f3925bc4da441f13c
4
+ data.tar.gz: 339942b3f0e5a4aab5878f3ff8dc1c1306dd124d2d7b3ea5f7a5cfb9a8dfc0af
5
5
  SHA512:
6
- metadata.gz: 96b8b114a82ad8b0d75b305657025995912b309f0271fbf76bf696135705e24686252112e45962e53bec79b7e65c2f2962b3e8604356aa02c8e6bb0af2ff3a04
7
- data.tar.gz: b087af61e2127d55675fbeace62d2721c4278c77069830a537104ba2d94183569402f01a24d5370fb8976c9b7c4f38fe416adb03b94a1d35fd1b5b4bbbdcd102
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 pg.present?
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}", "-c #{application.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"
@@ -1,3 +1,3 @@
1
1
  module HerokuCLI
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
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.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: 2024-08-21 00:00:00.000000000 Z
11
+ date: 2025-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler