capistrano3-postgres 0.2.4 → 0.2.5
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 +5 -5
- data/README.md +6 -0
- data/lib/capistrano3/postgres/version.rb +1 -1
- data/lib/capistrano3/tasks/postgres.rb +10 -4
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b432337df094358906c4d46a45c6365d820accfd62dd6c0a085a95ebc905014d
|
4
|
+
data.tar.gz: db1306a7b51ac53b30c5efbe999bf2d81873dc990baaf329fddc1d77fd2c1b81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e64ad68263d7047df31f05ebf8c75ef1b0b3abcd4d4dc3e7b5a02c90adb66b8a237339d551993d5abc14b35242a616dcfd243db1f668cd2454854a7d7bb09ea8
|
7
|
+
data.tar.gz: f879125f07576d98beb42250b842cd1329f4d1319f5d958b52586a086d605158163c5e28eb8af868a18a7ba49a4731fb03c35910bcd0fd4685b4f1a25a86adfd
|
data/README.md
CHANGED
@@ -74,6 +74,12 @@ If you need only specific tables to be dumped:
|
|
74
74
|
set :postgres_backup_table, -> { ['users', 'orders'] }
|
75
75
|
```
|
76
76
|
|
77
|
+
If you need to support rails 6+ multiple database support, please set database_name to use:
|
78
|
+
|
79
|
+
```
|
80
|
+
set :postgres_database, 'primary'
|
81
|
+
```
|
82
|
+
|
77
83
|
## Contributing
|
78
84
|
|
79
85
|
1. Fork it ( http://github.com/spilin/capistrano3-postgres/fork )
|
@@ -12,6 +12,7 @@ namespace :load do
|
|
12
12
|
set :postgres_backup_exclude_table_data, -> { [] }
|
13
13
|
set :postgres_backup_exclude_table, -> { [] }
|
14
14
|
set :postgres_backup_table, -> { [] }
|
15
|
+
set :postgres_database, -> { nil }
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -120,8 +121,7 @@ namespace :postgres do
|
|
120
121
|
desc 'Replicate database locally'
|
121
122
|
task :replicate do
|
122
123
|
grab_local_database_config
|
123
|
-
|
124
|
-
ask(:database_name, config['database'])
|
124
|
+
ask(:database_name, fetch(:postgres_local_database_config)['database'])
|
125
125
|
invoke "postgres:backup:create"
|
126
126
|
invoke "postgres:backup:download"
|
127
127
|
invoke "postgres:backup:import"
|
@@ -144,7 +144,7 @@ namespace :postgres do
|
|
144
144
|
env = 'development'
|
145
145
|
preload_env_variables(env)
|
146
146
|
yaml_content = ERB.new(capture 'cat config/database.yml').result
|
147
|
-
|
147
|
+
set_postgres_database_config(yaml_content, env, :postgres_local_database_config)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
end
|
@@ -164,7 +164,7 @@ namespace :postgres do
|
|
164
164
|
|
165
165
|
capture_config_cmd = "ruby -e \"#{eval_yaml_with_erb}\""
|
166
166
|
yaml_content = test('ruby -v') ? capture(capture_config_cmd) : capture(:bundle, :exec, capture_config_cmd)
|
167
|
-
|
167
|
+
set_postgres_database_config(yaml_content, env, :postgres_remote_database_config)
|
168
168
|
end
|
169
169
|
end
|
170
170
|
end
|
@@ -173,6 +173,12 @@ namespace :postgres do
|
|
173
173
|
{ 'host' => 'localhost' }
|
174
174
|
end
|
175
175
|
|
176
|
+
def set_postgres_database_config(yaml_content, env, key)
|
177
|
+
database_config = YAML::load(yaml_content)[env]
|
178
|
+
database_config = database_config[fetch(:postgres_database)] if fetch(:postgres_database)
|
179
|
+
set key, database_config_defaults.merge(database_config)
|
180
|
+
end
|
181
|
+
|
176
182
|
# Load environment variables for configurations.
|
177
183
|
# Useful for such gems as Dotenv, Figaro, etc.
|
178
184
|
def preload_env_variables(env)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano3-postgres
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Krasynskyi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -60,8 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
requirements: []
|
63
|
-
|
64
|
-
rubygems_version: 2.4.5.1
|
63
|
+
rubygems_version: 3.0.6
|
65
64
|
signing_key:
|
66
65
|
specification_version: 4
|
67
66
|
summary: Create, download and restore postgres database.
|