prodder 1.7.3 → 1.7.4
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/lib/prodder/prodder.rake +49 -53
- data/lib/prodder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6ea348f3b248b5660b358f476eae0339608c3d0
|
4
|
+
data.tar.gz: dcb3d21cb200fdce2755505f221c115da3b3548c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 381f5e5da69fa8513382656c1734fd8b3aeb4cf33114652e7d46382f42fb58aae9f8c6e302bce3a7cff9f0d98417bbcabd787dc3dff41754cd7866945d5e198b
|
7
|
+
data.tar.gz: 54c89d1d27dab947d1039c3347fae18c1e65641097163692fe5597360a940630d92bfefdf458c3f612d8cb371b655505b0348a7d2a236bc3611693d33e7384dc
|
data/lib/prodder/prodder.rake
CHANGED
@@ -98,7 +98,7 @@ namespace :db do
|
|
98
98
|
begin
|
99
99
|
puts ActiveRecord::Tasks::DatabaseTasks.collation_current
|
100
100
|
rescue NoMethodError
|
101
|
-
$stderr.puts 'Sorry, your database adapter is not supported yet. Feel free to submit a patch.'
|
101
|
+
$stderr.puts 'error: Sorry, your database adapter is not supported yet. Feel free to submit a patch.'
|
102
102
|
end
|
103
103
|
end
|
104
104
|
end
|
@@ -214,78 +214,74 @@ namespace :db do
|
|
214
214
|
|
215
215
|
desc "Load initial seeds from db/seeds.sql"
|
216
216
|
task :seed => dependencies do
|
217
|
-
|
217
|
+
if File.exist?('db/seeds.sql')
|
218
|
+
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
219
|
+
config["username"] = config["superuser"] if config["superuser"] && File.exist?('db/permissions.sql')
|
220
|
+
set_psql_env config
|
221
|
+
puts "Loading db/seeds.sql into database '#{config['database']}'"
|
222
|
+
`psql --no-psqlrc -f db/seeds.sql #{Shellwords.escape(config['database'])}`
|
223
|
+
raise 'Error loading db/seeds.sql' if $?.exitstatus != 0
|
224
|
+
else
|
218
225
|
puts 'db/seeds.sql not found: no seeds to load.'
|
219
|
-
return
|
220
226
|
end
|
221
|
-
|
222
|
-
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
223
|
-
config["username"] = config["superuser"] if config["superuser"] && File.exist?('db/permissions.sql')
|
224
|
-
set_psql_env config
|
225
|
-
puts "Loading db/seeds.sql into database '#{config['database']}'"
|
226
|
-
`psql --no-psqlrc -f db/seeds.sql #{Shellwords.escape(config['database'])}`
|
227
|
-
raise 'Error loading db/seeds.sql' if $?.exitstatus != 0
|
228
227
|
end
|
229
228
|
|
230
229
|
desc "Load quality_checks (indexes, triggers, foreign keys) from db/quality_checks.sql"
|
231
230
|
task :quality_check => dependencies do
|
232
|
-
|
231
|
+
if File.exist?('db/quality_checks.sql')
|
232
|
+
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
233
|
+
config["username"] = config["superuser"] if config["superuser"] && File.exist?('db/permissions.sql')
|
234
|
+
set_psql_env config
|
235
|
+
puts "Loading db/quality_checks.sql into database '#{config['database']}'"
|
236
|
+
`psql --no-psqlrc -f db/quality_checks.sql #{Shellwords.escape(config['database'])}`
|
237
|
+
raise 'Error loading db/quality_checks.sql' if $?.exitstatus != 0
|
238
|
+
else
|
233
239
|
puts 'db/quality_checks.sql not found: no quality_checks to load.'
|
234
|
-
return
|
235
240
|
end
|
236
|
-
|
237
|
-
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
238
|
-
config["username"] = config["superuser"] if config["superuser"] && File.exist?('db/permissions.sql')
|
239
|
-
set_psql_env config
|
240
|
-
puts "Loading db/quality_checks.sql into database '#{config['database']}'"
|
241
|
-
`psql --no-psqlrc -f db/quality_checks.sql #{Shellwords.escape(config['database'])}`
|
242
|
-
raise 'Error loading db/quality_checks.sql' if $?.exitstatus != 0
|
243
241
|
end
|
244
242
|
|
245
243
|
desc "Load permissions (DB object level access control, group role memberships) from db/permissions.sql"
|
246
244
|
task :permission => dependencies do
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
puts "Loading db/permissions.sql into database '#{config['database']}'"
|
256
|
-
disconnect
|
257
|
-
ActiveRecord::Base.establish_connection((ENV['RAILS_ENV'] || Rails.env).intern)
|
258
|
-
result = ActiveRecord::Base.connection.execute(<<-SQL).first
|
245
|
+
if File.exist?('db/permissions.sql')
|
246
|
+
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
247
|
+
config["username"] = config["superuser"] if config["superuser"]
|
248
|
+
set_psql_env config
|
249
|
+
puts "Loading db/permissions.sql into database '#{config['database']}'"
|
250
|
+
disconnect
|
251
|
+
ActiveRecord::Base.establish_connection((ENV['RAILS_ENV'] || Rails.env).intern)
|
252
|
+
result = ActiveRecord::Base.connection.execute(<<-SQL).first
|
259
253
|
select 1 as is_super from pg_roles where rolname = '#{config['username']}' and rolsuper
|
260
|
-
|
261
|
-
|
262
|
-
|
254
|
+
SQL
|
255
|
+
unless result && result['is_super']
|
256
|
+
puts "warning: Restoring permissions as config/database.yml non-superuser: '#{config['username']}', expect errors, or rerun after granting superuser"
|
257
|
+
end
|
258
|
+
`psql --no-psqlrc -f db/permissions.sql #{Shellwords.escape(config['database'])}`
|
259
|
+
raise 'Error loading db/permissions.sql' if $?.exitstatus != 0
|
260
|
+
else
|
261
|
+
puts 'db/permissions.sql not found: no permissions to load.'
|
263
262
|
end
|
264
|
-
`psql --no-psqlrc -f db/permissions.sql #{Shellwords.escape(config['database'])}`
|
265
|
-
raise 'Error loading db/permissions.sql' if $?.exitstatus != 0
|
266
263
|
end
|
267
264
|
|
268
265
|
desc "Load database settings"
|
269
266
|
task :settings => dependencies do
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
puts "Loading db/settings.sql into database '#{config['database']}'"
|
279
|
-
disconnect
|
280
|
-
ActiveRecord::Base.establish_connection((ENV['RAILS_ENV'] || Rails.env).intern)
|
281
|
-
result = ActiveRecord::Base.connection.execute(<<-SQL).first
|
267
|
+
if File.exist?('db/settings.sql')
|
268
|
+
config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
|
269
|
+
config["username"] = config["superuser"] if config["superuser"] && File.exist?('db/permissions.sql')
|
270
|
+
set_psql_env config
|
271
|
+
puts "Loading db/settings.sql into database '#{config['database']}'"
|
272
|
+
disconnect
|
273
|
+
ActiveRecord::Base.establish_connection((ENV['RAILS_ENV'] || Rails.env).intern)
|
274
|
+
result = ActiveRecord::Base.connection.execute(<<-SQL).first
|
282
275
|
select 1 as is_super from pg_roles where rolname = '#{config['username']}' and rolsuper
|
283
|
-
|
284
|
-
|
285
|
-
|
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
|
282
|
+
else
|
283
|
+
puts 'db/settings.sql not found: no settings to load.'
|
286
284
|
end
|
287
|
-
`psql --no-psqlrc -f db/settings.sql #{Shellwords.escape(config['database'])}`
|
288
|
-
raise 'Error loading db/settings.sql' if $?.exitstatus != 0
|
289
285
|
end
|
290
286
|
|
291
287
|
# Empty this, we don't want db:migrate writing structure.sql any more.
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Hargraves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deject
|