usps-support 0.2.44 → 0.2.45
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/usps/all.rb +1 -4
- data/lib/usps/support/version.rb +1 -1
- data/lib/usps/support.rb +1 -1
- metadata +1 -4
- data/lib/tasks/db.rake +0 -16
- data/lib/usps/support/db/auxiliary_stamper.rb +0 -46
- data/lib/usps/support/railtie.rb +0 -37
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f333ae8e6b1ebd37bd6ec0aabc4a07db42777ffd2031f4c7b119fb7f71e22392
|
|
4
|
+
data.tar.gz: 82e6f7a84a0a8eaa2557ece29630965a896f8ce20502bad455bbe06821d5e78d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72e0c952b68a7a62e99f61b3815568aba3453c35b28c69ee15a17acc2882df635ddccca0df5e60290bbbeda36b3c3b3205fec16f93f8d211941d4d98d9b66981
|
|
7
|
+
data.tar.gz: 95defc9a3bf120dba61375e6929f01b0affcfc8ad532ed79e200773fbeb70b9080723bda995097b767b8a1922424c5ecdb9ebdef0257c4fc8368d6f6515a9d97
|
data/lib/usps/all.rb
CHANGED
data/lib/usps/support/version.rb
CHANGED
data/lib/usps/support.rb
CHANGED
|
@@ -18,7 +18,7 @@ require_relative 'support/helpers'
|
|
|
18
18
|
require_relative 'support/models'
|
|
19
19
|
require_relative 'support/lib'
|
|
20
20
|
|
|
21
|
-
# The
|
|
21
|
+
# The Engine require lives in `usps/all`, not here. This file can
|
|
22
22
|
# legitimately be required before Rails is loaded (e.g. from .simplecov to pull
|
|
23
23
|
# in Usps::Support::Lib helpers), and because Ruby caches loaded files, a
|
|
24
24
|
# conditional `if defined?(Rails)` block here would be evaluated once with
|
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.
|
|
4
|
+
version: 0.2.45
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julian Fiander
|
|
@@ -77,10 +77,8 @@ files:
|
|
|
77
77
|
- config/routes.rb
|
|
78
78
|
- db/hq/members_schema.rb
|
|
79
79
|
- db/hq/websites_schema.rb
|
|
80
|
-
- lib/tasks/db.rake
|
|
81
80
|
- lib/usps/all.rb
|
|
82
81
|
- lib/usps/support.rb
|
|
83
|
-
- lib/usps/support/db/auxiliary_stamper.rb
|
|
84
82
|
- lib/usps/support/db/members_schema.rb
|
|
85
83
|
- lib/usps/support/db/websites_schema.rb
|
|
86
84
|
- lib/usps/support/engine.rb
|
|
@@ -120,7 +118,6 @@ files:
|
|
|
120
118
|
- lib/usps/support/models/hq/squadrons/squadron.rb
|
|
121
119
|
- lib/usps/support/models/hq/squadrons/website.rb
|
|
122
120
|
- lib/usps/support/models/toast.rb
|
|
123
|
-
- lib/usps/support/railtie.rb
|
|
124
121
|
- lib/usps/support/sidekiq_auth.rb
|
|
125
122
|
- lib/usps/support/version.rb
|
|
126
123
|
homepage: https://github.com/unitedstatespowersquadrons/usps-support
|
data/lib/tasks/db.rake
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'usps/support/db/auxiliary_stamper'
|
|
4
|
-
|
|
5
|
-
namespace :db do
|
|
6
|
-
desc "Stamp auxiliary test databases with the primary database's schema_migrations rows"
|
|
7
|
-
task stamp_auxiliary_test_schemas: :environment do
|
|
8
|
-
Usps::Support::Db::AuxiliaryStamper.call
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
%w[db:schema:load db:migrate db:test:prepare].each do |task|
|
|
13
|
-
Rake::Task[task].enhance do
|
|
14
|
-
Rake::Task['db:stamp_auxiliary_test_schemas'].invoke if Rails.env.test?
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Usps
|
|
4
|
-
module Support
|
|
5
|
-
module Db
|
|
6
|
-
# Copies the primary test database's schema_migrations rows into each
|
|
7
|
-
# auxiliary test database, so Rails' pending-migration check doesn't see
|
|
8
|
-
# the primary's migrations as pending against schemas that don't run them.
|
|
9
|
-
#
|
|
10
|
-
module AuxiliaryStamper
|
|
11
|
-
class << self
|
|
12
|
-
def call(io: $stdout)
|
|
13
|
-
primary, auxiliary = test_configs
|
|
14
|
-
return if auxiliary.empty?
|
|
15
|
-
|
|
16
|
-
ActiveRecord::Base.connection_pool.with_connection do |connection|
|
|
17
|
-
primary_versions = fetch_versions(connection, primary.database)
|
|
18
|
-
|
|
19
|
-
auxiliary.each do |config|
|
|
20
|
-
existing = fetch_versions(connection, config.database)
|
|
21
|
-
(primary_versions - existing).each do |version|
|
|
22
|
-
io.puts "Stamping #{version} for #{config.database}"
|
|
23
|
-
connection.execute(
|
|
24
|
-
"INSERT INTO #{config.database}.schema_migrations (version) VALUES (#{version.to_i})"
|
|
25
|
-
)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
def test_configs
|
|
34
|
-
configs = ActiveRecord::Base.configurations.configs_for(env_name: 'test')
|
|
35
|
-
primary = configs.find(&:primary?) || configs.first
|
|
36
|
-
[primary, configs - [primary]]
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def fetch_versions(connection, database)
|
|
40
|
-
connection.execute("SELECT version FROM #{database}.schema_migrations").to_a.flatten
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
data/lib/usps/support/railtie.rb
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rails'
|
|
4
|
-
|
|
5
|
-
module Usps
|
|
6
|
-
module Support
|
|
7
|
-
# Expose rake tasks to Rails and ensure auxiliary test schemas stay in
|
|
8
|
-
# sync with the primary's schema_migrations before Rails runs its
|
|
9
|
-
# pending-migration check.
|
|
10
|
-
#
|
|
11
|
-
class Railtie < Rails::Railtie
|
|
12
|
-
railtie_name :usps_support
|
|
13
|
-
|
|
14
|
-
rake_tasks do
|
|
15
|
-
path = File.expand_path(__dir__)
|
|
16
|
-
Dir.glob("#{path}/../../tasks/**/*.rake").each { |f| load f }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
initializer 'usps_support.stamp_auxiliary_test_schemas' do
|
|
20
|
-
next unless Rails.env.test?
|
|
21
|
-
|
|
22
|
-
require 'usps/support/db/auxiliary_stamper'
|
|
23
|
-
|
|
24
|
-
ActiveSupport.on_load(:active_record) do
|
|
25
|
-
ActiveRecord::Migration.singleton_class.prepend(
|
|
26
|
-
Module.new do
|
|
27
|
-
def maintain_test_schema!
|
|
28
|
-
Usps::Support::Db::AuxiliaryStamper.call(io: File.open(File::NULL, 'w'))
|
|
29
|
-
super
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|