deprecation 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/deprecation/reporting.rb +10 -3
- data/lib/deprecation/version.rb +1 -1
- data/spec/deprecation_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 974299a00be061d7c77bea75662264bd90e84e88
|
4
|
+
data.tar.gz: 05b05522f673a5bc35aa022b62ea375c771a17b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1defcbe01ed8c8a00b912284629e1442106000ad83d2617bb066025e53ee81d7713457e285aca39ec89c2bf8f623b425055484d21e98c97e022e8ef2c1d4a253
|
7
|
+
data.tar.gz: c24c5064090d8be010fd9411eaa5344f11bfe9cfa937842be1cb1b6388c0b4ac9ec54a4f6f16b3ddfa35123d26dc5461911f3cf8c90ea60b0d216ed5cfd6caad
|
@@ -18,7 +18,7 @@ module Deprecation
|
|
18
18
|
end
|
19
19
|
|
20
20
|
deprecation_message(callstack, message).tap do |m|
|
21
|
-
deprecation_behavior(context).each { |b| b.call(m, callstack) }
|
21
|
+
deprecation_behavior(context).each { |b| b.call(m, sanitized_callstack(callstack)) }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -92,8 +92,7 @@ module Deprecation
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def extract_callstack(callstack)
|
95
|
-
|
96
|
-
offending_line = callstack.find { |line| !line.start_with?(deprecation_gem_root) and line !~ IGNORE_REGEX } || callstack.first
|
95
|
+
offending_line = sanitized_callstack(callstack).first || callstack.first
|
97
96
|
if offending_line
|
98
97
|
if md = offending_line.match(/^(.+?):(\d+)(?::in `(.*?)')?/)
|
99
98
|
md.captures
|
@@ -102,5 +101,13 @@ module Deprecation
|
|
102
101
|
end
|
103
102
|
end
|
104
103
|
end
|
104
|
+
|
105
|
+
def sanitized_callstack(callstack)
|
106
|
+
callstack.reject { |line| line.start_with? deprecation_gem_root}.select { |line| (line =~ IGNORE_REGEX).nil? }
|
107
|
+
end
|
108
|
+
|
109
|
+
def deprecation_gem_root
|
110
|
+
File.expand_path("../..", __FILE__) + "/"
|
111
|
+
end
|
105
112
|
end
|
106
113
|
end
|
data/lib/deprecation/version.rb
CHANGED
data/spec/deprecation_spec.rb
CHANGED
@@ -95,7 +95,7 @@ describe Deprecation do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should provide a useful deprecation trace" do
|
98
|
-
logger.
|
98
|
+
expect(logger).to receive(:warn).with(/called from old_method/)
|
99
99
|
expect(A.new.old_method).to eq true
|
100
100
|
|
101
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deprecation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|