union_station_hooks_rails 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/union_station_hooks_rails.rb +5 -2
- data/lib/union_station_hooks_rails/action_controller_extension.rb +0 -9
- data/lib/union_station_hooks_rails/action_view_subscriber.rb +55 -0
- data/lib/union_station_hooks_rails/active_record_subscriber.rb +1 -1
- data/lib/union_station_hooks_rails/version_data.rb +2 -2
- data/union_station_hooks_rails.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTI3YjEwNTE3MTBiMWIwNmY3N2MxN2QyNTc2OGI0OGFhZGFkODY3Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWVmMzI3NDdlYmEwMzVlMjFiY2Q3ZWI3MzIxNjQzN2JmNDNjZGEyNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDRjNWQ5YjkyZWQ0ZTg5MzEyOTBkMTk0ZDZlZjc3OTRhYTFmMmU2ODllOGYx
|
10
|
+
MjU5MmM1N2QzYjM0NGViZjFkMjRiZTAxYmEyNGE3YzZhODdmOWJhM2FkNGVh
|
11
|
+
YTBkNjYzMTgyN2Q4Njc0ZTYxMDAyMGYzMWQwNDJkZTAzMzU2N2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2NiYWY5YzAwNWM4MzQ3MTg3YWQxMWM4MDVkMTM3MDFkYzk3MzZhZjU3N2Nl
|
14
|
+
ZjliY2Y2MTQxZjQ4ZTlhYzQ0NmM2ODM1NDA3OGFlYzZlOGI5YWYzZDMyZTgw
|
15
|
+
NjI2M2Q2ZmVmNTc3NjU1ZWE4MzkyNjllMjA0NzQ5ZjI4ODU5MTk=
|
@@ -92,6 +92,9 @@ module UnionStationHooksRails
|
|
92
92
|
require_lib('initialize')
|
93
93
|
require_lib('active_record_subscriber')
|
94
94
|
require_lib('exception_logger')
|
95
|
+
if defined?(ActionView)
|
96
|
+
require_lib('action_view_subscriber')
|
97
|
+
end
|
95
98
|
if defined?(ActiveSupport::Cache::Store)
|
96
99
|
require_lib('active_support_cache_subscriber')
|
97
100
|
end
|
@@ -153,12 +156,12 @@ module UnionStationHooksRails
|
|
153
156
|
|
154
157
|
# If you update the dependency version here, also update
|
155
158
|
# the version in the gemspec and in the Gemfile.
|
156
|
-
compatible = UnionStationHooks::MAJOR_VERSION ==
|
159
|
+
compatible = UnionStationHooks::MAJOR_VERSION == 2 &&
|
157
160
|
UnionStationHooks::MINOR_VERSION >= 0
|
158
161
|
if !compatible
|
159
162
|
raise "This version of the union_station_hooks_rails gem " \
|
160
163
|
"(#{VERSION_STRING}) is only compatible with the " \
|
161
|
-
"union_station_hooks_core gem
|
164
|
+
"union_station_hooks_core gem 2.x.x. However, you have loaded " \
|
162
165
|
"union_station_hooks_core #{UnionStationHooks::VERSION_STRING}"
|
163
166
|
end
|
164
167
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Union Station - https://www.unionstationapp.com/
|
2
|
+
# Copyright (c) 2015 Phusion Holding B.V.
|
3
|
+
#
|
4
|
+
# "Union Station" and "Passenger" are trademarks of Phusion Holding B.V.
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
|
24
|
+
module UnionStationHooksRails
|
25
|
+
class ActionViewSubscriber < ActiveSupport::LogSubscriber
|
26
|
+
def render_collection(event)
|
27
|
+
log_view_rendering(event)
|
28
|
+
end
|
29
|
+
|
30
|
+
def render_template(event)
|
31
|
+
log_view_rendering(event)
|
32
|
+
end
|
33
|
+
|
34
|
+
def render_partial(event)
|
35
|
+
log_view_rendering(event)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def log_view_rendering(event)
|
41
|
+
reporter = Thread.current[:union_station_hooks]
|
42
|
+
return if !reporter
|
43
|
+
|
44
|
+
UnionStationHooks.call_event_pre_hook(event)
|
45
|
+
reporter.log_view_rendering(
|
46
|
+
:begin_time => event.time,
|
47
|
+
:end_time => UnionStationHooks.now,
|
48
|
+
:name => event.payload[:identifier],
|
49
|
+
:has_error => event.payload[:exception]
|
50
|
+
)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
UnionStationHooksRails::ActionViewSubscriber.attach_to(:action_view)
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
# If you update the dependency version here, also update
|
22
22
|
# the version in Gemfile and union_station_hooks_rails.rb method
|
23
23
|
# `require_and_check_union_station_hooks_core`
|
24
|
-
s.add_dependency("union_station_hooks_core", "~>
|
24
|
+
s.add_dependency("union_station_hooks_core", "~> 2.0")
|
25
25
|
|
26
26
|
s.add_dependency("activesupport", ">= 3.0")
|
27
27
|
s.add_dependency("activemodel", ">= 3.0")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: union_station_hooks_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hongli Lai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: union_station_hooks_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- README.md
|
91
91
|
- lib/union_station_hooks_rails.rb
|
92
92
|
- lib/union_station_hooks_rails/action_controller_extension.rb
|
93
|
+
- lib/union_station_hooks_rails/action_view_subscriber.rb
|
93
94
|
- lib/union_station_hooks_rails/active_record_subscriber.rb
|
94
95
|
- lib/union_station_hooks_rails/active_support_benchmarkable_extension.rb
|
95
96
|
- lib/union_station_hooks_rails/active_support_cache_subscriber.rb
|