deprecation 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f0294caaf9c47a8c5bb0121b9907e599f24a28f9
4
- data.tar.gz: e9f9f0846e9ab26bed0f9d2c6ff80e2e3329934d
2
+ SHA256:
3
+ metadata.gz: e9a260ef95ae7ea900cdccf416399e8168e8da46ab3495addb20f104a3126657
4
+ data.tar.gz: 34417abfaf5f55051c0046f3b68a7deac496be50b79ebd750939305134a36f47
5
5
  SHA512:
6
- metadata.gz: 731969d6dfbff488ba910fb1be43dd186c5d39c741b2f8260cf35caa5ba4b8d5ccd47642af35561031835382e3fb20410d895e2e2e85560471628333d8ef1913
7
- data.tar.gz: fe9190e632c3aff7ddb72e2142a29ff3e6fe0ff0c5263416a3d42fb169af2fd9c0aa8ffd0df073aa98b11957357ef329dadd111ff88168db6db638f885bd6640
6
+ metadata.gz: 13c2f5fd578288526c121533c676e4e29d1efa38c28d8f6de77807ee258a0a23c090bfbbdf4b2f55104c3885fb385f097da4cc83f9bd0ecae63f2e7ee3451abe
7
+ data.tar.gz: a8e27ab502a86737076f1decb8f7de57c8945a716adb64657692a618e394c8a39b5ba95f3816cd56fb3023d29f6dcf293089fb8fda2f15565bff20cc8cb8b779
@@ -0,0 +1,31 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: CI
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby: [2.6, 2.7, 3.0]
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+ - name: Set up Ruby
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: ${{ matrix.ruby }}
28
+ - name: Install dependencies
29
+ run: bundle install
30
+ - name: Run tests
31
+ run: bundle exec rake
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  Deprecation
2
2
  ------------
3
- [![Build Status](https://travis-ci.org/cbeer/deprecation.png?branch=master)](https://travis-ci.org/cbeer/deprecation)
4
-
5
3
  Provide deprecation warnings for code
6
4
 
7
5
  ## Add warnings
@@ -52,4 +50,4 @@ Deprecation.default_deprecation_behavior = :raise # Raise an exception when usin
52
50
 
53
51
  Deprecation.default_deprecation_behavior = :silence # ignore all deprecations
54
52
 
55
- ```
53
+ ```
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.homepage = "http://github.com/cbeer/deprecation"
13
13
  s.license = "MIT"
14
14
 
15
- s.required_ruby_version = '~> 2.1'
15
+ s.required_ruby_version = '>= 2.1'
16
16
 
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -25,4 +25,3 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency "rspec", ">= 2.14"
26
26
  s.add_development_dependency "bundler", ">= 1.0.14"
27
27
  end
28
-
@@ -49,9 +49,6 @@ module Deprecation
49
49
  end
50
50
 
51
51
  included do
52
- class << self
53
- end
54
-
55
52
  # By default, warnings are not silenced and debugging is off.
56
53
  self.silenced = false
57
54
  self.debug = false
@@ -9,17 +9,32 @@ module Deprecation
9
9
 
10
10
  generated_deprecation_methods = Module.new
11
11
  method_names.each do |method_name|
12
- generated_deprecation_methods.module_eval(<<-end_eval, __FILE__, __LINE__ + 1)
13
- def #{method_name}(*args, &block)
14
- Deprecation.warn(#{target_module.to_s},
15
- Deprecation.deprecated_method_warning(#{target_module.to_s},
16
- :#{method_name},
17
- #{options[method_name].inspect}),
18
- caller
19
- )
20
- super
21
- end
22
- end_eval
12
+ if RUBY_VERSION < '3'
13
+ generated_deprecation_methods.module_eval(<<-end_eval, __FILE__, __LINE__ + 1)
14
+ def #{method_name}(*args, &block)
15
+ Deprecation.warn(#{target_module.to_s},
16
+ Deprecation.deprecated_method_warning(#{target_module.to_s},
17
+ :#{method_name},
18
+ #{options[method_name].inspect}),
19
+ caller
20
+ )
21
+ super
22
+ end
23
+ pass_keywords(:#{method_name}) if respond_to?(:pass_keywords, true)
24
+ end_eval
25
+ else
26
+ generated_deprecation_methods.module_eval(<<-end_eval, __FILE__, __LINE__ + 1)
27
+ def #{method_name}(*args, **kwargs, &block)
28
+ Deprecation.warn(#{target_module.to_s},
29
+ Deprecation.deprecated_method_warning(#{target_module.to_s},
30
+ :#{method_name},
31
+ #{options[method_name].inspect}),
32
+ caller
33
+ )
34
+ super
35
+ end
36
+ end_eval
37
+ end
23
38
  end
24
39
  target_module.prepend generated_deprecation_methods
25
40
  end
@@ -1,3 +1,3 @@
1
1
  module Deprecation
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -9,13 +9,13 @@ describe Deprecation do
9
9
 
10
10
 
11
11
  def a
12
- 1
12
+ 1
13
13
  end
14
14
 
15
15
  deprecation_deprecate :a
16
16
 
17
17
  def b
18
-
18
+
19
19
  end
20
20
 
21
21
  def c
@@ -23,15 +23,21 @@ describe Deprecation do
23
23
  end
24
24
 
25
25
  def d
26
-
26
+ 4
27
27
  end
28
-
28
+
29
29
  deprecation_deprecate :c, :d
30
30
 
31
31
  def e
32
32
 
33
33
  end
34
34
  deprecation_deprecate :e => { :deprecation_horizon => 'asdf 1.4' }
35
+
36
+
37
+ def f(x, foo: nil)
38
+ 7
39
+ end
40
+ deprecation_deprecate :f
35
41
  end
36
42
  subject { DeprecationTest.new}
37
43
 
@@ -41,6 +47,32 @@ describe Deprecation do
41
47
  end
42
48
  end
43
49
 
50
+ describe "a method that takes positional args and keyword args" do
51
+ around do |example|
52
+ # We need to suppress the raise behavior, so we can ensure the original method is called
53
+ DeprecationTest.deprecation_behavior = :silence
54
+ example.run
55
+ DeprecationTest.deprecation_behavior = :raise
56
+ end
57
+
58
+ it "delegates to the original" do
59
+ expect(subject.f 9, foo: 3).to eq 7
60
+ end
61
+ end
62
+
63
+ describe "a method that takes no args" do
64
+ around do |example|
65
+ # We need to suppress the raise behavior, so we can ensure the original method is called
66
+ DeprecationTest.deprecation_behavior = :silence
67
+ example.run
68
+ DeprecationTest.deprecation_behavior = :raise
69
+ end
70
+
71
+ it "delegates to the original" do
72
+ expect(subject.d).to eq 4
73
+ end
74
+ end
75
+
44
76
  describe "b" do
45
77
  it "should not be deprecated" do
46
78
  expect { subject.b }.not_to raise_error
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: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-04 00:00:00.000000000 Z
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -73,8 +73,8 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".github/workflows/ruby.yml"
76
77
  - ".gitignore"
77
- - ".travis.yml"
78
78
  - Gemfile
79
79
  - LICENSE
80
80
  - README.md
@@ -100,7 +100,7 @@ require_paths:
100
100
  - lib
101
101
  required_ruby_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - "~>"
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '2.1'
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -109,8 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
- rubyforge_project:
113
- rubygems_version: 2.4.5.1
112
+ rubygems_version: 3.1.2
114
113
  signing_key:
115
114
  specification_version: 4
116
115
  summary: Stand-alone deprecation library borrowed from ActiveSupport::Deprecation
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.8
4
- - 2.2.4
5
- - 2.3.0
6
- - jruby-9.0.4.0