deprecations_detector 0.0.1 → 0.2.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: 14223f744285f1f73bc7453f2de6a42a9a8f87b599393cb67fb9345043be5f14
4
- data.tar.gz: e1879d540ed9af626488355929a378cfbb71b83b6b9775411a7420173f65dcfc
3
+ metadata.gz: 7185d3707b17f919e9c3fdd44b33cab18e48d1fc05c97fd8f91cd1df8dfbea74
4
+ data.tar.gz: 6c8f7c961c4a2f0e0363b64558c86375c56059d309b90861ecefb386b06c06cc
5
5
  SHA512:
6
- metadata.gz: 296a9a4345d4aa010f62cd1f967430d3cf40896dbb6361b50fd8b8f8c39e652ce2b44fb464ab91bb78f4c123a786f0702d3dc460d6428b9844457d6eb1ec8dcb
7
- data.tar.gz: 14b1e67170d3e0586f6c56e7c9dd9573bc2998895aeb2f792c9afce7252dcc48e03c5c111473744b7f4f8906610652143622ef13181ad995b4a7e886f13fbb68
6
+ metadata.gz: 7b1edede24ecf8007fe412a61f3a2b067f72aa63f4ee42f4e8b0523a77d9112dc1e5a503425a907c279bf55f99355f5ba7c465f4248f442886e3056206dc224d
7
+ data.tar.gz: 2e9681f8dea3f65e96f42159df4005c88236531f9df91944bbe67c64d0d09f737cc6e5805b8e25546f234286439b1575833459e2d5d2cacaa089c80b82f8293a
@@ -0,0 +1,19 @@
1
+ name: "Rspec"
2
+ on:
3
+ pull_request:
4
+ branches: [ "main" ]
5
+ jobs:
6
+ rspec:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ steps:
11
+ - name: Checkout code
12
+ uses: actions/checkout@v3
13
+ - name: Install Ruby and gems
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 3.1.2
17
+ bundler-cache: true
18
+ - name: Run tests
19
+ run: bundle exec rspec spec
data/README.md CHANGED
@@ -6,7 +6,17 @@ The goal of this component is to collect and list all the deprecation of the pro
6
6
 
7
7
  ## Installation
8
8
 
9
- Add `gem 'deprecations_detector', git: 'https://github.com/nebulab/deprecations_detector'` to your application's Gemfile and execute `bundle`.
9
+ Add `gem 'deprecations_detector'` to your application's Gemfile and execute `bundle`.
10
+
11
+ Specify DeprecationDetector::Collect class as deprecation class with:
12
+
13
+ ```
14
+ Rails.application.configure do
15
+ ...
16
+ config.active_support.deprecation = DeprecationsDetector::Collect
17
+ ...
18
+ end
19
+ ```
10
20
 
11
21
  Put the following code under you specs configuration:
12
22
 
@@ -8,7 +8,7 @@ require 'deprecations_detector/version'
8
8
  Gem::Specification.new do |spec|
9
9
  spec.name = 'deprecations_detector'
10
10
  spec.version = DeprecationsDetector::VERSION
11
- spec.summary = 'A tool to find what specs examples cover a specific line of code'
11
+ spec.summary = 'A tool to display deprecations in a simple way on a single HTML page.'
12
12
  spec.description = spec.summary
13
13
  spec.license = 'MIT'
14
14
  spec.authors = ['Daniele Palombo']
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeprecationsDetector
4
+ class Collect
5
+ def self.call(message = "", callstack = [], deprecation_horizon = nil, gem_name = nil)
6
+ DeprecationsDetector::Main.add_deprecation(message, caller)
7
+ end
8
+
9
+ def self.arity
10
+ 4
11
+ end
12
+ end
13
+ end
@@ -4,7 +4,7 @@ module DeprecationsDetector
4
4
  class Main
5
5
  include Singleton
6
6
 
7
- attr_reader :coverage_matrix, :deprecation_matrix, :suppress_deprecations
7
+ attr_reader :coverage_matrix, :deprecation_matrix
8
8
  attr_accessor :config, :output_path
9
9
 
10
10
  def initialize
@@ -51,14 +51,14 @@ module DeprecationsDetector
51
51
  @deprecation_matrix[file_path][result[2].to_i - 1] = message
52
52
  end
53
53
 
54
- def start(suppress_deprecations: false)
55
- @suppress_deprecations = suppress_deprecations
56
-
54
+ def start
57
55
  @coverage_matrix = {}
58
56
  @deprecation_matrix = {}
59
57
  end
60
58
 
61
59
  def save_results(matrix = @coverage_matrix, file_name: ENV['MATRIX_FILENAME'] || 'deprecations_detector.yml')
60
+ matrix = {} if matrix.nil?
61
+
62
62
  path = File.join(output_path, file_name)
63
63
  FileUtils.mkdir_p(output_path)
64
64
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeprecationsDetector
4
- VERSION = '0.0.1'
4
+ VERSION = '0.2.1'
5
5
  end
@@ -4,7 +4,7 @@ require 'singleton'
4
4
  require 'yaml'
5
5
  require 'active_support'
6
6
 
7
- require_relative 'deprecations_detector/active_support/deprecation_decorator.rb'
7
+ require_relative 'deprecations_detector/collect'
8
8
  require_relative 'deprecations_detector/version'
9
9
  require_relative 'deprecations_detector/main'
10
10
  require_relative 'deprecations_detector/formatters/html/formatter'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deprecations_detector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniele Palombo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-27 00:00:00.000000000 Z
11
+ date: 2023-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -164,13 +164,14 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: 3.7.2
167
- description: A tool to find what specs examples cover a specific line of code
167
+ description: A tool to display deprecations in a simple way on a single HTML page.
168
168
  email:
169
169
  - danielepalombo@nebulab.com
170
170
  executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
+ - ".github/workflows/spec.yml"
174
175
  - ".gitignore"
175
176
  - ".rubocop.yml"
176
177
  - Gemfile
@@ -180,7 +181,7 @@ files:
180
181
  - Rakefile
181
182
  - deprecations_detector.gemspec
182
183
  - lib/deprecations_detector.rb
183
- - lib/deprecations_detector/active_support/deprecation_decorator.rb
184
+ - lib/deprecations_detector/collect.rb
184
185
  - lib/deprecations_detector/formatters/html/assets/javascripts/application.js
185
186
  - lib/deprecations_detector/formatters/html/assets/javascripts/libraries/jquery-1.6.2.min.js
186
187
  - lib/deprecations_detector/formatters/html/assets/javascripts/plugins/highlight.pack.js
@@ -250,5 +251,5 @@ requirements: []
250
251
  rubygems_version: 3.3.17
251
252
  signing_key:
252
253
  specification_version: 4
253
- summary: A tool to find what specs examples cover a specific line of code
254
+ summary: A tool to display deprecations in a simple way on a single HTML page.
254
255
  test_files: []
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DeprecationsDetector
4
- module ActiveSupport
5
- module DeprecationDecorator
6
- def warn(message = nil, callstack = caller)
7
- DeprecationsDetector::Main.add_deprecation(message, caller)
8
-
9
- return if DeprecationsDetector::Main.suppress_deprecations
10
-
11
- super(message, callstack)
12
- end
13
-
14
- ::ActiveSupport::Deprecation.prepend(self)
15
- end
16
- end
17
- end