rails-callback_log 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +21 -0
- data/README.md +4 -0
- data/lib/rails-callback_log.rb +23 -22
- data/lib/rails_callback_log/version.rb +3 -1
- data/rails-callback_log.gemspec +2 -2
- metadata +12 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ee7d00d4e5ee7220ced65f81b17d3c67d53412a
|
4
|
+
data.tar.gz: 2658d820fcd402f76f495ce80425fc7652971efe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 947f4b80bc95ee71f91ebeb43db6b3ca829187280db3c9b831380678389c9b1ff4a561992bb572bc87b5b354d2128a9af025a5dadab4b21c610dd93962cccdca
|
7
|
+
data.tar.gz: 3e62d6a4bdecfc925c602df1df5c8e3f9712c15710ba642bcee4ba4f0c7fe9c2d82b44cf6c4c28a6ffee62cccafd1ba1dd876c63afb925fe492e95336041bb4c
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
This gem conforms to [semver 2.0.0][1] and follows the recommendations of
|
4
|
+
[keepachangelog.com][2].
|
5
|
+
|
6
|
+
### 0.1.0 (2016-07-25)
|
7
|
+
|
8
|
+
Breaking changes:
|
9
|
+
|
10
|
+
- Drop support for ruby 1.9.3
|
11
|
+
|
12
|
+
Added:
|
13
|
+
|
14
|
+
- Support for rails 5.0
|
15
|
+
|
16
|
+
### 0.0.3 (2016-06-24)
|
17
|
+
|
18
|
+
Initial release, support for rails 4.2 only.
|
19
|
+
|
20
|
+
[1]: http://semver.org/
|
21
|
+
[2]: http://keepachangelog.com/
|
data/README.md
CHANGED
@@ -26,6 +26,10 @@ unset RAILS_CALLBACK_LOG_FILTER
|
|
26
26
|
|
27
27
|
Filtering incurs a serious performance penalty, so it is off by default.
|
28
28
|
|
29
|
+
## See Also
|
30
|
+
|
31
|
+
- http://stackoverflow.com/q/13089936/567762
|
32
|
+
|
29
33
|
## License
|
30
34
|
|
31
35
|
The gem is available as open source under the terms of the [MIT
|
data/lib/rails-callback_log.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
require "active_support/callbacks"
|
2
1
|
require "rails_callback_log/version"
|
3
2
|
|
3
|
+
# We expect `ActiveSupport::Callbacks::Callback#make_lambda` to be defined before we
|
4
|
+
# continue, because we are going to overwrite it.
|
5
|
+
require "active_support/all"
|
6
|
+
|
4
7
|
module RailsCallbackLog
|
5
8
|
# Filtering is very expensive. It makes my test suite more than 50%
|
6
9
|
# slower. So, it's off by default.
|
@@ -17,29 +20,27 @@ module RailsCallbackLog
|
|
17
20
|
@@filters ||= %w(app lib).map { |dir| (::Rails.root + dir).to_s }
|
18
21
|
end
|
19
22
|
end
|
20
|
-
end
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
::Rails.logger.debug(format("Callback: %s", filter))
|
32
|
-
end
|
33
|
-
original_lambda.call(*args, &block)
|
34
|
-
}
|
24
|
+
module CallbackExtension
|
25
|
+
# Return a lambda that wraps `ActiveSupport::Callbacks::Callback#make_lambda`,
|
26
|
+
# adding logging.
|
27
|
+
def make_lambda(filter)
|
28
|
+
original_lambda = super(filter)
|
29
|
+
lambda { |*args, &block|
|
30
|
+
if !::RailsCallbackLog::FILTER ||
|
31
|
+
caller.any? { |line| ::RailsCallbackLog.matches_filter?(line) }
|
32
|
+
::Rails.logger.debug(format("Callback: %s", filter))
|
35
33
|
end
|
36
|
-
|
37
|
-
|
34
|
+
original_lambda.call(*args, &block)
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module ActiveSupport
|
41
|
+
module Callbacks
|
42
|
+
class Callback
|
43
|
+
prepend ::RailsCallbackLog::CallbackExtension
|
38
44
|
end
|
39
45
|
end
|
40
|
-
else
|
41
|
-
warn(
|
42
|
-
"RailsCallbackLog does not support rails #{::Rails.gem_version} but " \
|
43
|
-
"contributions are welcome!"
|
44
|
-
)
|
45
46
|
end
|
data/rails-callback_log.gemspec
CHANGED
@@ -15,8 +15,8 @@ require "rails_callback_log/version"
|
|
15
15
|
spec.bindir = "exe"
|
16
16
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
|
-
spec.required_ruby_version = ">=
|
19
|
-
spec.add_runtime_dependency "activesupport", "
|
18
|
+
spec.required_ruby_version = ">= 2.0"
|
19
|
+
spec.add_runtime_dependency "activesupport", [">= 4.2.0", "< 5.1"]
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.12"
|
21
21
|
spec.add_development_dependency "rake", "~> 10.0"
|
22
22
|
spec.add_development_dependency "rspec", "~> 3.0"
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-callback_log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Beck
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 4.2.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.1'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: 4.2.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.1'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,6 +82,7 @@ files:
|
|
76
82
|
- ".gitignore"
|
77
83
|
- ".rspec"
|
78
84
|
- ".travis.yml"
|
85
|
+
- CHANGELOG.md
|
79
86
|
- CODE_OF_CONDUCT.md
|
80
87
|
- Gemfile
|
81
88
|
- LICENSE.txt
|
@@ -96,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
103
|
requirements:
|
97
104
|
- - ">="
|
98
105
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
106
|
+
version: '2.0'
|
100
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
108
|
requirements:
|
102
109
|
- - ">="
|