effective_developer 0.6.10 → 0.6.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/effective_developer/version.rb +1 -1
- data/lib/tasks/pg_pull.rake +8 -4
- 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: 7c82e5a358ef279b2ccccaaf54c097ca549449b4d7c4c076eea41f88f5646f3e
|
4
|
+
data.tar.gz: c66fce38e2b60d3796964d51fd718911736c2be3f4f0e0413235b84095e25dd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9fc0933cede1643a01fa8000c46d5beb1d8184e5eb74750adf6120cb4747789a65df62079f96b1a2946a78c177739a05880bfd925366e082b3493b2a2c6f1ec
|
7
|
+
data.tar.gz: f74388c2dd737bf879ff0a3b147c577b20eac0407a8d4b176942716a93cb75292c9ec2376211d176256e9aae0f50484d40adb4fac153f613283f24ed1b84991c
|
data/README.md
CHANGED
@@ -238,6 +238,12 @@ rake pg:pull
|
|
238
238
|
rake pg:pull[staging]
|
239
239
|
```
|
240
240
|
|
241
|
+
By default, any data in the `logs` table will be excluded. To include the logs data:
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
rake pg:pull logs=true
|
245
|
+
```
|
246
|
+
|
241
247
|
## pg:load
|
242
248
|
|
243
249
|
Drops and re-creates the local database then initializes database with the contents of latest.dump
|
data/lib/tasks/pg_pull.rake
CHANGED
@@ -8,12 +8,14 @@ namespace :pg do
|
|
8
8
|
# bundle exec rake pg:pull
|
9
9
|
# bundle exec rake pg:pull[staging]
|
10
10
|
# bundle exec rake pg:pull[158.204.33.124]
|
11
|
+
# bundle exec rake pg:pull logs=true
|
11
12
|
# bundle exec rake pg:pull filename=latest.dump database=example
|
13
|
+
# bundle exec rake pg:pull filename=latest.dump database=example logs=true
|
12
14
|
# DATABASE=example bundle exec rake pg:load
|
13
15
|
desc 'Creates a new backup on remote server and downloads it to latest.dump'
|
14
16
|
task :pull, [:remote] => :environment do |t, args|
|
15
17
|
defaults = { database: nil, filename: (ENV['DATABASE'] || 'latest') + '.dump' }
|
16
|
-
env_keys = { database: ENV['DATABASE'], filename: ENV['FILENAME'] }
|
18
|
+
env_keys = { database: ENV['DATABASE'], filename: ENV['FILENAME'], logs: ENV['LOGS'] }
|
17
19
|
keywords = ARGV.map { |a| a.split('=') if a.include?('=') }.compact.inject({}) { |h, (k, v)| h[k.to_sym] = v; h }
|
18
20
|
args.with_defaults(defaults.compact.merge(env_keys.compact).merge(keywords))
|
19
21
|
|
@@ -62,7 +64,7 @@ namespace :pg do
|
|
62
64
|
# SSH into hatchbox and call rake pg:save there to create latest.dump
|
63
65
|
unless(result = `ssh -T #{args.user}@#{args.remote} << EOF
|
64
66
|
cd ~/#{args.app}/current/
|
65
|
-
bundle exec rake pg:save database=#{args.database} filename=#{args.filename}
|
67
|
+
bundle exec rake pg:save database=#{args.database} filename=#{args.filename} logs=#{args.logs}
|
66
68
|
`).include?('Saving database completed') # The output of pg:save down below
|
67
69
|
puts("Error calling ssh #{args.user}@#{args.remote} and running rake pg:save on hatchbox from ~/#{args.app}/current/")
|
68
70
|
abort(result)
|
@@ -140,7 +142,7 @@ namespace :pg do
|
|
140
142
|
desc 'Saves the development database to a postgresql .dump file (latest.dump by default)'
|
141
143
|
task :save, [:filename] => :environment do |t, args|
|
142
144
|
defaults = { database: nil, filename: (ENV['DATABASE'] || 'latest') + '.dump' }
|
143
|
-
env_keys = { database: ENV['DATABASE'], filename: ENV['FILENAME'] }
|
145
|
+
env_keys = { database: ENV['DATABASE'], filename: ENV['FILENAME'], logs: ENV['LOGS'] }
|
144
146
|
keywords = ARGV.map { |a| a.split('=') if a.include?('=') }.compact.inject({}) { |h, (k, v)| h[k.to_sym] = v; h }
|
145
147
|
args.with_defaults(defaults.compact.merge(env_keys.compact).merge(keywords))
|
146
148
|
|
@@ -179,7 +181,9 @@ namespace :pg do
|
|
179
181
|
|
180
182
|
puts "=== Saving local '#{db[:database]}' database to #{args.filename}"
|
181
183
|
|
182
|
-
|
184
|
+
exclude_table_data = "--exclude-table-data=logs" unless (args.logs == 'true')
|
185
|
+
|
186
|
+
if system("export PGPASSWORD=#{db[:password]}; pg_dump -Fc --no-acl --no-owner #{exclude_table_data} -h #{db[:host]} -p #{db[:port]} -U #{db[:username]} #{db[:database]} > #{args.filename}")
|
183
187
|
puts "Saving database completed"
|
184
188
|
else
|
185
189
|
abort "Error saving database"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_developer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|