deprecation_helper 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e69bb4ef93cda5c44fba549cfd072e0965c9fa8f323a44c96a87be315ad021be
4
- data.tar.gz: 220dc767f5dde12538c03f3be75a9ce88c7321ef2a2ee701f15c2cc49edc5c53
3
+ metadata.gz: 7d4be45e781db2774450dcad89f7a56e4a5676c9427ae4efaf750266dce5091f
4
+ data.tar.gz: a612eb5d360197fd7f0092f8874003835c015b33031a6323e170b2148e83069d
5
5
  SHA512:
6
- metadata.gz: 7fcf096afe79fd910d4d07d39b1770094a7eaa48def28d0cdf030b6843d8c23f7e5ab203431b43c760a0d3ad6e84d380b8e50f6960921c066a09ba74bee2927b
7
- data.tar.gz: 7bd9162f156db65ede8358265ba9b3820357d799f9bf0f057bc854dd330cfcf0daf2c7bea84d59ccd2a3331a82a2f6d66c5d2ae9eed5d393fee6f5c38442f778
6
+ metadata.gz: 2eee5bbe8acbe1369e3d272fb6f40abef1f5591f0c4287358dc6341e94cf13f6592ee8d3d4a072598df3b37fe64bef47ea46438bbc3a3617430d265f5ef78cc8
7
+ data.tar.gz: b228fdd32d45ab045f5c9d853693a7adac8617d3601e9e0a05432359cda12c9bfad5779d57ea100dde2efa4fd4a04d22e5bbcbe311e4620d0f790c2e53302e64
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deprecation_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Evanczuk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-22 00:00:00.000000000 Z
11
+ date: 2021-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -59,13 +59,8 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - ".gitignore"
63
- - ".rspec"
64
- - Gemfile
65
- - Gemfile.lock
66
62
  - LICENSE
67
63
  - README.md
68
- - deprecation_helper.gemspec
69
64
  - lib/deprecation_helper.rb
70
65
  - lib/deprecation_helper/deprecation_exception.rb
71
66
  - lib/deprecation_helper/private.rb
@@ -75,9 +70,6 @@ files:
75
70
  - lib/deprecation_helper/strategies/error_strategy_interface.rb
76
71
  - lib/deprecation_helper/strategies/log_error.rb
77
72
  - lib/deprecation_helper/strategies/raise_error.rb
78
- - spec/deprecation_helper_spec.rb
79
- - spec/spec_helper.rb
80
- - test.sh
81
73
  homepage:
82
74
  licenses: []
83
75
  metadata: {}
@@ -96,7 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
88
  - !ruby/object:Gem::Version
97
89
  version: '0'
98
90
  requirements: []
99
- rubygems_version: 3.0.3
91
+ rubyforge_project:
92
+ rubygems_version: 2.7.6
100
93
  signing_key:
101
94
  specification_version: 4
102
95
  summary: This is a simple, low-dependency gem for managing deprecations.
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in deprecation_helper.gemspec
4
- gemspec
data/Gemfile.lock DELETED
@@ -1,39 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- deprecation_helper (1.0.0.pre.gusto.pre.pre)
5
- sorbet-runtime (~> 0.5.6293)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- diff-lcs (1.4.4)
11
- rspec (3.10.0)
12
- rspec-core (~> 3.10.0)
13
- rspec-expectations (~> 3.10.0)
14
- rspec-mocks (~> 3.10.0)
15
- rspec-core (3.10.1)
16
- rspec-support (~> 3.10.0)
17
- rspec-expectations (3.10.1)
18
- diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.10.0)
20
- rspec-mocks (3.10.1)
21
- diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.10.0)
23
- rspec-support (3.10.1)
24
- sorbet (0.5.6293)
25
- sorbet-static (= 0.5.6293)
26
- sorbet-runtime (0.5.6293)
27
- sorbet-static (0.5.6293-universal-darwin-17)
28
-
29
- PLATFORMS
30
- ruby
31
- x86_64-darwin-17
32
-
33
- DEPENDENCIES
34
- deprecation_helper!
35
- rspec (~> 3.0)
36
- sorbet (~> 0.5.6293)
37
-
38
- BUNDLED WITH
39
- 2.2.4
@@ -1,25 +0,0 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = 'deprecation_helper'
6
- spec.version = '0.1.0'
7
- spec.authors = ['Alex Evanczuk']
8
- spec.email = ['alex.evanczuk@gusto.com']
9
-
10
- spec.summary = 'This is a simple, low-dependency gem for managing deprecations.'
11
-
12
- # Specify which files should be added to the gem when it is released.
13
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
14
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
15
- `git ls-files -z`.split("\u0000").reject { |f| f.match(%r{A(test|spec|features)/}) }
16
- end
17
- spec.bindir = 'exe'
18
- spec.executables = spec.files.grep(%r{Aexe/}) { |f| File.basename(f) }
19
- spec.require_paths = ['lib']
20
-
21
- spec.add_dependency 'sorbet-runtime', '~> 0.5.6293'
22
-
23
- spec.add_development_dependency 'rspec', '~> 3.0'
24
- spec.add_development_dependency 'sorbet', '~> 0.5.6293'
25
- end
@@ -1,129 +0,0 @@
1
- RSpec.describe DeprecationHelper do
2
- describe 'deprecate!' do
3
- subject { DeprecationHelper.deprecate!(input_parameter) }
4
-
5
- let(:error_backtrace) do
6
- ['frame0', 'frame1', 'frame2', 'some_special_complicated_frame']
7
- end
8
- let(:expected_exception_class) { DeprecationHelper::DeprecationException }
9
- let(:message) { 'This thing is deprecated' }
10
- let(:input_parameter) { message }
11
-
12
- let(:logger) { sorbet_double(Logger, warn: nil) }
13
-
14
- before do
15
- allow(Logger).to receive(:new).with(STDOUT).and_return(logger)
16
- allow(DeprecationHelper).to receive(:caller).and_return(error_backtrace)
17
- end
18
-
19
- shared_examples 'it raises the error' do |expected_message|
20
- it do
21
- expect { subject }.to raise_error(expected_exception_class, expected_message)
22
- end
23
- end
24
-
25
- shared_examples 'it does not raise an error' do
26
- it do
27
- expect { subject }.to_not raise_error
28
- end
29
- end
30
-
31
- context 'configured to do nothing' do
32
- before do
33
- DeprecationHelper.configure do |config|
34
- config.deprecation_strategies = []
35
- end
36
- end
37
-
38
- it_behaves_like 'it does not raise an error'
39
- end
40
-
41
- context 'configured to raise' do
42
- before do
43
- DeprecationHelper.configure do |config|
44
- config.deprecation_strategies = [DeprecationHelper::Strategies::RaiseError.new]
45
- end
46
- end
47
-
48
- context 'allow list is not passed in' do
49
- it_behaves_like 'it raises the error', 'This thing is deprecated'
50
- end
51
-
52
- context 'allow list is passed in' do
53
- before { allow(DeprecationHelper).to receive(:caller).and_return(['frame0', 'frame1', 'frame2', 'some_special_complicated_frame']) }
54
-
55
- subject { DeprecationHelper.deprecate!(input_parameter, allow_list: allow_list) }
56
-
57
- context 'allow list is passed in, but empty' do
58
- let(:allow_list) { [] }
59
-
60
- it_behaves_like 'it raises the error', 'This thing is deprecated'
61
- end
62
-
63
- context 'allow list is passed in, but does not cover permit this exception' do
64
- let(:allow_list) { ['frame10'] }
65
-
66
- it_behaves_like 'it raises the error', 'This thing is deprecated'
67
- end
68
-
69
- context 'allow list permits this exception with a simple string match list' do
70
- let(:allow_list) { ['frame1'] }
71
-
72
- it_behaves_like 'it does not raise an error'
73
- end
74
-
75
- context 'allow list permits this exception with a simple regexp match list' do
76
- let(:allow_list) { [/frame1/] }
77
-
78
- it_behaves_like 'it does not raise an error'
79
- end
80
-
81
- context 'allow list permits this exception with a more complex regexp match list' do
82
- let(:allow_list) { [/special.*?frame/] }
83
-
84
- it_behaves_like 'it does not raise an error'
85
- end
86
- end
87
- end
88
-
89
- context 'configured to do log' do
90
- before do
91
- DeprecationHelper.configure do |config|
92
- config.deprecation_strategies = [DeprecationHelper::Strategies::LogError.new]
93
- end
94
- end
95
-
96
- context 'logger is not set' do
97
- before do
98
- DeprecationHelper.configure do |config|
99
- config.deprecation_strategies = [DeprecationHelper::Strategies::LogError.new]
100
- end
101
- end
102
-
103
- it_behaves_like 'it does not raise an error'
104
-
105
- it 'logs an error' do
106
- expect(logger).to receive(:warn).with('This thing is deprecated')
107
- subject
108
- end
109
- end
110
- end
111
-
112
- context 'configured for multiple purposes' do
113
- let(:logger) { Logger.new(STDOUT) }
114
-
115
- before do
116
- DeprecationHelper.configure do |config|
117
- config.deprecation_strategies = [DeprecationHelper::Strategies::LogError.new(logger: logger), DeprecationHelper::Strategies::RaiseError.new]
118
- end
119
- end
120
-
121
- it_behaves_like 'it raises the error', 'This thing is deprecated'
122
-
123
- it 'logs an error' do
124
- expect(logger).to receive(:warn).with('This thing is deprecated')
125
- expect { subject }.to raise_error(StandardError)
126
- end
127
- end
128
- end
129
- end
data/spec/spec_helper.rb DELETED
@@ -1,27 +0,0 @@
1
- require 'bundler/setup'
2
- require 'deprecation_helper'
3
-
4
- RSpec.configure do |config|
5
- # Enable flags like --only-failures and --next-failure
6
- config.example_status_persistence_file_path = '.rspec_status'
7
-
8
- # Disable RSpec exposing methods globally on `Module` and `main`
9
- config.disable_monkey_patching!
10
-
11
- config.expect_with :rspec do |c|
12
- c.syntax = :expect
13
- end
14
-
15
- config.before do
16
- # Reset the config to defaults prior to each test
17
- DeprecationHelper.configure do |helper_config|
18
- helper_config.deprecation_strategies = []
19
- end
20
- end
21
- end
22
-
23
- def sorbet_double(stubbed_class, attr_map = {})
24
- instance_double(stubbed_class, attr_map).tap do |dbl|
25
- allow(dbl).to receive(:is_a?) { |tested_class| stubbed_class.ancestors.include?(tested_class) }
26
- end
27
- end
data/test.sh DELETED
@@ -1,11 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- bundle check || bundle install --retry 1
6
- bundle exec rspec
7
- STATUS=$?
8
-
9
- popd
10
-
11
- exit $STATUS