heroku_tool 0.7.1 → 0.8.0
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/CHANGELOG.md +4 -0
- data/lib/heroku_tool/db_configuration.rb +15 -14
- data/lib/heroku_tool/tasks/heroku.thor +2 -6
- data/lib/heroku_tool/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: 366d3213e1b652d45f89a3cdc8cd76ccfdf48c5727c13cbdcf215cef666c1a2e
|
4
|
+
data.tar.gz: 315e1c68673b6f3af2d944633b19d3f75d3856a9e8d81d028ada208834cd9759
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee39dd422b621fe18873394e5ae60e68f6294137de76dc0bfa67e084e4763791edc4d2bb74f1e7f0ccd2e4e05e0113b0ad9b38f92c0e825445d4095064cceb80
|
7
|
+
data.tar.gz: b9b3254bb923175c97f69ead7cb9658063a94ed499bb41b0da30075e406cd1c0b31a41127e924593a0f9f27df542e81940529d0bb0514c385c22888cc6fa21cb
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,19 @@
|
|
1
1
|
# NB need to specify a username in the database.yml if you want to use any of these commands
|
2
2
|
module HerokuTool
|
3
3
|
class DbConfiguration
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
attr_reader :config_all, :config_env
|
5
|
+
|
6
|
+
def initialize(filepath: "config/database.yml", rails_env: ENV["RAILS_ENV"] || "development")
|
7
|
+
db_config_from_file = ERB.new(File.read(filepath)).result
|
8
|
+
@config_all = YAML.safe_load(db_config_from_file, permitted_classes: [], permitted_symbols: [], aliases: true)
|
9
|
+
config_env = @config_all[rails_env]
|
10
|
+
@config_env = if config_env["database"].is_a?(String)
|
11
|
+
config_env
|
12
|
+
elsif config_env.key?("primary")
|
13
|
+
config_env["primary"]
|
14
|
+
else
|
15
|
+
config_env.values.first
|
16
|
+
end
|
7
17
|
end
|
8
18
|
|
9
19
|
def generate_drop_tables_sql
|
@@ -12,22 +22,13 @@ module HerokuTool
|
|
12
22
|
end
|
13
23
|
|
14
24
|
def user_arg
|
15
|
-
username =
|
25
|
+
username = config_env["username"]
|
16
26
|
username.present? && "-U #{username}" || ""
|
17
27
|
end
|
18
28
|
|
19
29
|
def database
|
20
|
-
|
30
|
+
config_env["database"]
|
21
31
|
end
|
22
32
|
|
23
|
-
private
|
24
|
-
|
25
|
-
def db_config
|
26
|
-
config[env]
|
27
|
-
end
|
28
|
-
|
29
|
-
def env
|
30
|
-
ENV["RAILS_ENV"] || "development"
|
31
|
-
end
|
32
33
|
end
|
33
34
|
end
|
@@ -391,12 +391,8 @@ class Heroku < Thor
|
|
391
391
|
def from_dump
|
392
392
|
invoke "warn", [], from: options[:from]
|
393
393
|
source = lookup_heroku(options[:from])
|
394
|
-
|
395
|
-
db_config
|
396
|
-
db_username = db_config["username"]
|
397
|
-
db = db_config["database"]
|
398
|
-
db_username_params = db_username.blank? && "" || "-U #{db_username}"
|
399
|
-
puts_and_system "pg_restore --verbose --clean --no-acl --no-owner -h localhost #{db_username_params} -d #{db} #{source.dump_filename}"
|
394
|
+
db_config = HerokuTool::DbConfiguration.new
|
395
|
+
puts_and_system "pg_restore --verbose --clean --no-acl --no-owner -h localhost #{db_config.user_arg} -d #{db_config.database} #{source.dump_filename}"
|
400
396
|
Configuration.after_sync_down(self) unless options[:just_restore]
|
401
397
|
end
|
402
398
|
|
data/lib/heroku_tool/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku_tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Diggins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|