effective_developer 0.6.10 → 0.6.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce8857439e77912b69f4d782989c25125a30adfa38bdfa098a0ee099d45b5158
4
- data.tar.gz: 8c81459bbbc23a9e582cb3e18789bf8923e35744e1d851b6cc282d01d32019c2
3
+ metadata.gz: 844b526090ef245bc157e80ba4d3a5e7af98e6e9cb5df20c6b0f18404f34be44
4
+ data.tar.gz: b5e9934fceb5b1648efa59ed87fadadd1e19e19b5f350ac04e53631e1542e7e4
5
5
  SHA512:
6
- metadata.gz: 4fb7415f3045e979db76b27025696b4c891624813accec70e9832c65dce0d0a639f2b82ff7f39ce1b18ebb4ad233d7ae09df12a2de37adbecdcc5319aa284aab
7
- data.tar.gz: 68b07f9aeb57b8c0c0a3b4ec1211bdb645920c3f78ac733fdaedfb16e008dba4efe3642a3697c2ae6d34c26f3f2920b50540441b0ff332f96721c7d359e1df61
6
+ metadata.gz: a99fa228a455346d6d3079eda6ec2138a1e1dcb10023dd851740a1af68e97971393a0f5cff7a78f7c7dee745f3277543c10a71161de0d9c9c1b8e7df731b5f68
7
+ data.tar.gz: cb1cd2a3ecaf14d8c1e63cb59cb7cb71752df6ed010fb0b745606c3c6eb86341af888ebaff4730ffc434816c4f5b66c1e584db719affff0f5119e2bd2f96a865
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
@@ -1,3 +1,3 @@
1
1
  module EffectiveDeveloper
2
- VERSION = '0.6.10'.freeze
2
+ VERSION = '0.6.12'.freeze
3
3
  end
@@ -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
 
@@ -172,14 +174,16 @@ namespace :pg do
172
174
  config = config.configuration_hash if config.respond_to?(:configuration_hash)
173
175
  config = config.stringify_keys
174
176
 
175
- { username: (config['username'] || `whoami`.chomp), password: config['password'], host: config['host'], port: (config['port'] || 5432), database: config['database'] }
177
+ { username: (config['username'] || `whoami`.chomp), password: config['password'], host: config['host'], port: (config['port'] || 5432), database: config['database'].to_s.sub('/', '') }
176
178
  end
177
179
 
178
180
  db.transform_values! { |v| v.respond_to?(:chomp) ? v.chomp : v }
179
181
 
180
182
  puts "=== Saving local '#{db[:database]}' database to #{args.filename}"
181
183
 
182
- if system("export PGPASSWORD=#{db[:password]}; pg_dump -Fc --no-acl --no-owner -h #{db[:host]} -p #{db[:port]} -U #{db[:username]} #{db[:database]} > #{args.filename}")
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.10
4
+ version: 0.6.12
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-04-06 00:00:00.000000000 Z
11
+ date: 2022-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails