usps-support 0.2.28.pre.1 → 0.2.28

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: '068c46f84709d2141a241efc9d6e8a1fc232ef1e7552696fa4ab4e9f449967fb'
4
- data.tar.gz: f392bbaa7f05ef68c4cde9f3f833761a6c16619d5ffce0a5deb777a1edf6dc7f
3
+ metadata.gz: c0f7453d723c35564393e1541d13e8ef32d3127096d76f82d34e1d1adf852b14
4
+ data.tar.gz: 68bdad2b0fb4feee2c275b90e73c93e815fcbe7026378e5879259335bf6b3214
5
5
  SHA512:
6
- metadata.gz: 20ac03931ea956c7cf85ae5e385c29e6042cc13361e786a4ecdb724cf434329ce6335a5d2308a724e0e003fa49f089f481b94232d236b87e15a145ac17e47197
7
- data.tar.gz: cf4aaf8db11fcef84542f10f46966729a7219b51a3c158232f9943c7e10a2a037365f2dd1b2ba7107cf2687237c2d21243da15988a08679ef7c59ef475ae1cd3
6
+ metadata.gz: f3f7281768325abef203d411fe1bb1d9ee62a4eddc5f04e010608750954732036951a17e73dfd8f12ea2e32806aa9590d66f7829af159e8fe034c152efdab58a
7
+ data.tar.gz: 4c349f1983ae38dcc5f99bfe0323506312ee5581d3ac10c95fcc76da65edb18f4f8a87504953f8994529d9e75b9380632aac067ba622a02537adc72602551556
data/lib/tasks/db.rake ADDED
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :db do
4
+ desc "Stamp auxiliary test databases with the primary database's schema_migrations rows"
5
+ task stamp_auxiliary_test_schemas: :environment do
6
+ next unless Rails.env.test?
7
+
8
+ primary_name = ActiveRecord::Base.connection_db_config.name
9
+ configs = ActiveRecord::Base.configurations.configs_for(env_name: 'test')
10
+ primary = configs.find { |c| c.name == primary_name }
11
+ auxiliary = configs - [primary]
12
+ next if auxiliary.empty?
13
+
14
+ connection = ActiveRecord::Base.connection
15
+ primary_versions =
16
+ connection
17
+ .execute("SELECT version FROM #{primary.database}.schema_migrations")
18
+ .to_a.flatten
19
+
20
+ auxiliary.each do |config|
21
+ existing =
22
+ connection
23
+ .execute("SELECT version FROM #{config.database}.schema_migrations")
24
+ .to_a.flatten
25
+
26
+ (primary_versions - existing).each do |version|
27
+ puts "Stamping #{version} for #{config.database}"
28
+ connection.execute(
29
+ "INSERT INTO #{config.database}.schema_migrations (version) VALUES (#{version.to_i})"
30
+ )
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ %w[db:schema:load db:migrate db:test:prepare].each do |task|
37
+ Rake::Task[task].enhance do
38
+ Rake::Task['db:stamp_auxiliary_test_schemas'].invoke if Rails.env.test?
39
+ end
40
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Support
5
- VERSION = '0.2.28-1'
5
+ VERSION = '0.2.28'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.28.pre.1
4
+ version: 0.2.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
@@ -65,6 +65,7 @@ files:
65
65
  - config/routes.rb
66
66
  - db/hq/members_schema.rb
67
67
  - db/hq/websites_schema.rb
68
+ - lib/tasks/db.rake
68
69
  - lib/usps/all.rb
69
70
  - lib/usps/support.rb
70
71
  - lib/usps/support/db/members_schema.rb