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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46d073f63217c538b5ec9fa2a83c668548f95673
4
- data.tar.gz: e1e81386094c8c7054c2bea7228db0bd345ea385
3
+ metadata.gz: d6ea348f3b248b5660b358f476eae0339608c3d0
4
+ data.tar.gz: dcb3d21cb200fdce2755505f221c115da3b3548c
5
5
  SHA512:
6
- metadata.gz: d6f9275cf746c5dcfd50e05e5c1d21eaabbfe8316e5107f358e38fd62f52e1b070accf1dcc9d9bcc119768883804ebc8b6c4add17172d31c71a3010aec7e7076
7
- data.tar.gz: 81bf60f578179fdb3a39011826a0ed4bbcc84c24c6294ef82f193e3115c9bb086b6d8aaa1600f87931377c820c0004714622ae9380220f3813416994c0c51c2a
6
+ metadata.gz: 381f5e5da69fa8513382656c1734fd8b3aeb4cf33114652e7d46382f42fb58aae9f8c6e302bce3a7cff9f0d98417bbcabd787dc3dff41754cd7866945d5e198b
7
+ data.tar.gz: 54c89d1d27dab947d1039c3347fae18c1e65641097163692fe5597360a940630d92bfefdf458c3f612d8cb371b655505b0348a7d2a236bc3611693d33e7384dc
@@ -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
- unless File.exist?('db/seeds.sql')
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
- unless File.exist?('db/quality_checks.sql')
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
- unless File.exist?('db/permissions.sql')
248
- puts 'db/permissions.sql not found: no permissions to load.'
249
- return
250
- end
251
-
252
- config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
253
- config["username"] = config["superuser"] if config["superuser"]
254
- set_psql_env config
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
- SQL
261
- unless result && result['is_super']
262
- puts "Restoring permissions as config/database.yml non-superuser: '#{config['username']}', expect errors, or rerun after granting superuser"
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
- unless File.exist?('db/settings.sql')
271
- puts 'db/settings.sql not found: no settings to load.'
272
- return
273
- end
274
-
275
- config = ActiveRecord::Base.configurations[ENV['RAILS_ENV'] || Rails.env]
276
- config["username"] = config["superuser"] if config["superuser"] && File.exist?('db/permissions.sql')
277
- set_psql_env config
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
- SQL
284
- unless result && result['is_super']
285
- puts "Restoring settings as config/database.yml non-superuser: '#{config['username']}', expect errors, or rerun after granting superuser"
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.
@@ -1,3 +1,3 @@
1
1
  module Prodder
2
- VERSION = "1.7.3"
2
+ VERSION = "1.7.4"
3
3
  end
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.3
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-16 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deject