prodder 1.7.5 → 1.7.6
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/README.md +3 -3
- data/lib/prodder/prodder.rake +45 -44
- data/lib/prodder/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bffad577e74259c3700295becff4baeafd8fa42038529e104e46edf6cbd59ca2
|
4
|
+
data.tar.gz: 0283df1e58d3b49ea8c51bf7b715230bffbf9b51e031ae5450c5c9d83dcb6c36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cd59679ebdf492e96a0f1858217660dca26f68b910d38df60cd9877de773a4998e90280900cc539ad4eb286ae4ce995e33aebfb3f8f8a76ee4925dc95da9203
|
7
|
+
data.tar.gz: 6e144e41880ed23e55f11ab6688b5bfdcba6fdf46faa451cb096c42c38a1e8778f98e558adbfee27f40981f0b56f1b3a095b325c29af0da4656f09c39d773d0e
|
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
prodder [](https://travis-ci.org/enova/prodder)
|
3
3
|
=======
|
4
4
|
|
5
|
-
A tool to maintain and load your Rails application's database structure
|
6
|
-
table contents, based on its migration history
|
7
|
-
databases.
|
5
|
+
A tool to maintain and load your Rails application's database structure, seed
|
6
|
+
table contents, permissions and database settings based on its migration history
|
7
|
+
and the current state in production databases.
|
8
8
|
|
9
9
|
In short: `db:reset db:migrate`
|
10
10
|
|
data/lib/prodder/prodder.rake
CHANGED
@@ -203,24 +203,26 @@ namespace :db do
|
|
203
203
|
namespace :structure do
|
204
204
|
desc "Load db/structure.sql into the current environment's database"
|
205
205
|
task :load => dependencies do
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
206
|
+
as("superuser", in: ENV['RAILS_ENV'] || Rails.env) do
|
207
|
+
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
208
|
+
set_psql_env config
|
209
|
+
puts "Loading db/structure.sql into database '#{config['database']}'"
|
210
|
+
`psql --no-psqlrc -f db/structure.sql #{Shellwords.escape(config['database'])}`
|
211
|
+
raise 'Error loading db/structure.sql' if $?.exitstatus != 0
|
212
|
+
end
|
212
213
|
end
|
213
214
|
end
|
214
215
|
|
215
216
|
desc "Load initial seeds from db/seeds.sql"
|
216
217
|
task :seed => dependencies do
|
217
218
|
if File.exist?('db/seeds.sql')
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
219
|
+
as("superuser", in: ENV['RAILS_ENV'] || Rails.env) do
|
220
|
+
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
221
|
+
set_psql_env config
|
222
|
+
puts "Loading db/seeds.sql into database '#{config['database']}'"
|
223
|
+
`psql --no-psqlrc -f db/seeds.sql #{Shellwords.escape(config['database'])}`
|
224
|
+
raise 'Error loading db/seeds.sql' if $?.exitstatus != 0
|
225
|
+
end
|
224
226
|
else
|
225
227
|
puts 'db/seeds.sql not found: no seeds to load.'
|
226
228
|
end
|
@@ -229,12 +231,13 @@ namespace :db do
|
|
229
231
|
desc "Load quality_checks (indexes, triggers, foreign keys) from db/quality_checks.sql"
|
230
232
|
task :quality_check => dependencies do
|
231
233
|
if File.exist?('db/quality_checks.sql')
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
234
|
+
as("superuser", in: ENV['RAILS_ENV'] || Rails.env) do
|
235
|
+
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
236
|
+
set_psql_env config
|
237
|
+
puts "Loading db/quality_checks.sql into database '#{config['database']}'"
|
238
|
+
`psql --no-psqlrc -f db/quality_checks.sql #{Shellwords.escape(config['database'])}`
|
239
|
+
raise 'Error loading db/quality_checks.sql' if $?.exitstatus != 0
|
240
|
+
end
|
238
241
|
else
|
239
242
|
puts 'db/quality_checks.sql not found: no quality_checks to load.'
|
240
243
|
end
|
@@ -243,20 +246,19 @@ namespace :db do
|
|
243
246
|
desc "Load permissions (DB object level access control, group role memberships) from db/permissions.sql"
|
244
247
|
task :permission => dependencies do
|
245
248
|
if File.exist?('db/permissions.sql')
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
249
|
+
as("superuser", in: ENV['RAILS_ENV'] || Rails.env) do
|
250
|
+
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
251
|
+
set_psql_env config
|
252
|
+
puts "Loading db/permissions.sql into database '#{config['database']}'"
|
253
|
+
result = ActiveRecord::Base.connection.execute(<<-SQL).first
|
254
|
+
select 1 as is_super from pg_roles where rolname = '#{config['username']}' and rolsuper
|
255
|
+
SQL
|
256
|
+
unless result && result['is_super']
|
257
|
+
puts "warning: Restoring permissions as config/database.yml non-superuser: '#{config['username']}', expect errors, or rerun after granting superuser"
|
258
|
+
end
|
259
|
+
`psql --no-psqlrc -f db/permissions.sql #{Shellwords.escape(config['database'])}`
|
260
|
+
raise 'Error loading db/permissions.sql' if $?.exitstatus != 0
|
257
261
|
end
|
258
|
-
`psql --no-psqlrc -f db/permissions.sql #{Shellwords.escape(config['database'])}`
|
259
|
-
raise 'Error loading db/permissions.sql' if $?.exitstatus != 0
|
260
262
|
else
|
261
263
|
puts 'db/permissions.sql not found: no permissions to load.'
|
262
264
|
end
|
@@ -265,20 +267,19 @@ namespace :db do
|
|
265
267
|
desc "Load database settings"
|
266
268
|
task :settings => dependencies do
|
267
269
|
if File.exist?('db/settings.sql')
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
270
|
+
as("superuser", in: ENV['RAILS_ENV'] || Rails.env) do
|
271
|
+
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
272
|
+
set_psql_env config
|
273
|
+
puts "Loading db/settings.sql into database '#{config['database']}'"
|
274
|
+
result = ActiveRecord::Base.connection.execute(<<-SQL).first
|
275
|
+
select 1 as is_super from pg_roles where rolname = '#{config['username']}' and rolsuper
|
276
|
+
SQL
|
277
|
+
unless result && result['is_super']
|
278
|
+
puts "warning: Restoring settings as config/database.yml non-superuser: '#{config['username']}', expect errors, or rerun after granting superuser"
|
279
|
+
end
|
280
|
+
`psql --no-psqlrc -f db/settings.sql #{Shellwords.escape(config['database'])}`
|
281
|
+
raise 'Error loading db/settings.sql' if $?.exitstatus != 0
|
279
282
|
end
|
280
|
-
`psql --no-psqlrc -f db/settings.sql #{Shellwords.escape(config['database'])}`
|
281
|
-
raise 'Error loading db/settings.sql' if $?.exitstatus != 0
|
282
283
|
else
|
283
284
|
puts 'db/settings.sql not found: no settings to load.'
|
284
285
|
end
|
data/lib/prodder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prodder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Hargraves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deject
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project:
|
85
|
-
rubygems_version: 2.7.
|
85
|
+
rubygems_version: 2.7.7
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Maintain your Rails apps' structure, seed and quality_checks files using
|