naifa 0.1.1 → 0.2.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 +30 -1
- data/README.md +21 -0
- data/lib/naifa/plugins/postgres.rb +20 -10
- data/lib/naifa/plugins/postgres/settings.rb +18 -1
- data/lib/naifa/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c623b56e8b1b23e3ca479d9e0e08cae05bd4cab6
|
4
|
+
data.tar.gz: 573aefda165ae23988186c683ba09572b044953f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cec7af63cf9322d8159186d367ff754fd3244b6f4b14705c580e591d4b954a5f20c27ff21a66432607e10c7421874bad9c37013fc5992b402629f45476db4e7
|
7
|
+
data.tar.gz: 3cf47b6f7471e72ee749213ed9d9ec280821c123eaf7825519fe4e0528423b40302f70ae5d7c442e9aa09c68d8c54dc959f81cb9acfc17ec85fd487ad8657460
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
-
## 0.
|
1
|
+
## 0.2.0
|
2
|
+
* Adds support for postgres command options in the naifa file
|
3
|
+
* NOTE: If you use the postgres plugin, please update you .naifa file to add the default backup_options and restore_options. Ex of adding those to the a development environment setting:
|
4
|
+
```
|
5
|
+
...
|
6
|
+
db:
|
7
|
+
plugin: postgres
|
8
|
+
settings:
|
9
|
+
...
|
10
|
+
environments:
|
11
|
+
...
|
12
|
+
development:
|
13
|
+
backup_options:
|
14
|
+
- "-Fc"
|
15
|
+
restore_options:
|
16
|
+
- "--verbose"
|
17
|
+
- "--clean"
|
18
|
+
- "--no-acl"
|
19
|
+
- "--no-owner"
|
20
|
+
...
|
21
|
+
```
|
22
|
+
|
23
|
+
## 0.1.1
|
24
|
+
* Adds S3 bucket sync support
|
25
|
+
* Restructure configuration and the CLI
|
26
|
+
* Removes defaults. Settings must come from the configuration file
|
27
|
+
* Fixes some postgres plugin bugs
|
28
|
+
* Adds some validations and error messages
|
29
|
+
|
30
|
+
## 0.1.0
|
2
31
|
* First version!
|
3
32
|
* Adds postgresql sync between environment database, backup and restore
|
data/README.md
CHANGED
@@ -56,6 +56,13 @@ db:
|
|
56
56
|
database: ''
|
57
57
|
username: "\\$POSTGRES_USER"
|
58
58
|
path: "/db_dumps/"
|
59
|
+
backup_options:
|
60
|
+
- "-Fc"
|
61
|
+
restore_options:
|
62
|
+
- "--verbose"
|
63
|
+
- "--clean"
|
64
|
+
- "--no-acl"
|
65
|
+
- "--no-owner"
|
59
66
|
backup:
|
60
67
|
environment: :staging
|
61
68
|
restore:
|
@@ -158,6 +165,13 @@ db:
|
|
158
165
|
database: ''
|
159
166
|
username: "\\$POSTGRES_USER"
|
160
167
|
path: "/db_dumps/"
|
168
|
+
backup_options:
|
169
|
+
- "-Fc"
|
170
|
+
restore_options:
|
171
|
+
- "--verbose"
|
172
|
+
- "--clean"
|
173
|
+
- "--no-acl"
|
174
|
+
- "--no-owner"
|
161
175
|
backup:
|
162
176
|
environment: :staging
|
163
177
|
restore:
|
@@ -180,6 +194,13 @@ db_local:
|
|
180
194
|
username: "\\$POSTGRES_USER"
|
181
195
|
password: pass
|
182
196
|
path: "/db_dumps/"
|
197
|
+
backup_options:
|
198
|
+
- "-Fc"
|
199
|
+
restore_options:
|
200
|
+
- "--verbose"
|
201
|
+
- "--clean"
|
202
|
+
- "--no-acl"
|
203
|
+
- "--no-owner"
|
183
204
|
backup:
|
184
205
|
environment: :staging
|
185
206
|
restore:
|
@@ -80,7 +80,8 @@ module Naifa
|
|
80
80
|
File.join(
|
81
81
|
environment_settings[:path].presence || options[:path].presence,
|
82
82
|
filename
|
83
|
-
)
|
83
|
+
),
|
84
|
+
environment_settings[:backup_options]
|
84
85
|
)
|
85
86
|
Kernel.system(command_line)
|
86
87
|
when :local
|
@@ -98,7 +99,8 @@ module Naifa
|
|
98
99
|
File.join(
|
99
100
|
environment_settings[:path].presence || options[:path].presence,
|
100
101
|
filename
|
101
|
-
)
|
102
|
+
),
|
103
|
+
environment_settings[:backup_options]
|
102
104
|
)
|
103
105
|
Kernel.system(command_line)
|
104
106
|
when :heroku
|
@@ -129,7 +131,8 @@ module Naifa
|
|
129
131
|
File.join(
|
130
132
|
environment_settings[:path].presence || options[:path].presence,
|
131
133
|
filename
|
132
|
-
)
|
134
|
+
),
|
135
|
+
environment_settings[:backup_options]
|
133
136
|
)
|
134
137
|
Utils.docker_compose_exec_command(
|
135
138
|
environment_settings[:app_name].presence,
|
@@ -173,7 +176,8 @@ module Naifa
|
|
173
176
|
File.join(
|
174
177
|
environment_settings[:path].presence || options[:path].presence,
|
175
178
|
filename
|
176
|
-
)
|
179
|
+
),
|
180
|
+
environment_settings[:restore_options]
|
177
181
|
)
|
178
182
|
Kernel.system(command_line)
|
179
183
|
when :local
|
@@ -191,7 +195,8 @@ module Naifa
|
|
191
195
|
File.join(
|
192
196
|
environment_settings[:path] || options[:path],
|
193
197
|
filename
|
194
|
-
)
|
198
|
+
),
|
199
|
+
environment_settings[:restore_options]
|
195
200
|
)
|
196
201
|
Kernel.system(command_line)
|
197
202
|
when :docker
|
@@ -210,7 +215,8 @@ module Naifa
|
|
210
215
|
File.join(
|
211
216
|
environment_settings[:path].presence || options[:path].presence,
|
212
217
|
filename
|
213
|
-
)
|
218
|
+
),
|
219
|
+
environment_settings[:restore_options]
|
214
220
|
)
|
215
221
|
Utils.docker_compose_exec_command(
|
216
222
|
environment_settings[:app_name],
|
@@ -223,14 +229,18 @@ module Naifa
|
|
223
229
|
|
224
230
|
private_class_method :_restore
|
225
231
|
|
226
|
-
def self.build_restore_command(host, username, database, filename)
|
227
|
-
|
232
|
+
def self.build_restore_command(host, username, database, filename, options={})
|
233
|
+
command = "pg_restore"
|
234
|
+
command << " #{options.join(' ')}" if options.present?
|
235
|
+
command << " -h #{host} -U #{username} -d #{database} #{filename}"
|
228
236
|
end
|
229
237
|
|
230
238
|
private_class_method :build_restore_command
|
231
239
|
|
232
|
-
def self.build_backup_command(host, username, database, filename)
|
233
|
-
"pg_dump
|
240
|
+
def self.build_backup_command(host, username, database, filename, options={})
|
241
|
+
command = "pg_dump "
|
242
|
+
command << " #{options.join(' ')}" if options.present?
|
243
|
+
command << " -h #{host} -U #{username} -d #{database} > #{filename}"
|
234
244
|
end
|
235
245
|
|
236
246
|
private_class_method :build_backup_command
|
@@ -14,12 +14,29 @@ module Naifa
|
|
14
14
|
type: :heroku,
|
15
15
|
remote: 'staging'
|
16
16
|
},
|
17
|
+
remote_example: {
|
18
|
+
type: :remote,
|
19
|
+
host: '',
|
20
|
+
database: '',
|
21
|
+
username: '',
|
22
|
+
backup_options: ['-Fc'],
|
23
|
+
restore_options: ['--verbose', '--clean', '--no-acl', '--no-owner']
|
24
|
+
},
|
25
|
+
local_example: {
|
26
|
+
type: :local,
|
27
|
+
database: '',
|
28
|
+
username: '',
|
29
|
+
backup_options: ['-Fc'],
|
30
|
+
restore_options: ['--verbose', '--clean', '--no-acl', '--no-owner']
|
31
|
+
},
|
17
32
|
development: {
|
18
33
|
type: :docker,
|
19
34
|
app_name: 'db',
|
20
35
|
database: '',
|
21
36
|
username: '\$POSTGRES_USER',
|
22
|
-
path: '/db_dumps/'
|
37
|
+
path: '/db_dumps/',
|
38
|
+
backup_options: ['-Fc'],
|
39
|
+
restore_options: ['--verbose', '--clean', '--no-acl', '--no-owner']
|
23
40
|
}
|
24
41
|
},
|
25
42
|
backup: {
|
data/lib/naifa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: naifa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Filipe Dias
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.5.
|
151
|
+
rubygems_version: 2.5.2
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Naifa is a tool aimed at providing a collection of commands that simplify
|