deprecation_toolkit 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -0
- data/Gemfile.lock +1 -1
- data/lib/deprecation_toolkit/version.rb +1 -1
- data/lib/deprecation_toolkit/warning.rb +26 -11
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e89ce8cb136347a903186eec658e92f2d3e9719
|
4
|
+
data.tar.gz: 3282ad364e252d30856de442883c7e10d5ad6c36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48696cf7330bc5df5ef56bdbc96295fbb22a7477d6375389d5fe2ffde30510a05f6af450ed7b7b080f3ebe0634e11e4328a797e14e287d0ff25c5c026318cf38
|
7
|
+
data.tar.gz: f2d5a3e940f779eba10f86383ee51fe1415561e8ac57fd44bb27be842706456ff4e5372331136e69c418184a67f1fe6e0ea93b17b4099e384f993d2ae201c67d
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -2,25 +2,40 @@
|
|
2
2
|
|
3
3
|
module DeprecationToolkit
|
4
4
|
module Warning
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
super
|
10
|
-
end
|
5
|
+
extend self
|
6
|
+
|
7
|
+
def deprecation_triggered?(str)
|
8
|
+
DeprecationToolkit::Configuration.warnings_treated_as_deprecation.any? { |warning| warning =~ str }
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
15
|
-
Warning.
|
13
|
+
# Warning is a new feature in ruby 2.5
|
14
|
+
module Warning
|
15
|
+
def warn(str)
|
16
|
+
if DeprecationToolkit::Warning.deprecation_triggered?(str)
|
17
|
+
ActiveSupport::Deprecation.warn(str)
|
18
|
+
else
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
16
23
|
|
17
|
-
#
|
18
|
-
|
24
|
+
# Support for version older < 2.5
|
25
|
+
# Note that the `Warning` module exists in Ruby 2.4 but has a bug https://bugs.ruby-lang.org/issues/12944
|
26
|
+
if RUBY_VERSION < '2.5.0' && RUBY_ENGINE == 'ruby'
|
19
27
|
module Kernel
|
20
|
-
|
28
|
+
alias_method :__original_warn, :warn
|
21
29
|
|
22
30
|
def warn(*messages)
|
23
|
-
|
31
|
+
message = messages.join("\n")
|
32
|
+
message += "\n" unless message.end_with?("\n")
|
33
|
+
|
34
|
+
if DeprecationToolkit::Warning.deprecation_triggered?(message)
|
35
|
+
ActiveSupport::Deprecation.warn(message)
|
36
|
+
else
|
37
|
+
__original_warn(messages)
|
38
|
+
end
|
24
39
|
end
|
25
40
|
end
|
26
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deprecation_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- ".gitignore"
|
77
77
|
- ".rubocop-https---shopify-github-io-ruby-style-guide-rubocop-yml"
|
78
78
|
- ".rubocop.yml"
|
79
|
+
- ".travis.yml"
|
79
80
|
- Gemfile
|
80
81
|
- Gemfile.lock
|
81
82
|
- LICENSE.txt
|