overrides_tracker 0.1.9 → 0.1.12
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 +4 -4
- data/.gitignore +4 -1
- data/Gemfile +12 -3
- data/README.md +15 -0
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/bin/overrides_tracker +39 -21
- data/lib/overrides_tracker/api.rb +47 -19
- data/lib/overrides_tracker/comparer.rb +309 -75
- data/lib/overrides_tracker/file_observer.rb +1 -1
- data/lib/overrides_tracker/methods_collector.rb +114 -83
- data/lib/overrides_tracker/string_colorizer.rb +3 -5
- data/lib/overrides_tracker/util.rb +22 -25
- data/lib/overrides_tracker/version.rb +1 -1
- data/lib/overrides_tracker.rb +17 -38
- data/overrides_tracker.gemspec +19 -19
- data/spec/overrides_tracker_spec.rb +1 -5
- data/spec/spec_helper.rb +21 -5
- metadata +16 -2
@@ -1,4 +1,6 @@
|
|
1
1
|
class OverridesTracker::MethodsCollector
|
2
|
+
require 'active_support/core_ext/string/inflections'
|
3
|
+
|
2
4
|
require 'json'
|
3
5
|
@instance = new
|
4
6
|
|
@@ -6,51 +8,44 @@ class OverridesTracker::MethodsCollector
|
|
6
8
|
@overridden_methods_collection = {}
|
7
9
|
|
8
10
|
private_class_method :new
|
9
|
-
def self.instance
|
10
|
-
@instance
|
11
|
-
end
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
class << self
|
13
|
+
attr_reader :instance
|
15
14
|
end
|
16
15
|
|
17
|
-
def add_singleton_method_for_class(class_name, method_name, method_hash)
|
18
|
-
add_method_for_class(:singleton_methods, class_name, method_name, method_hash)
|
19
|
-
end
|
20
|
-
|
21
16
|
def add_method_for_class(method_type, class_name, method_name, method_hash)
|
22
17
|
methods_collection(class_name)
|
23
18
|
@methods_collection[class_name][method_type][method_name] = method_hash
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
mark_method_as_override(:instance_methods, class_name, method_name, overriding_method, method_hash)
|
28
|
-
end
|
29
|
-
|
30
|
-
def mark_method_as_singleton_override(class_name, method_name, overriding_method, method_hash)
|
31
|
-
mark_method_as_override(:singleton_methods, class_name, method_name, overriding_method, method_hash)
|
19
|
+
if !@methods_collection[class_name][:is_part_of_app] && @methods_collection[class_name][method_type][method_name][:is_part_of_app]
|
20
|
+
@methods_collection[class_name][:is_part_of_app] = true
|
21
|
+
end
|
32
22
|
end
|
33
23
|
|
34
24
|
def mark_method_as_override(method_type, class_name, method_name, overriding_method, method_hash)
|
35
25
|
overridden_methods_collection(class_name)
|
36
|
-
@overridden_methods_collection[class_name][method_type][method_name] =
|
37
|
-
|
26
|
+
@overridden_methods_collection[class_name][method_type][method_name] =
|
27
|
+
@methods_collection[class_name][method_type][method_name]
|
28
|
+
@overridden_methods_collection[class_name][method_type][method_name][:overriding_location] =
|
29
|
+
overriding_method.source_location
|
38
30
|
@overridden_methods_collection[class_name][method_type][method_name][:overriding_body] = method_hash[:body]
|
39
31
|
@overridden_methods_collection[class_name][method_type][method_name][:overriding_sha] = method_hash[:sha]
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
def mark_method_as_added_singleton(class_name, method_name, overriding_method, method_hash)
|
47
|
-
mark_method_as_added(:added_singleton_methods, class_name, method_name, overriding_method, method_hash)
|
32
|
+
if @overridden_methods_collection[class_name][method_type][method_name][:overriding_location][0].include? Dir.pwd
|
33
|
+
@overridden_methods_collection[class_name][method_type][method_name][:overriding_is_part_of_app] = true
|
34
|
+
else
|
35
|
+
@overridden_methods_collection[class_name][method_type][method_name][:overriding_is_part_of_app] = false
|
36
|
+
end
|
48
37
|
end
|
49
38
|
|
50
39
|
def mark_method_as_added(method_type, class_name, method_name, overriding_method, method_hash)
|
51
40
|
overridden_methods_collection(class_name)
|
52
|
-
@overridden_methods_collection[class_name][method_type][method_name] =
|
53
|
-
@overridden_methods_collection[class_name][method_type][method_name][:overriding_location] =
|
41
|
+
@overridden_methods_collection[class_name][method_type][method_name] = method_hash
|
42
|
+
@overridden_methods_collection[class_name][method_type][method_name][:overriding_location] =
|
43
|
+
overriding_method.source_location
|
44
|
+
if @overridden_methods_collection[class_name][method_type][method_name][:overriding_location][0].include? Dir.pwd
|
45
|
+
@overridden_methods_collection[class_name][method_type][method_name][:overriding_is_part_of_app] = true
|
46
|
+
else
|
47
|
+
@overridden_methods_collection[class_name][method_type][method_name][:overriding_is_part_of_app] = false
|
48
|
+
end
|
54
49
|
end
|
55
50
|
|
56
51
|
def build_overrides_hash_for_method_type(clazz, class_methods, methods_type, working_directory)
|
@@ -58,49 +53,51 @@ class OverridesTracker::MethodsCollector
|
|
58
53
|
if methods_type == :instance_methods
|
59
54
|
methods = clazz.instance_methods(false)
|
60
55
|
clazz.ancestors.each do |ancestor|
|
61
|
-
if ancestor.
|
62
|
-
|
63
|
-
|
64
|
-
methods = methods + ancestor.instance_methods(false)
|
56
|
+
break if ancestor.instance_of?(Class)
|
57
|
+
|
58
|
+
methods += ancestor.instance_methods(false)
|
65
59
|
end
|
66
60
|
else
|
67
61
|
methods = clazz.singleton_methods(false)
|
68
62
|
clazz.ancestors.each do |ancestor|
|
69
|
-
if ancestor.
|
70
|
-
|
71
|
-
|
72
|
-
|
63
|
+
break if ancestor.instance_of?(Class)
|
64
|
+
|
65
|
+
methods += ancestor.singleton_methods(false)
|
66
|
+
end
|
67
|
+
clazz.singleton_class.ancestors.each do |ancestor|
|
68
|
+
break if ancestor.instance_of?(Class)
|
69
|
+
methods += ancestor.instance_methods(false)
|
73
70
|
end
|
74
71
|
end
|
75
72
|
|
76
73
|
methods.each do |method_name|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
74
|
+
next unless !method_name.nil? && method_name != :overrides_tracker_finished_file
|
75
|
+
|
76
|
+
method_hash = class_methods[methods_type][method_name]
|
77
|
+
|
78
|
+
begin
|
79
|
+
method_to_check = if methods_type == :instance_methods
|
80
|
+
clazz.instance_method(method_name)
|
81
|
+
else
|
82
|
+
clazz.singleton_class.instance_method(method_name) || clazz.singleton_method(method_name)
|
83
|
+
end
|
85
84
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
end
|
94
|
-
else
|
95
|
-
if (method_to_check_hash[:location][0].include? working_directory)
|
96
|
-
mark_method_as_added("added_#{methods_type}".to_sym, clazz.name, method_name, method_to_check, method_to_check_hash)
|
97
|
-
puts "#{method_name} of class #{clazz.name} was added".green
|
98
|
-
end
|
85
|
+
method_to_check_hash = OverridesTracker::Util.method_hash(method_to_check)
|
86
|
+
|
87
|
+
unless method_to_check_hash[:location].nil?
|
88
|
+
if !method_hash.nil?
|
89
|
+
if method_to_check_hash[:location] != method_hash[:location]
|
90
|
+
mark_method_as_override(methods_type, clazz.name, method_name, method_to_check, method_to_check_hash)
|
91
|
+
puts "#{method_name} of class #{clazz.name} was overridden".green
|
99
92
|
end
|
93
|
+
elsif method_to_check_hash[:location][0].include? working_directory
|
94
|
+
mark_method_as_added("added_#{methods_type}".to_sym, clazz.name, method_name, method_to_check,
|
95
|
+
method_to_check_hash)
|
96
|
+
puts "#{method_name} of class #{clazz.name} was added".green
|
100
97
|
end
|
101
|
-
rescue Exception => e
|
102
|
-
#puts "Error processing #{method_name} of class #{clazz.name}".red
|
103
98
|
end
|
99
|
+
rescue Exception => e
|
100
|
+
# puts "Error processing #{method_name} of class #{clazz.name}".red
|
104
101
|
end
|
105
102
|
end
|
106
103
|
end
|
@@ -109,13 +106,18 @@ class OverridesTracker::MethodsCollector
|
|
109
106
|
total_classes = @methods_collection.size
|
110
107
|
count = 0
|
111
108
|
working_directory = Dir.pwd
|
109
|
+
|
112
110
|
@methods_collection.each do |class_name, class_methods|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
111
|
+
unless class_name.nil?
|
112
|
+
begin
|
113
|
+
clazz = class_name.constantize
|
114
|
+
build_overrides_hash_for_method_type(clazz, class_methods, :instance_methods, working_directory)
|
115
|
+
build_overrides_hash_for_method_type(clazz, class_methods, :singleton_methods, working_directory)
|
116
|
+
rescue Exception => e
|
117
|
+
puts "Error processing #{class_name}".red
|
118
|
+
end
|
117
119
|
end
|
118
|
-
count
|
120
|
+
count += 1
|
119
121
|
puts "Processed #{class_name} #{count} / #{total_classes}"
|
120
122
|
end
|
121
123
|
end
|
@@ -130,28 +132,48 @@ class OverridesTracker::MethodsCollector
|
|
130
132
|
begin
|
131
133
|
File.open(file_path) do |f|
|
132
134
|
file_data = JSON.parse(f.read)
|
133
|
-
data = file_data
|
135
|
+
data = file_data
|
134
136
|
end
|
135
|
-
rescue
|
137
|
+
rescue StandardError
|
136
138
|
puts "Error processing #{file_path}"
|
137
139
|
end
|
138
140
|
data
|
139
141
|
end
|
140
142
|
|
141
143
|
def save_to_file
|
142
|
-
|
143
144
|
file_data = {}
|
144
145
|
file_data[:version] = OverridesTracker::VERSION
|
145
146
|
file_data[:branch_name] = branch_name
|
147
|
+
file_data[:author_name] = author_name
|
148
|
+
file_data[:committer_name] = committer_name
|
146
149
|
file_data[:branch_name_to_report] = branch_name_to_report
|
147
150
|
file_data[:last_commit_id] = last_commit_id
|
148
151
|
file_data[:last_commit_name] = last_commit_name
|
149
152
|
file_data[:last_commit_name_to_report] = last_commit_name_to_report
|
150
153
|
file_data[:working_directory] = Dir.pwd
|
151
154
|
file_data[:bundle_path] = Bundler.bundle_path.to_s
|
152
|
-
file_data[:
|
155
|
+
file_data[:methods_collection] = @overridden_methods_collection
|
153
156
|
|
154
|
-
|
157
|
+
classes_with_overrides = @methods_collection.select do |_key, val|
|
158
|
+
!val[:instance_methods].nil? || !val[:singleton_methods].nil?
|
159
|
+
end
|
160
|
+
classes_with_overrides_transformed = classes_with_overrides.map do |k, v|
|
161
|
+
[k, v[:instance_methods], v[:singleton_methods]]
|
162
|
+
end
|
163
|
+
|
164
|
+
file_data[:number_of_methods] = classes_with_overrides_transformed.sum { |a| a[1].size + a[2].size }
|
165
|
+
file_data[:number_of_methods_in_app_path] = classes_with_overrides_transformed.sum do |a|
|
166
|
+
a[1].sum do |b|
|
167
|
+
(b[1][:is_part_of_app] || b[1][:overriding_is_part_of_app]) ? 1 : 0
|
168
|
+
end + a[2].sum do |b|
|
169
|
+
(b[1][:is_part_of_app] || b[1][:overriding_is_part_of_app]) ? 1 : 0
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
file_data[:number_of_classes] = @methods_collection.size
|
174
|
+
file_data[:number_of_classes_in_app_path] = @methods_collection.select { |_k, v| v[:is_part_of_app] }.size
|
175
|
+
|
176
|
+
File.open(path_to_report_file, 'w') do |f|
|
155
177
|
f << file_data.to_json
|
156
178
|
end
|
157
179
|
puts ' '
|
@@ -170,7 +192,7 @@ class OverridesTracker::MethodsCollector
|
|
170
192
|
@methods_collection[class_name] ||= {}
|
171
193
|
@methods_collection[class_name][:instance_methods] ||= {}
|
172
194
|
@methods_collection[class_name][:singleton_methods] ||= {}
|
173
|
-
@methods_collection[class_name][:
|
195
|
+
@methods_collection[class_name][:is_part_of_app] ||= false
|
174
196
|
end
|
175
197
|
|
176
198
|
def overridden_methods_collection(class_name)
|
@@ -184,34 +206,43 @@ class OverridesTracker::MethodsCollector
|
|
184
206
|
|
185
207
|
def branch_name
|
186
208
|
branch = `git rev-parse --abbrev-ref HEAD`
|
187
|
-
branch.downcase.gsub('/','_').gsub(/\s+/,
|
209
|
+
branch.downcase.gsub('/', '_').gsub(/\s+/, '').chomp
|
188
210
|
end
|
189
211
|
|
190
212
|
def branch_name_to_report
|
191
|
-
branch = `git rev-parse --abbrev-ref HEAD
|
192
|
-
branch.gsub(/\s+/,
|
213
|
+
branch = `git rev-parse --abbrev-ref HEAD`.chomp
|
214
|
+
branch.gsub(/\s+/, '')
|
193
215
|
end
|
194
216
|
|
195
217
|
def last_commit_id
|
196
|
-
commit_id = `git log --format="%H" -n 1
|
197
|
-
commit_id.gsub(/\s+/,
|
218
|
+
commit_id = `git log --format="%H" -n 1`.chomp
|
219
|
+
commit_id.gsub(/\s+/, '')
|
198
220
|
end
|
199
221
|
|
200
222
|
def last_commit_name
|
201
|
-
commit_name = `git log --format="%s" -n 1
|
202
|
-
commit_name.gsub(/\s+/,
|
223
|
+
commit_name = `git log --format="%s" -n 1`.chomp
|
224
|
+
commit_name.gsub(/\s+/, '')
|
203
225
|
end
|
204
226
|
|
205
227
|
def last_commit_name_to_report
|
206
|
-
commit_name = `git log --format="%s" -n 1
|
228
|
+
commit_name = `git log --format="%s" -n 1`.chomp
|
229
|
+
commit_name
|
230
|
+
end
|
231
|
+
|
232
|
+
def author_name
|
233
|
+
author_name = `git show -s --format='%an'`.chomp
|
234
|
+
end
|
235
|
+
|
236
|
+
def committer_name
|
237
|
+
committer_name = `git show -s --format='%cn'`.chomp
|
207
238
|
end
|
208
239
|
|
209
240
|
def path_to_report_file
|
210
241
|
file_name = "#{branch_name}##{last_commit_id}.otf"
|
211
242
|
|
212
|
-
directory_name = File.join(Dir.pwd,
|
213
|
-
Dir.mkdir(directory_name) unless File.
|
243
|
+
directory_name = File.join(Dir.pwd, '/overrides_tracker')
|
244
|
+
Dir.mkdir(directory_name) unless File.exist?(directory_name)
|
214
245
|
|
215
|
-
directory_name+"/#{file_name}"
|
246
|
+
directory_name + "/#{file_name}"
|
216
247
|
end
|
217
|
-
end
|
248
|
+
end
|
@@ -30,12 +30,10 @@ module OverridesTracker::StringColorizer
|
|
30
30
|
def bold
|
31
31
|
"\e[1m#{self}\e[22m"
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def italic
|
35
|
-
"\e[3m#{self}\e[23m"
|
35
|
+
"\e[3m#{self}\e[23m"
|
36
36
|
end
|
37
|
-
|
38
|
-
|
39
37
|
end
|
40
38
|
|
41
|
-
String.prepend(OverridesTracker::StringColorizer)
|
39
|
+
String.prepend(OverridesTracker::StringColorizer)
|
@@ -2,33 +2,30 @@ require 'digest/sha1'
|
|
2
2
|
|
3
3
|
module OverridesTracker
|
4
4
|
class Util
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
5
|
+
def self.method_hash(method)
|
6
|
+
{
|
7
|
+
sha: method_sha(method),
|
8
|
+
location: method.source_location,
|
9
|
+
body: outdented_method_body(method),
|
10
|
+
is_part_of_app: method.source_location[0].include?(Dir.pwd)
|
11
|
+
}
|
12
|
+
rescue StandardError
|
13
|
+
{
|
14
|
+
sha: nil,
|
15
|
+
location: nil,
|
16
|
+
body: nil,
|
17
|
+
is_part_of_app: false
|
18
|
+
}
|
19
|
+
end
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
def self.outdented_method_body(method)
|
22
|
+
body = method.source
|
23
|
+
indent = body.match(/^\W+/).to_s
|
24
|
+
body.lines.map { |l| l.sub(indent, '') }.join
|
25
|
+
end
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
end
|
27
|
+
def self.method_sha(method)
|
28
|
+
Digest::SHA1.hexdigest(method.source.gsub(/\s+/, ' '))
|
32
29
|
end
|
33
30
|
end
|
34
31
|
end
|
data/lib/overrides_tracker.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
|
-
require
|
1
|
+
require 'overrides_tracker/version'
|
2
2
|
|
3
3
|
# dependency for extracting method bodies and comments
|
4
4
|
require 'method_source'
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
|
6
|
+
require 'overrides_tracker/version'
|
7
|
+
require 'overrides_tracker/methods_collector'
|
8
|
+
require 'overrides_tracker/file_observer'
|
9
|
+
require 'overrides_tracker/string_colorizer'
|
10
|
+
require 'overrides_tracker/util'
|
11
|
+
require 'overrides_tracker/comparer'
|
12
|
+
require 'overrides_tracker/api'
|
13
|
+
require 'overrides_tracker/hash_decorator'
|
14
14
|
|
15
15
|
module OverridesTracker
|
16
|
-
|
17
16
|
end
|
18
17
|
|
19
18
|
# We only want to do this core ruby monkey patching when using cli
|
@@ -37,39 +36,19 @@ if defined? OVERRIDES_TRACKER_TRACKING_ENABLED
|
|
37
36
|
inst_methods.each do |inst_method|
|
38
37
|
method = clazz.instance_method(inst_method)
|
39
38
|
method_hash = OverridesTracker::Util.method_hash(method)
|
40
|
-
OverridesTracker::MethodsCollector.instance.
|
39
|
+
OverridesTracker::MethodsCollector.instance.add_method_for_class(:instance_methods, clazz.name, inst_method,
|
40
|
+
method_hash)
|
41
41
|
end
|
42
42
|
|
43
43
|
single_methods = clazz.singleton_methods(false)
|
44
44
|
single_methods.each do |single_method|
|
45
|
-
|
46
|
-
method = clazz.singleton_method(single_method)
|
47
|
-
method_hash = OverridesTracker::Util.method_hash(method)
|
48
|
-
OverridesTracker::MethodsCollector.instance.add_singleton_method_for_class(clazz.name, single_method, method_hash)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
45
|
+
next unless single_method != :overrides_tracker_finished_file
|
55
46
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
def deep_merge(other_hash, &block)
|
62
|
-
dup.deep_merge!(other_hash, &block)
|
63
|
-
end
|
64
|
-
|
65
|
-
def deep_merge!(other_hash, &block)
|
66
|
-
merge!(other_hash) do |key, this_val, other_val|
|
67
|
-
if this_val.is_a?(Hash) && other_val.is_a?(Hash)
|
68
|
-
this_val.deep_merge(other_val, &block)
|
69
|
-
elsif block_given?
|
70
|
-
block.call(key, this_val, other_val)
|
71
|
-
else
|
72
|
-
other_val
|
47
|
+
method = clazz.singleton_method(single_method)
|
48
|
+
method_hash = OverridesTracker::Util.method_hash(method)
|
49
|
+
OverridesTracker::MethodsCollector.instance.add_method_for_class(:singleton_methods, clazz.name,
|
50
|
+
single_method, method_hash)
|
51
|
+
end
|
73
52
|
end
|
74
53
|
end
|
75
54
|
end
|
data/overrides_tracker.gemspec
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
3
|
+
require 'overrides_tracker/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
6
|
+
spec.name = 'overrides_tracker'
|
8
7
|
spec.version = OverridesTracker::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
8
|
+
spec.authors = ['Simon Meyborg']
|
9
|
+
spec.email = ['meyborg@syborgstudios.com']
|
11
10
|
|
12
11
|
spec.summary = 'Overrides Tracker monitors methods you override for changes and allows for comparison across branches.'
|
13
12
|
spec.description = 'Overrides Tracker monitors methods you override for changes and allows for comparison across branches.'
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/SyborgStudios/overrides_tracker'
|
14
|
+
spec.license = 'MIT'
|
16
15
|
|
17
16
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
17
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
18
|
if spec.respond_to?(:metadata)
|
20
|
-
spec.metadata[
|
19
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
21
20
|
|
22
|
-
spec.metadata[
|
23
|
-
spec.metadata[
|
24
|
-
spec.metadata[
|
21
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
22
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
23
|
+
spec.metadata['changelog_uri'] = 'https://github.com/SyborgStudios/overrides_tracker/CHANGELOG.md'
|
25
24
|
else
|
26
|
-
raise
|
27
|
-
|
25
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
26
|
+
'public gem pushes.'
|
28
27
|
end
|
29
28
|
|
30
29
|
# Specify which files should be added to the gem when it is released.
|
31
30
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
31
|
|
33
|
-
spec.files
|
34
|
-
|
32
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
33
|
+
`git ls-files -z`.split("\x0")
|
35
34
|
end
|
36
35
|
|
37
|
-
spec.bindir =
|
36
|
+
spec.bindir = 'bin'
|
38
37
|
spec.executables = ['overrides_tracker']
|
39
|
-
spec.require_paths = [
|
38
|
+
spec.require_paths = ['lib']
|
40
39
|
|
41
|
-
spec.add_dependency
|
40
|
+
spec.add_dependency 'activesupport'
|
41
|
+
spec.add_dependency 'method_source'
|
42
42
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,28 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
require 'simplecov-lcov'
|
4
|
+
|
5
|
+
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
|
7
|
+
|
8
|
+
SimpleCov.start 'rails' do # <============= 2
|
9
|
+
add_filter 'spec/'
|
10
|
+
add_filter 'lib/external/require_all.rb'
|
11
|
+
add_filter 'lib/overrides_tracker/version.rb'
|
12
|
+
add_filter 'lib/overrides_tracker.rb'
|
13
|
+
end
|
14
|
+
|
15
|
+
Coveralls.wear!
|
16
|
+
|
17
|
+
require 'bundler/setup'
|
18
|
+
require 'overrides_tracker'
|
19
|
+
require 'rspec'
|
3
20
|
|
4
21
|
RSpec.configure do |config|
|
5
22
|
# Enable flags like --only-failures and --next-failure
|
6
|
-
config.
|
7
|
-
|
23
|
+
config.mock_with :rspec
|
8
24
|
# Disable RSpec exposing methods globally on `Module` and `main`
|
9
|
-
config.disable_monkey_patching!
|
25
|
+
# config.disable_monkey_patching!
|
10
26
|
|
11
27
|
config.expect_with :rspec do |c|
|
12
28
|
c.syntax = :expect
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overrides_tracker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Meyborg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: method_source
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|