huyegger 0.2.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/lib/huyegger/middlewares/rails.rb +15 -0
- data/lib/huyegger/middlewares/sidekiq.rb +10 -0
- data/lib/huyegger/railtie.rb +6 -4
- data/lib/huyegger/version.rb +1 -1
- metadata +3 -2
- data/lib/huyegger/middleware.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bde524d013159b9bfa72a41535feb11cc636b51
|
4
|
+
data.tar.gz: cac1ccda9fd4bc216cf878547c9aaa30d9de6c02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d856806d0c858f019e5ecda9e10e9500c65e041eb211e83809ab256876acf3b060c5e1a990132c06f3937451233550ecd11e55c02aebae37864562829fca5cb
|
7
|
+
data.tar.gz: e054effe733e8b595b5061bc8d03375db8c655194893789328ddf5d4dbbd1dcd86e16800c3c41c44e1920bd4477d9d7b98d1f3a701735bfcf59d63c11a3883a8
|
data/README.md
CHANGED
@@ -67,6 +67,19 @@ class ApplicationController < ActionController::Base
|
|
67
67
|
end
|
68
68
|
```
|
69
69
|
|
70
|
+
To use with Sidekiq
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
# inside config/initializers/sidekiq.rb
|
74
|
+
|
75
|
+
Sidekiq.configure_server do |config|
|
76
|
+
config.server_middleware do |chain|
|
77
|
+
chain.add Huyegger::Middlewares::Sidekiq
|
78
|
+
end
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
82
|
+
|
70
83
|
## Contributing
|
71
84
|
|
72
85
|
Bug reports and pull requests are welcome on GitHub at https://github.com/mainameiz/huyegger.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Huyegger
|
2
|
+
module Middlewares
|
3
|
+
class Rails
|
4
|
+
def initialize(app)
|
5
|
+
@app = app
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(env)
|
9
|
+
@app.call(env)
|
10
|
+
ensure
|
11
|
+
::Rails.logger.purge_context! if defined?(Huyegger) && ::Rails.logger.is_a?(Huyegger::Logger)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/huyegger/railtie.rb
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
+
require "huyegger/middlewares/rails"
|
2
|
+
|
1
3
|
module Huyegger
|
2
4
|
class Railtie < ::Rails::Railtie
|
3
5
|
initializer "huyegger.insert_middleware" do |app|
|
4
6
|
if ActionDispatch.const_defined? :RequestId
|
5
|
-
app.config.middleware.insert_after ActionDispatch::RequestId, Huyegger::
|
7
|
+
app.config.middleware.insert_after ActionDispatch::RequestId, Huyegger::Middlewares::Rails
|
6
8
|
else
|
7
|
-
app.config.middleware.insert_after Rack::MethodOverride, Huyegger::
|
9
|
+
app.config.middleware.insert_after Rack::MethodOverride, Huyegger::Middlewares::Rails
|
8
10
|
end
|
9
11
|
|
10
12
|
if ActiveSupport.const_defined?(:Reloader) && ActiveSupport::Reloader.respond_to?(:to_complete)
|
11
13
|
ActiveSupport::Reloader.to_complete do
|
12
|
-
Rails.logger.purge_context! if Rails.logger.is_a?(Huyegger::Logger)
|
14
|
+
::Rails.logger.purge_context! if ::Rails.logger.is_a?(Huyegger::Logger)
|
13
15
|
end
|
14
16
|
elsif ActionDispatch.const_defined?(:Reloader) && ActionDispatch::Reloader.respond_to?(:to_cleanup)
|
15
17
|
ActionDispatch::Reloader.to_cleanup do
|
16
|
-
Rails.logger.purge_context! if Rails.logger.is_a?(Huyegger::Logger)
|
18
|
+
::Rails.logger.purge_context! if ::Rails.logger.is_a?(Huyegger::Logger)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
data/lib/huyegger/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: huyegger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikolay Markov
|
@@ -70,7 +70,8 @@ files:
|
|
70
70
|
- lib/huyegger.rb
|
71
71
|
- lib/huyegger/formatter.rb
|
72
72
|
- lib/huyegger/logger.rb
|
73
|
-
- lib/huyegger/
|
73
|
+
- lib/huyegger/middlewares/rails.rb
|
74
|
+
- lib/huyegger/middlewares/sidekiq.rb
|
74
75
|
- lib/huyegger/railtie.rb
|
75
76
|
- lib/huyegger/version.rb
|
76
77
|
homepage: http://github.com/mainameiz/huyegger
|