heroku_cli 0.2.3 → 0.2.4

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: 571f6d87cc7c580b1279a3a50b3677a57d65184906d8be7f5d6eeb06bdeb69b2
4
- data.tar.gz: 57d4fc03ed4caa3fa6fc3221317d474563640a6b303b5144b2298d33d73a26af
3
+ metadata.gz: df54b89c9776044b620970072d2ee99d4fe8e818cb4e231f3925bc4da441f13c
4
+ data.tar.gz: 339942b3f0e5a4aab5878f3ff8dc1c1306dd124d2d7b3ea5f7a5cfb9a8dfc0af
5
5
  SHA512:
6
- metadata.gz: 996ea85771187308e73094c751148450980c73b4d1c85431fcceedb45ca346e52f1289cfe6be4de1b13b6d601cfadb33b9c255096abc8baef1931bf494c7ecd4
7
- data.tar.gz: 6cfa2adc43f9755a57dc949a7d3c281183d8a0753c8f3e41fa9e973edf954fe17e13c5d092b1f73c85ea8a08bea3870481bd58b14e71d2b5e0cb52f3ae715e2b
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,6 +47,12 @@ 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
58
  heroku "addons:destroy #{database.url_name} -c #{application.name}"
@@ -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.3"
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.3
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-23 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