active_record_proxy_adapters 0.10.1 → 0.10.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 70250167498af840cadd4a35c83be8d093566e414c84c44b821c9d2e23dea3ca
|
|
4
|
+
data.tar.gz: '093ec59b4123dc6b695eff81f124fca929619cc9ed33709b2167fb01863fa3fb'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a782b3dea740b91f81c5f57a97cb9116343cbb990a41a80757d713e7893b5fa9d1565c730ed0eab8f55902a248551abcc5c8bfa6579ed51c3d5ae4d6e435eca5
|
|
7
|
+
data.tar.gz: 9fa48c67ac8da9ee1f9e4b1bacff13847eec8d1b8c3956bc6de822096b343e1d4ac2a65740ecf3525682e0d380fa6f928e0cdcd6c7255d101fcb03912392ed5b
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "rack"
|
|
4
|
+
require "rack/events"
|
|
4
5
|
require "json"
|
|
5
6
|
require "active_record_proxy_adapters/context"
|
|
6
7
|
require "active_record_proxy_adapters/contextualizer"
|
|
@@ -43,6 +44,16 @@ module ActiveRecordProxyAdapters
|
|
|
43
44
|
Rack::Utils.set_cookie_header!(headers, COOKIE_NAME, cookie)
|
|
44
45
|
end.freeze
|
|
45
46
|
|
|
47
|
+
class EventHandler # rubocop:disable Style/Documentation
|
|
48
|
+
include Rack::Events::Abstract
|
|
49
|
+
include Mixin::Configuration
|
|
50
|
+
include Contextualizer
|
|
51
|
+
|
|
52
|
+
def on_finish(_request, _response)
|
|
53
|
+
self.current_context = context_store.new({})
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
46
57
|
def initialize(app, cookie_options = {})
|
|
47
58
|
@app = app
|
|
48
59
|
@cookie_options = cookie_options
|
|
@@ -2,21 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
require "active_support"
|
|
4
4
|
require "active_record_proxy_adapters/core"
|
|
5
|
-
require "active_record_proxy_adapters/railties/postgresql"
|
|
6
5
|
require "active_record_proxy_adapters/railties/mysql2"
|
|
7
|
-
require "active_record_proxy_adapters/railties/
|
|
6
|
+
require "active_record_proxy_adapters/railties/postgresql"
|
|
7
|
+
require "active_record_proxy_adapters/railties/rack_middleware"
|
|
8
8
|
require "active_record_proxy_adapters/railties/sqlite3"
|
|
9
|
+
require "active_record_proxy_adapters/railties/trilogy"
|
|
9
10
|
|
|
10
11
|
module ActiveRecordProxyAdapters
|
|
11
12
|
# Hooks into rails boot process to extend ActiveRecord with the proxy adapter.
|
|
12
13
|
class Railtie < Rails::Railtie
|
|
13
|
-
require "active_record_proxy_adapters/middleware"
|
|
14
14
|
require "active_record_proxy_adapters/rake"
|
|
15
15
|
|
|
16
|
-
initializer "active_record_proxy_adapters.configure_rails_initialization" do |app|
|
|
17
|
-
app.middleware.use ActiveRecordProxyAdapters::Middleware
|
|
18
|
-
end
|
|
19
|
-
|
|
20
16
|
rake_tasks do
|
|
21
17
|
ActiveRecordProxyAdapters::Rake.load_tasks
|
|
22
18
|
ActiveRecordProxyAdapters::Rake.enhance_db_tasks
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "active_support"
|
|
4
|
+
require "active_record_proxy_adapters/middleware"
|
|
5
|
+
|
|
6
|
+
module ActiveRecordProxyAdapters
|
|
7
|
+
# Hooks into rails boot process to add the rack middleware for stickiness cookies.
|
|
8
|
+
class RackMiddleware < Rails::Railtie
|
|
9
|
+
initializer "active_record_proxy_adapters.add_middleware_to_rack_stack" do |app|
|
|
10
|
+
app.middleware.use ActiveRecordProxyAdapters::Middleware
|
|
11
|
+
app.middleware.use Rack::Events, [ActiveRecordProxyAdapters::Middleware::EventHandler.new]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_record_proxy_adapters
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Cruz
|
|
@@ -138,6 +138,7 @@ files:
|
|
|
138
138
|
- lib/active_record_proxy_adapters/railtie.rb
|
|
139
139
|
- lib/active_record_proxy_adapters/railties/mysql2.rb
|
|
140
140
|
- lib/active_record_proxy_adapters/railties/postgresql.rb
|
|
141
|
+
- lib/active_record_proxy_adapters/railties/rack_middleware.rb
|
|
141
142
|
- lib/active_record_proxy_adapters/railties/sqlite3.rb
|
|
142
143
|
- lib/active_record_proxy_adapters/railties/trilogy.rb
|
|
143
144
|
- lib/active_record_proxy_adapters/rake.rb
|