overrides_tracker 0.1.9 → 0.1.13

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: e3c000898709ba57b70473aa59fd6390dab44ceb1bb6b2f254a8ce42616cbbb7
4
- data.tar.gz: fed1aa5117754b7a37794212b74af9ed78aa07a31b3d61710f076cf528d6fd6a
3
+ metadata.gz: 219f854619f81277c8acbec980e72ecd29baff6ce9977a5411dc75108c367a97
4
+ data.tar.gz: 6df617ee3d8c9859cd0e9e02e5209a5a19679cc7f5a7e657da3a53892ab049c1
5
5
  SHA512:
6
- metadata.gz: 3777aba73755ad0bca136387d9cc80408aafc2e1d44516e4b5ab0ba700855c317483ae92815ef642e5a53e818a15b18bfc88b96b0f15628c0f85b1affac9c9f9
7
- data.tar.gz: 9c880fb7d42d64357ed24d855a19c913892f7e98c775e17bf254e88b5a9686ed28ff56f9aecc0cc7c3ce30cadf5534ca132b649306c313584fc2239e6eaaea43
6
+ metadata.gz: 19c3852c01f26cd97c46e95367294a7246d277e9e0c47f8d5e3b65e80d0c899a5344bd82eafdadea51e784e88c745f6a4fac7115342135ba657d6d92f2c83002
7
+ data.tar.gz: f1a918217ab3df5971148dc95a95276ba5d2de07d973bd6a631a4789252cfce1f6985ac0c6f01466eaf439f1495dbbda1fc9bc2c5343979c718ed4ddc8b6dc6e
@@ -0,0 +1,20 @@
1
+ version: 2.1
2
+ orbs:
3
+ ruby: circleci/ruby@1.0.4
4
+ coveralls: coveralls/coveralls@1.0.6
5
+ jobs:
6
+ test:
7
+ docker:
8
+ - image: cimg/ruby:2.7.2-node
9
+ steps:
10
+ - checkout
11
+ - ruby/install-deps
12
+ - run:
13
+ name: Run tests
14
+ command: bundle exec rspec
15
+
16
+ workflows:
17
+ version: 2
18
+ deploy:
19
+ jobs:
20
+ - test
data/.gitignore CHANGED
@@ -1,2 +1,5 @@
1
1
  .DS_Store
2
- *.gem
2
+ *.gem
3
+
4
+ coverage/*
5
+ .rspec_status
data/Gemfile CHANGED
@@ -1,6 +1,15 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ group :development do
6
+ gem 'coveralls_reborn', '~> 0.25.0', require: false
7
+ gem 'rspec'
8
+ gem 'rspec_junit_formatter'
9
+ gem 'rubocop', require: false
10
+ gem 'simplecov', require: false
11
+ gem 'simplecov-lcov', '~> 0.8.0'
12
+ end
4
13
 
5
14
  # Specify your gem's dependencies in overrides_tracker.gemspec
6
15
  gemspec
@@ -11,4 +20,4 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9')
11
20
  else
12
21
  gem 'vcr', '>= 2.9'
13
22
  gem 'webmock', '>= 1.20'
14
- end
23
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,109 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ overrides_tracker (0.1.11)
5
+ activesupport
6
+ method_source
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (6.1.7)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
16
+ zeitwerk (~> 2.3)
17
+ addressable (2.8.1)
18
+ public_suffix (>= 2.0.2, < 6.0)
19
+ ast (2.4.2)
20
+ concurrent-ruby (1.1.10)
21
+ coveralls_reborn (0.25.0)
22
+ simplecov (>= 0.18.1, < 0.22.0)
23
+ term-ansicolor (~> 1.6)
24
+ thor (>= 0.20.3, < 2.0)
25
+ tins (~> 1.16)
26
+ crack (0.4.5)
27
+ rexml
28
+ diff-lcs (1.5.0)
29
+ docile (1.4.0)
30
+ hashdiff (1.0.1)
31
+ i18n (1.12.0)
32
+ concurrent-ruby (~> 1.0)
33
+ json (2.6.3)
34
+ method_source (1.0.0)
35
+ minitest (5.16.3)
36
+ parallel (1.22.1)
37
+ parser (3.1.3.0)
38
+ ast (~> 2.4.1)
39
+ public_suffix (5.0.1)
40
+ rainbow (3.1.1)
41
+ regexp_parser (2.6.1)
42
+ rexml (3.2.5)
43
+ rspec (3.12.0)
44
+ rspec-core (~> 3.12.0)
45
+ rspec-expectations (~> 3.12.0)
46
+ rspec-mocks (~> 3.12.0)
47
+ rspec-core (3.12.0)
48
+ rspec-support (~> 3.12.0)
49
+ rspec-expectations (3.12.0)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.12.0)
52
+ rspec-mocks (3.12.1)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.12.0)
55
+ rspec-support (3.12.0)
56
+ rspec_junit_formatter (0.6.0)
57
+ rspec-core (>= 2, < 4, != 2.12.0)
58
+ rubocop (1.40.0)
59
+ json (~> 2.3)
60
+ parallel (~> 1.10)
61
+ parser (>= 3.1.2.1)
62
+ rainbow (>= 2.2.2, < 4.0)
63
+ regexp_parser (>= 1.8, < 3.0)
64
+ rexml (>= 3.2.5, < 4.0)
65
+ rubocop-ast (>= 1.23.0, < 2.0)
66
+ ruby-progressbar (~> 1.7)
67
+ unicode-display_width (>= 1.4.0, < 3.0)
68
+ rubocop-ast (1.24.0)
69
+ parser (>= 3.1.1.0)
70
+ ruby-progressbar (1.11.0)
71
+ simplecov (0.21.2)
72
+ docile (~> 1.1)
73
+ simplecov-html (~> 0.11)
74
+ simplecov_json_formatter (~> 0.1)
75
+ simplecov-html (0.12.3)
76
+ simplecov-lcov (0.8.0)
77
+ simplecov_json_formatter (0.1.4)
78
+ sync (0.5.0)
79
+ term-ansicolor (1.7.1)
80
+ tins (~> 1.0)
81
+ thor (1.2.1)
82
+ tins (1.32.1)
83
+ sync
84
+ tzinfo (2.0.5)
85
+ concurrent-ruby (~> 1.0)
86
+ unicode-display_width (2.3.0)
87
+ vcr (6.1.0)
88
+ webmock (3.18.1)
89
+ addressable (>= 2.8.0)
90
+ crack (>= 0.3.2)
91
+ hashdiff (>= 0.4.0, < 2.0.0)
92
+ zeitwerk (2.6.6)
93
+
94
+ PLATFORMS
95
+ ruby
96
+
97
+ DEPENDENCIES
98
+ coveralls_reborn (~> 0.25.0)
99
+ overrides_tracker!
100
+ rspec
101
+ rspec_junit_formatter
102
+ rubocop
103
+ simplecov
104
+ simplecov-lcov (~> 0.8.0)
105
+ vcr (>= 2.9)
106
+ webmock (>= 1.20)
107
+
108
+ BUNDLED WITH
109
+ 2.1.4
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Overrides Tracker
2
2
  Overrides Tracker keeps track of all overriding methods in your project and allows for comparison across branches.
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/overrides_tracker.svg)](https://badge.fury.io/rb/overrides_tracker)
5
+ [![Coverage Status](https://coveralls.io/repos/github/SyborgStudios/overrides_tracker/badge.svg?branch=master)](https://coveralls.io/github/SyborgStudios/overrides_tracker?branch=master)
6
+ [![CircleCI](https://dl.circleci.com/status-badge/img/gh/SyborgStudios/overrides_tracker/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/SyborgStudios/overrides_tracker/tree/master)
7
+
4
8
  ## Contact
5
9
 
6
10
  *Code and Bug Reports*
@@ -16,7 +20,7 @@ Getting started
16
20
  ```ruby
17
21
  gem 'overrides_tracker', group: [:test, :development]
18
22
  ```
19
- 2. Add `overrides_tracker/*.otf` to your .gitignore file because you do won't to keep hold of your report file when changing branches.
23
+ 2. Add `overrides_tracker/*.otf` to your .gitignore file because you want to keep hold of your report file when switching branches.
20
24
 
21
25
  3. Track you overrides by running:
22
26
  ```ruby
@@ -43,7 +47,7 @@ Getting started
43
47
  Report saved to /PATH_TO_PROJECT/overrides_tracker/BRANCH_NAME#LAST_COMMIT_ID.otf
44
48
  ```
45
49
 
46
- 4. This will create a folder called overrides_tracker and creates a file containing all overriding methods of your branch.
50
+ 4. This will create a folder called overrides_tracker and a file containing all methods you override as well as your overrides in that branch.
47
51
 
48
52
  5. Switch branch and follow steps 1-3 again. If you want to compare multiple branches you need to redo these steps for every branch.
49
53
 
@@ -59,68 +63,124 @@ Getting started
59
63
  ```
60
64
  ===========================================================================================
61
65
 
62
- 1) BClass#a_instance_method_override: No Changes
66
+ 1) Override: OrdinaryGem::AnotherTypicalClass#a_singleton_method_that_stays_the_same
63
67
 
64
- ===========================================================================================
68
+ ...........................................................................................
65
69
 
66
- 2)....
67
- .
68
- .
69
- .
70
+ main#cc5a31dc4833734a177f01bd161047f8c7909e16.otf
71
+ -------------------------------------------------------------------------------------------
70
72
 
71
- ===========================================================================================
73
+ Original:
72
74
 
73
- 26) YClass#a_singelton_method_override: Changes between files
75
+ def self.a_singleton_method_that_stays_the_same
76
+ "This is the implementation of a simple singleton method."
77
+ "This method will stay the same in the next version."
78
+ end
74
79
 
75
- in: master#528a0206d8f7cfe08737193659f85e28ccb260eb.otf
76
- YClass#a_singelton_method_override:
77
80
 
78
- Source:
79
- def self.a_singelton_method_override
80
- does_stuff_one_way
81
- end
81
+ in BUNDLE_PATH/bundler/gems/ordinary-gem-e67e062189bb/lib/ordinary_gem/another_typical_class.rb:19
82
+
82
83
 
83
- ../.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/bundler/gems/some_gem/lib/some_gem/y_class.rb:2
84
+ -------------------------------------------------------------------------------------------
84
85
 
85
86
  Override:
86
- def self.a_singelton_method_override
87
- does_stuff_one_way_but_slitly_different
87
+
88
+ def self.a_singleton_method_that_stays_the_same
89
+ "This is our override of a simple singleton method."
90
+ "This method should stay the same in the next version."
88
91
  end
89
92
 
90
- /PATH_TO_PROJECT/app/models/decorators/y_class_decorator.rb:13
93
+
94
+ in: APP_PATH/app/models/ordinary_gem/another_typical_class_monkey_patch.rb:2
95
+
91
96
 
92
97
 
93
- in: upgrade_to_latest#beadcdd8e07a2c9dc2aefddeef04fc42e6fff0d5.otf
94
- YClass#a_singelton_method_override:
98
+ ...........................................................................................
95
99
 
96
- Source:
97
- def self.a_singelton_method_override
98
- does_stuff_in_a_different_way
100
+ attached-to-next-version#a7231014c006a4a5848eb4d92bb465eb5c89ee01.otf
101
+ -------------------------------------------------------------------------------------------
102
+
103
+ Original:
104
+
105
+ def self.a_singleton_method_that_stays_the_same
106
+ "This is the implementation of a simple singleton method."
107
+ "This method will stay the same in the next version."
99
108
  end
100
109
 
101
- ../.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/bundler/gems/some_gem/lib/some_gem/y_class.rb:2
110
+
111
+ in BUNDLE_PATH/bundler/gems/ordinary-gem-f92e5a1a70a6/lib/ordinary_gem/another_typical_class.rb:13
112
+
113
+
114
+ -------------------------------------------------------------------------------------------
102
115
 
103
116
  Override:
104
- def self.a_singelton_method_override
105
- does_stuff_one_way_but_slitly_different
117
+
118
+ def self.a_singleton_method_that_stays_the_same
119
+ "This is our override of a simple singleton method."
120
+ "This method should stay the same in the next version."
106
121
  end
107
122
 
108
- /PATH_TO_PROJECT/app/models/decorators/y_class_decorator.rb:13
109
123
 
124
+ in: APP_PATH/app/models/ordinary_gem/another_typical_class_monkey_patch.rb:2
125
+
126
+
127
+
128
+ ...........................................................................................
129
+
130
+ main#1d279724b26c9491e6e5a01e9711b61a73e9f7e0.otf
131
+ Method not available
132
+
133
+
134
+
135
+
136
+
137
+ ...........................................................................................
138
+ .
139
+ .
140
+ .
141
+ .
110
142
  ===========================================================================================
111
143
 
112
144
  Summary:
113
- Found 29 distinct overridden methods
114
- 10 overridden methods have not changed
115
- 19 overridden methods have changed
116
- 1 where method is not an override
117
- 4 where method is not in codebase
118
- 15 source method bodies have changed
145
+
146
+ Investigated methods: 70
147
+ Diffences on overrides: 42
148
+ Diffences on added methods: 28
149
+
119
150
  ```
120
-
151
+
152
+ ## Overrides.io integration
153
+ <img width="1000" alt="Bildschirm­foto 2023-01-10 um 21 39 42" src="https://user-images.githubusercontent.com/9799974/211657428-c2a7e272-ae86-4c1c-8e77-0a07acc1a4a0.png">
154
+
155
+ Overrides.io is a service that monitors code you override for changes. It notifies you whenever those changes occur.
156
+ Additionally it gives you a beautiful overview of all the methods you have overridden as well as your overrides side by side.
157
+ <p float="left">
158
+ <img width="500" alt="Bildschirm­foto 2023-01-10 um 21 39 15" src="https://user-images.githubusercontent.com/9799974/211658325-60c21057-1a07-4b55-a4d5-3d82470fb3ee.png">
159
+ <img width="500" alt="Bildschirm­foto 2023-01-10 um 21 39 28" src="https://user-images.githubusercontent.com/9799974/211658362-f50435dd-56c5-498b-9038-f702addb0717.png">
160
+ </p>
161
+ Overrides Tracker can easily be integrated into you CI/CD pipeline and configured to send the result files to overrides.io.
162
+
163
+ You basically just have to set OVERRIDES_API_TOKEN environment variable and call 'bundle exec overrides_tracker track'.
164
+ To push it to overrides.io locally you could also just call 'bundle exec overrides_tracker track YOUR_OVERRIDES_API_TOKEN'.
165
+
166
+ You can find a detailed description how to integrate it with CircleCI, GitHub Action and Jenkins here:
167
+
168
+ https://www.overrides.io/continuous_integration
169
+
170
+ ## GEM support
171
+
172
+ Overrides Tracker can also be used on GEMs. It will autoload all classes in the lib and app folders.
173
+
174
+ Sometimes that is not enough:
175
+
176
+ If you need further requirements, you can just add a .overrides_tracker folder and add a requirements.rb file to it.
177
+ In that one you can just require the classes your gem depends on.
178
+
179
+ You can also use the ['require_all'](https://github.com/jarmo/require_all) way to include complete folders, filter files etc..
180
+
121
181
  ## Ruby version compatibility
122
182
 
123
- OverridesTracker is built in [Continuous Integration] on Ruby 2.3+.
183
+ Overrides Tracker is built in [Continuous Integration] on Ruby 2.3+.
124
184
 
125
185
  ## Code of Conduct
126
186
 
@@ -137,4 +197,4 @@ Everyone participating in this project's development, issue trackers and other c
137
197
 
138
198
  ## Copyright
139
199
 
140
- Copyright (c) 2022 Simon Meyborg. See MIT-LICENSE for details.
200
+ Copyright (c) 2023 Simon Meyborg. See MIT-LICENSE for details.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "overrides_tracker"
3
+ require 'bundler/setup'
4
+ require 'overrides_tracker'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "overrides_tracker"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -1,35 +1,53 @@
1
1
  #!/usr/bin/env ruby
2
- if ARGV[0] == "track"
3
- # We set this constant so monkey patching of the gem is only done when checking the overrides
4
- puts 'Reading all methods...'
5
- OVERRIDES_TRACKER_TRACKING_ENABLED = true
6
- require Dir.pwd+'/config/environment.rb'
7
- require 'overrides_tracker'
2
+ if ARGV[0] == 'track'
3
+ # We set this constant so monkey patching of the gem is only done when checking the overrides
8
4
 
9
- OverridesTracker::MethodsCollector.instance.build_overrides_hash
10
- OverridesTracker::MethodsCollector.instance.save_to_file
5
+ OVERRIDES_TRACKER_TRACKING_ENABLED = true
6
+ require 'overrides_tracker'
11
7
 
12
- if ENV['OVERRIDES_API_TOKEN']
13
- OverridesTracker::MethodsCollector.instance.report(ENV['OVERRIDES_API_TOKEN'])
14
- elsif !ARGV[1].nil?
15
- OverridesTracker::MethodsCollector.instance.report(ARGV[1])
8
+ app_environment_file = Dir.pwd + '/config/environment.rb'
9
+ if File.exist?(app_environment_file)
10
+ #We are in a Rails app
11
+ puts 'Reading all methods...'
12
+ require app_environment_file
13
+ else
14
+ #We are in a gem
15
+ puts 'Looking for .overrides_tracker/requierements.rb file for extra requirements...'
16
+ require 'external/require_all'
17
+ gem_requirements_file = Dir.pwd + '/.overrides_tracker/requirements.rb'
18
+
19
+ if File.exist?(gem_requirements_file)
20
+ puts 'Reading all methods...'
21
+ require gem_requirements_file
16
22
  else
17
- #puts 'No OVERRIDES_API_TOKEN was set. The report will not be uploaded to overrides.io.'
18
- #puts ''
19
- #puts 'Have no idea what overrides.io is about? Check it out at https://www.overrides.com'
23
+ puts 'Reading all methods...'
20
24
  end
21
25
 
22
- elsif ARGV[0] == "compare"
26
+
27
+ require_all 'lib/**/*.rb', base_dir: Dir.pwd
28
+ require_all 'app/**/*.rb', base_dir: Dir.pwd
29
+ end
30
+
31
+ OverridesTracker::MethodsCollector.instance.build_overrides_hash
32
+ OverridesTracker::MethodsCollector.instance.save_to_file
33
+
34
+ if ENV['OVERRIDES_API_TOKEN']
35
+ OverridesTracker::MethodsCollector.instance.report(ENV['OVERRIDES_API_TOKEN'])
36
+ elsif !ARGV[1].nil?
37
+ OverridesTracker::MethodsCollector.instance.report(ARGV[1])
38
+ end
39
+
40
+ elsif ARGV[0] == 'compare'
23
41
  require 'overrides_tracker'
24
42
  OverridesTracker::Comparer.compare
25
43
 
26
44
  unless ENV['OVERRIDES_API_TOKEN']
27
45
  puts ''
28
- #puts 'Have you heard of overrides.io?'
29
- #puts 'It integrates with your CI pipeline and notifies you whenever original methods are changing or disappearing.'
30
- #puts 'Check it out at https://www.overrides.com'
31
- end
32
- elsif ARGV[0] == "report"
46
+ # puts 'Have you heard of overrides.io?'
47
+ # puts 'It integrates with your CI pipeline and notifies you whenever original methods are changing or disappearing.'
48
+ # puts 'Check it out at https://www.overrides.com'
49
+ end
50
+ elsif ARGV[0] == 'report'
33
51
  require 'overrides_tracker'
34
52
 
35
53
  if ENV['OVERRIDES_API_TOKEN']